springboot maven打包 pom配置

1.pom中build标签


		true
	
  
        ${project.artifactId}  
          
              
                org.apache.maven.plugins  
                maven-compiler-plugin  
                  
                    1.8  
                    1.8  
                  
            
            
				org.apache.maven.plugins
				maven-jar-plugin
				
					
						
							com.nxslow.view.XXXApplication
							true
							lib/
						
					
							config/
						
					
					
						*.yml
						*.properties
						*.xml
                        static/**  
                        templates/**  
					
				
			  
              
                org.apache.maven.plugins  
                maven-dependency-plugin  
                  
                      
                        copy-dependencies  
                        package  
                          
                            copy-dependencies  
                          
                          
                            target/lib  
                            false  
                            false  
                            runtime  
                          
                      
                  
              
              
                org.springframework.boot  
                spring-boot-maven-plugin  
                  
                    ZIP  
                      
                          
                            cn.jstars  
                            datatocloud  
                          
                      
                  
              
              
                org.apache.maven.plugins  
                maven-resources-plugin  
                  
                    UTF-8  
                  
              
              
                org.apache.maven.plugins  
                maven-surefire-plugin  
                  
                    true  
                  
              
              
                org.apache.maven.plugins  
                maven-checkstyle-plugin  
                2.17  
                  
                    checkstyle.xml  
                  
              
              
                org.apache.maven.plugins  
                maven-jxr-plugin  
                2.3  
              
          
        
			
				src/main/java
				
					**/*.xml
				
				false
			
			
				src/main/resources
				
					**/*.xml
					**/*.properties
					**/*.yml
				
				
					static/**
					templates/**
				
				${project.build.directory}/config
			
			
				src/main/resources
				
					static/*.*
					templates/**/*.*
				
				${project.build.directory}/
			
		
     
  1. 功能:
依赖的jar分离,
项目的配置文件外置, 
项目中com.**.mapper.*.xml里的xml文件会被打包到appName.jar里
  1. 打包成功后同级目录下的内容
/lib
/static
/templates
/config     (里面是xml,yml,properties等配置文件)
appName.jar(要运行的jar包)
  1. 运行jar包
java -jar appName.jar(或者java -jar -Dloader.path=.,lib appName.jar)

你可能感兴趣的:(归纳总结集)