xml
<!--在子模块的pom中添加-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<executable>java</executable>
<arguments>
<argument>-classpath</argument>
<!-- automatically creates the classpath using all project dependencies,
also adding the project build directory -->
<classpath/>
<argument>-Dserver.port=8081</argument>
<argument>com.rf.wxshop.WxshopApplication</argument>
</arguments>
</configuration>
</plugin>
shell
mvn exec:exec
多模块时,假设wxshop-main
为子模块
首先需要将所有模块安装到本地(会安装parent pom中的dependencies)
shell
mvn install -pl wxshop-main -am
然后执行命令
shell
mvn exec:exec -pl wxshop-main