<!-- tomcat7运行插件 -->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<uriEncoding>UTF-8</uriEncoding>
<url>http://localhost:${maven.tomcat.port}/</url>
<server>tomcat7</server>
<systemProperties>
<bootClass>${bootClass}</bootClass>
<!-- 微服务应用端口与上下文路径 -->
<server.port>${maven.tomcat.port}</server.port>
<server.context-path>${maven.tomcat.path}/rest</server.context-path>
</systemProperties>
</configuration>
</plugin>
<!-- 自定义插件 -->
<plugin>
<groupId>org.example</groupId>
<artifactId>PluginDemo</artifactId>
<version>1.0</version>
<executions>
<execution>
<goals>
<goal>checkZtbConfig</goal>
</goals>
</execution>
</executions>
<configuration>
<modelMapping>
<keyName>ZTBFileStoragePath</keyName>
<keyName>ZTBFileStorageType</keyName>
<keyName>Bid_Confidence_Threshold</keyName>
</modelMapping>
</configuration>
</plugin>
实际上 Maven 插件除了是绑定在生命周期的那种以外,其余所有插件都要声明 goal
请看 spring boot 的打包插件,也是要声明 goal
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<configuration>
<fork>true</fork>
<mainClass>${start-class}</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>