maven exec plugin启动springboot应用并且change port更改端口(多模块)

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
相关推荐
okiseethenwhat6 分钟前
Java 进程 CPU 飙高排查全流程详解
java·开发语言
2601_949816687 分钟前
使用rustDesk搭建私有远程桌面
java
weixin_491853317 分钟前
activeMq在springboot项目中集成和使用
spring boot·activemq
vx-程序开发13 分钟前
springboot智慧校园实验室管理系统-计算机毕业设计源码70397
spring boot·后端·课程设计
看见代码就想敲14 分钟前
java学习之(Maven pom.xml 详细讲解)
java·学习·maven
糖炒栗子032622 分钟前
图片加水印与 EXIF 保留方案
java
tongxh42322 分钟前
Spring Boot问题总结
java·spring boot·后端
Chan1628 分钟前
SpringAI:RAG 最佳实践与调优
java·spring boot·ai·java-ee·intellij-idea·rag·springai
odng29 分钟前
Windsurf / Codex 默认只显示 3 个最近任务,如何改成 100 个
java
m0_7167652331 分钟前
C++巩固案例--通讯录管理系统详解
java·开发语言·c++·经验分享·学习·青少年编程·visual studio