常用Maven包 -- pom.xml

Maven – pom.xml

打包相关插件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<properties>
<maven.build.timestamp.format>yyyy-MM-dd</maven.build.timestamp.format>
<project.jar.output.directory>
G:\packages
</project.jar.output.directory>
</properties>
<build>
<plugins>
<!--用于启动 springboot 插件 !!!!!试了下,不能和下面插件共存-->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
</configuration>
</plugin>

<!--用于跳过测试test插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<!--用于把包打到指定目录插件 -->
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<!-- 在maven进行package的时候执行-->
<phase>package</phase>
<configuration>
<tasks>
<!--jar包保存位置 -->
<copy todir="${project.jar.output.directory}${maven.build.timestamp}">
<!--antrun自动生成的配置文件的保存位置,这里默认是父项目的target文件夹 -->
<fileset dir="${project.build.directory}">
<include name="*.jar" />
</fileset>
</copy>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>