maven-jar-plugin 插件打包jar配置

无依赖包pom.xml配置

    
        
            
                org.apache.maven.plugins
                maven-jar-plugin
                3.2.2
                
                    
                        
                           true
                            lib/
                            false
                            
                                com.github.lzh.FileTools  #main函数所在的类路径
                            
                        
                    
                
            
        

    

MANIFEST.MF文件讲解:

Manifest-Version: 1.0    
Created-By: Maven JAR Plugin 3.2.2   # maven-jar-plugin版本
Build-Jdk-Spec: 17    #jdk的版本
Main-Class: com.github.lzh.FileTools  #对应的是mainClass配置项

有依赖包pom.xml配置

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

加载配置文件

            
                org.apache.maven.plugins
                maven-resources-plugin
                3.2.0
                
                    
                        copy-resource
                        validate
                        
                            copy-resources
                        
                        
                            
                            ${project.build.directory}/conf
                            
                                
                                
                                    src/main/resources
                                    true
                                
                            
                        
                    
                
            

你可能感兴趣的:(maven,plugin,jar,maven,java)