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
相关推荐
SimonKing9 小时前
JetBrains+Qoder变身Agentic 编码平台,媲美Cursor、Trae等AI编程平台
java·后端·程序员
Seven9710 小时前
NIO:解开非阻塞I/O高并发编程的秘密
java
华仔啊21 小时前
千万别给数据库字段加默认值 null!真的会出问题
java·数据库·后端
老赵全栈实战1 天前
【每日一技MyBatis trim标签核心用法
java·mybatis·orm
beata1 天前
Java基础-19:Java 死锁深度解析:从原理、检测到预防与实战指南
java·前端
吾日三省Java1 天前
Spring Cloud架构下的日志追踪:传统MDC vs 王炸SkyWalking
java·后端·架构
爱玩泥巴的小t1 天前
new Thread().start()底层做了什么?
java
码路飞1 天前
GPT-5.4 Computer Use 实战:3 步让 AI 操控浏览器帮你干活 🖥️
java·javascript
祈安_1 天前
Java实现循环队列、栈实现队列、队列实现栈
java·数据结构·算法
皮皮林5512 天前
拒绝写重复代码,试试这套开源的 SpringBoot 组件,效率翻倍~
java·spring boot