Excluding “provided” dependencies from Maven assembly

后端 未结 4 1299
长情又很酷
长情又很酷 2020-12-25 13:49

I am trying to use the Maven assembly plugin to build a jar-with-dependencies, except those that have provided scope.

I have copied the jar-with-dependencie

4条回答
  •  北海茫月
    2020-12-25 14:36

    This is an old post, but the maven-dependency-plugin now has an "excludeScope" option that you can set to "provided" or whatever scope you need.

    http://maven.apache.org/plugins/maven-dependency-plugin/copy-dependencies-mojo.html#excludeScope

    For example,

    
        org.apache.maven.plugins
        maven-dependency-plugin
        2.10
        
            
                copy-dependencies
                prepare-package
                
                    copy-dependencies
                
                
                    ${project.build.directory}/lib
                    false
                    false
                    true
                    provided
                
            
        
    
    

提交回复
热议问题