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
相关推荐
shehuiyuelaiyuehao43 分钟前
算法46,分治快排,排序数组
java·算法·排序算法·排序
野生技术架构师1 小时前
1200 道 JAVA 面试题(各大企业常见面试题及答案)
java·开发语言
careathers1 小时前
【数据结构】栈
java·数据结构
邪修king1 小时前
Re:Linux系统篇(二十六):文件系统(二):Ext 文件系统底层详解:从 inode、块组到软硬链接,结合 Windows 讲透文件管理本质
android·java·linux
RuoyiOffice1 小时前
SpringBoot3+Vue3 库存盘点:账面和实盘对不上,差异单怎么走审批再调账
spring boot·vue3·erp·spring boot 3·库存盘点·盘盈盘亏
Yyyyyy~1 小时前
【java】类和对象
java·开发语言
重生之小比特2 小时前
【Java SE】抽象类和接口
java·开发语言
Lyyaoo.2 小时前
【设计模型】策略模式
java
譕痕2 小时前
Idea 集成 智能体开发工具“千问(qwen)”
java·ide·spring·语言模型
用户8181870627462 小时前
第27章 消息丢失/重复消费的全链路排查(生产者→Broker→消费者)
java·后端