maven 打包可执行jar的方法

1.修改pom.xml增加如下内容

			
				org.apache.maven.plugins
				maven-jar-plugin
				2.4
				
					
						
							true
							lib/
							com.sysware.HelloWorld
						
					
				
			

运行mvn clean package即可

2.在pom.xml增加如下内容

			
				org.apache.maven.plugins
				maven-assembly-plugin
				2.3
				
					false
					
						jar-with-dependencies
					
					
						
							com.juvenxu.mvnbook.helloworld.HelloWorld
						
					
				
				
					
						make-assembly
						package
						
							assembly
						
					
				
			
运行mvn assembly:assembly


3.


		...
		src/main/java
		
			
			
				src/main/resources
				${project.build.directory}
			
		
		
			
			
				org.apache.maven.plugins
				maven-compiler-plugin
				
					lib
					1.6
					1.6
					UTF-8
				
			
			
			
				org.apache.maven.plugins
				maven-jar-plugin
				
					
						
							true
							lib/
							.....MonitorMain
						
					
				
			
			
			
				org.apache.maven.plugins
				maven-dependency-plugin
				
					
						copy
						package
						
							copy-dependencies
						
						
							
								${project.build.directory}/lib
							
						
					
				
			
			
			
				org.apache.maven.plugins
				maven-resources-plugin
				2.3
				
					UTF-8
				
			
			
			
				maven-source-plugin
				2.1
				
					true
					UTF-8
				
				
					
						compile
						
							jar
						
					
				
			
		
	

4.

	
		
			
				${project.build.directory}/classes
				src/main/resources
				true
				
					**/*.xml
				
			
		
		
			
				org.apache.maven.plugins
				maven-compiler-plugin
				3.0
				
					1.6
					1.6
					UTF-8
				
			
			
				org.apache.maven.plugins
				maven-shade-plugin
				2.0
				
					
						package
						
							shade
						
						
							
								
									com.test.testguava.app.App
								
								
									applicationContext.xml
								
							
							true
							executable
						
					
				
			
		
	




你可能感兴趣的:(安装配置,Java,jar,assembly)