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
相关推荐
xjz18425 分钟前
JVM虚拟线程:JEP 444开启Java并发编程新纪元
java
JH30736 分钟前
Spring Retry 实战:优雅搞定重试需求
java·后端·spring
czlczl200209259 分钟前
实战:基于 MyBatis-Plus 实现无感知的“数据权限”自动过滤
spring boot·mybatis
蓝眸少年CY20 分钟前
测试Java性能
java·开发语言·python
何包蛋H21 分钟前
数据结构深度解析:Java Map 家族完全指南
java·开发语言·数据结构
linsa_pursuer41 分钟前
最长连续序列
java·数据结构·算法·leetcode
强子感冒了41 分钟前
Java集合框架深度学习:从Iterable到ArrayList的完整继承体系
java·笔记·学习
drebander43 分钟前
Cursor IDE 中 Java 项目无法跳转到方法定义问题解决方案
java·ide·cursor
来不及辣哎呀1 小时前
学习Java第六十二天——Hot 100-09-438. 找到字符串中所有字母异位词
java·开发语言·学习
linsa_pursuer1 小时前
移动零算法
java·算法