How to include dependency with 'provided' scope with maven-assembly-plugin

前端 未结 5 579
被撕碎了的回忆
被撕碎了的回忆 2021-02-01 18:27

I am fighting with maven to include a managed dependency with \'provided\' scope into tar file by using the maven-assembly-plugin.

I use super parent pom file as a base

5条回答
  •  忘了有多久
    2021-02-01 18:46

    it is not possible to override the 'provided' scope in maven.

    To solve this issue, I declared a variable in the parent pom that will define the artifact scope. In order to override the scope the only thing that has to be done, is to set new value for the variable in the inherited pom.

    See example below:

    parent pom:

        
                1.2.8
                provided
        
    .
    .
    .
        
            
                
                    log4j
                    log4j
                    ${log4j.version}
                    ${log4j.scope}
                
            
        
    

    Now in the child pom, just declare the variable again:

    
            runtime
    
    

提交回复
热议问题