How to activate a Maven profile in a dependent module?

前端 未结 2 1911
南旧
南旧 2020-12-18 23:17

Suppose I have a module A:jar, whose runtime and compilation set of dependencies depends on the JDK version. In my example, I have a pre-jdk6-profile

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-18 23:58

    a) In a multi-module build, you should always build from the top pom, never from an individual module. If you want to build only one module, use advanced reactor options (see mvn --help) like this:

    mvn -pl mymodule
    

    b) Define and activate the profile in the parent pom, but add the configuration in the child pom.

    parent pom.xml

    
        
             pre-jdk-6
             
                (,1.6.0)
             
        
    
    

    child pom.xml

    
        
            pre-jdk-6
    
            
                
                    javax.xml.ws
                    jaxws-api
                
            
        
    
    

提交回复
热议问题