Can I add jars to maven 2 build classpath without installing them?

前端 未结 24 3039
萌比男神i
萌比男神i 2020-11-22 01:41

Maven2 is driving me crazy during the experimentation / quick and dirty mock-up phase of development.

I have a pom.xml file that defines the dependenc

24条回答
  •  南旧
    南旧 (楼主)
    2020-11-22 02:10

    For those that didn't find a good answer here, this is what we are doing to get a jar with all the necessary dependencies in it. This answer (https://stackoverflow.com/a/7623805/1084306) mentions to use the Maven Assembly plugin but doesn't actually give an example in the answer. And if you don't read all the way to the end of the answer (it's pretty lengthy), you may miss it. Adding the below to your pom.xml will generate target/${PROJECT_NAME}-${VERSION}-jar-with-dependencies.jar

            
                org.apache.maven.plugins
                maven-assembly-plugin
                2.4.1
                
                    
                    
                        jar-with-dependencies
                    
                    
                    
                      
                        my.package.mainclass
                      
                    
    
                
                
                  
                    make-assembly
                    
                    package 
                    
                        single
                    
                  
                
            
    

提交回复
热议问题