How can I make the test jar include dependencies in Maven?

后端 未结 6 1801
广开言路
广开言路 2020-12-28 20:05

I have a project with src/main/java and src/test/java structure, and I managed to use maven-jar-plugin to build a jar of the test branch. However, I want to package the test

6条回答
  •  一个人的身影
    2020-12-28 20:06

    The following worked for Maven 3

    POM.XML

    
        org.apache.maven.plugins
        maven-jar-plugin
        2.6
        
            
                
                    test-jar
                
                test-compile
            
        
    
    

    ASSEMBLY FILE

    
        demo/test-lib
        
                 
            io.netty:netty-all
            
            ${project.groupId}:${project.artifactId}:test-jar
        
        true
        test
    
    

提交回复
热议问题