废话不多,直接贴代码,以作笔记
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>3.0.1</version>
<configuration>
[...]
<modules>
<webModule>
<groupId>com.test.webdemo</groupId>
<artifactId>myweb</artifactId>
<!-- contextRoot标签内的内容就是你想设置的content-path,也可以说是contentRoot -->
<contextRoot>/custom-context-root</contextRoot>
</webModule>
</modules>
</configuration>
</plugin>
</plugins>
</build>