
Maven的打包方式和执行jar
- 1. Jar
- 1.1 Pom.xml
- 1.2 Run
- 1.3 自动执行方法
- 2. Assembl1y
- 2.1 Pom.xml
- 2.2 Run
- 2.3 要执行的方法
- 3. Awakening
1. Jar
1.1 Pom.xml
<plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>3.8.1</version><configuration><source>1.8</source><target>1.8</target><encoding>UTF-8</encoding></configuration></plugin><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins>
1.2 Run
java -jar hello-world-0.0.1-SNAPSHOT.jar
1.3 自动执行方法
2. Assembl1y
2.1 Pom.xml
2.2 Run
java -classpath hello-world-0.0.1-SNAPSHOT.jar com.demo.controller.HelloController
2.3 要执行的方法
public class HelloController {public static void main(String[] args) {for (int x = 0; x < 100 ; x++) {System.out.println("this is " +i+ " test");}}
3. Awakening
在一秒钟内看到本质的人和花半辈子也看不清一件事本质的人,自然是不一样的命运。