-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpom.xml
177 lines (157 loc) · 5.6 KB
/
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>公司域名倒序</groupId>
<artifactId>项目包名</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>${project.artifactId} 中文简称</name>
<description>中文全称 英文全称</description>
<properties>
<!-- 分环境打包用参数 -->
<envSuffix>dev</envSuffix>
<!-- 避免被安装发布到仓库 -->
<maven.install.skip>true</maven.install.skip>
<maven.deploy.skip>true</maven.deploy.skip>
<java.version>1.7</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<maven.compiler.compilerVersion>${java.version}</maven.compiler.compilerVersion>
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<libPath>${project.basedir}/WebContent/WEB-INF/lib/</libPath>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet.jsp/javax.servlet.jsp-api -->
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.3</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<!-- 分环境打包 -->
<filters>
<filter>${basedir}/src/filters/${envSuffix}.properties</filter>
</filters>
<!-- maven.resources.overwrite 没设置 true 时不会覆盖,即前面的优先 -->
<resources>
<resource>
<directory>${basedir}/src/main/env/${envSuffix}</directory>
</resource>
<resource>
<directory>${basedir}/src/main/env/filtered</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>${basedir}/src/main/resources</directory>
</resource>
<!-- 编译 src/main/java 目录下的 xml 文件 -->
<resource>
<directory>${basedir}/src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<!-- 读本地 和 Oracle JDK 的 jar,迁移 maven dependencies 的话可以取消这个插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<compilerArgs>
<arg>-bootclasspath</arg>
<arg>${java.home}/lib/rt.jar</arg>
<arg>-extdirs</arg>
<arg>${libPath}${path.separator}${java.home}/lib/${path.separator}${java.home}/lib/ext/</arg>
</compilerArgs>
</configuration>
</plugin>
<!-- 不修改目录结构升级 Maven 用 -->
<!-- http://www.mojohaus.org/build-helper-maven-plugin/usage.html -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${basedir}/src/</source>
<source>${basedir}/src2/</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<!-- 不修改目录结构升级 Maven 用 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.1</version>
<configuration>
<failOnMissingWebXml>true</failOnMissingWebXml>
<warSourceDirectory>${basedir}/WebContent/</warSourceDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.0.0</version>
<executions>
<!-- 环境提示 -->
<execution>
<id>echo</id>
<phase>validate</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<!-- http://ant.apache.org/manual/Tasks/ -->
<target>
<echo level="info">path.separator: ${path.separator}</echo>
<echo level="info">envSuffix: ${envSuffix}</echo>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<!-- 集成测试环境打包 mvn package -P sit -->
<profile>
<id>sit</id>
<properties>
<envSuffix>sit</envSuffix>
</properties>
</profile>
<!-- 生产环境打包 mvn package -P prd -->
<profile>
<id>prd</id>
<properties>
<envSuffix>prd</envSuffix>
</properties>
</profile>
</profiles>
</project>