1.在pom.xml中进行如下配置:
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <finalName>${project.build.finalName}-${build.time}</finalName> </configuration> </plugin><plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.5</version> <configuration> <finalName>${project.build.finalName}-${build.time}</finalName> </configuration> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <version>1.9.1</version> <executions> <execution> <id>timestamp-property</id> <goals> <goal>timestamp-property</goal> </goals> </execution> </executions> <configuration> <name>build.time</name> <pattern>yyyyMMddHHmm</pattern> <timeZone>GMT+8</timeZone> <regex/> <source/> <value/> </configuration> </plugin> </plugins> </build>
2.执行相关指令(idea整合maven,并在Terminal中可以maven操作)
maven打包 :mvn clean package -Dmaven.test.skip=true 查看相关进程是否启动:ps -ef | grep ************* 通過端口查询进程:netstat -tunlp|grep 端口号 杀死进程: kill -9 进程 nohup java -jar xxx.jar >test.log 2>&1 & 后台启动