How do you create a standalone application with dependencies intact using Maven?

前端 未结 4 916
无人及你
无人及你 2020-12-31 12:03

I have a desktop Java application built using Maven 2 (but I could upgrade to Maven 3 if that helps) with a number of open source dependencies. I\'m now trying to package it

4条回答
  •  一个人的身影
    2020-12-31 12:58

    Try creating a custom assembly descriptor and add a dependencySet and make sure you specify, unpack as false.

    Use this as assembly descriptor,

    
    
        distribution
        
            zip
        
        
            
                runtime
                lib
                            false
                false
            
        
    
    

    Store this file to say src/main/assembly/assembly.xml and update your assembly plugin configuration in pom.xml like this.

            
                org.apache.maven.plugins
                maven-assembly-plugin
                2.2.1
                
                    
                        assembly
                        package
                        
                            attached
                        
                        
                               ${basedir}/src/main/assembly/assembly.xml
                        
                    
                
            
    

    Here is assembly descriptor reference if you need anything more

    http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html

提交回复
热议问题