How to exclude a dependency from parent's project in Maven?

前端 未结 6 2237
孤独总比滥情好
孤独总比滥情好 2020-12-24 12:11

For example, I have 2 Maven projects. One is \"project-parent\". The other is \"project-child\". Obviously, \"project-child\" is the sub project of \"project-parent\".

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-24 12:32

    If I understand the question, what you need is something like the following. It pulls in a dependency and excludes that dependency from adding to its dependency list. Often this is used if you want to inject a newer version of a package instead of the one referenced in the other package.

    
        log4j
        log4j
        1.2.15
        
            
                com.sun.jmx
                jmxri
            
            ...
        
        ...
    

    If you are instead talking about a relationship then I'm not sure there is a way to do this. Can you switch from being a to a ?

提交回复
热议问题