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
相关推荐
小江的记录本4 分钟前
【Spring AI】Spring AI中RAG误触发与系统提示词泄露问题解决方案(完整版+代码方案)
java·人工智能·spring boot·后端·python·spring·面试
勇往直前plus12 分钟前
Python 属性访问与操作全解析:内置函数、魔法方法与描述符深度指南
java·网络·python
Arenaschi18 分钟前
关于GPT的版特点
java·网络·人工智能·windows·python·gpt
人道领域18 分钟前
【LeetCode刷题日记】108.将有序数组转换为二叉搜索树
java·算法·leetcode
橙淮25 分钟前
并发编程(五)
java
过期动态32 分钟前
【LeetCode 热题 100】无重复字符的最长子串
java·数据结构·spring boot·算法·leetcode·职场和发展
Yeats_Liao34 分钟前
好复杂的 IoT 世界:工业数据采集技术栈全景解析
java·物联网·struts
月落归舟43 分钟前
Java线程小记
java·开发语言
西凉的悲伤44 分钟前
Spring Cloud Gateway介绍
java·spring cloud·gateway
逸Y 仙X1 小时前
文章五:Elasticsearch安全通信
java·大数据·安全·elasticsearch·搜索引擎·全文检索·jenkins