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
相关推荐
夕除3 小时前
js--7
java
布谷歌3 小时前
面试题整理
java·开发语言
爬山算法3 小时前
Hibernate(74)如何在CQRS架构中使用Hibernate?
java·架构·hibernate
jjjava2.03 小时前
深入解析Set与Map的奥秘
java·开发语言
白宇横流学长3 小时前
基于Java的火车票订票系统的设计与开发
java·开发语言
黎雁·泠崖3 小时前
Java核心基础API学习总结:从Object到包装类的核心知识体系
java·开发语言·学习
Yvonne爱编码3 小时前
JAVA数据结构 DAY1-集合和时空复杂度
java·数据结构·python
win x3 小时前
JavaSE(基础)高频面试点及 知识点
java·面试·职场和发展
Terio_my3 小时前
简要 Java 面试题学习
java·开发语言·学习
好好研究4 小时前
Spring Boot - Thymeleaf模板引擎
java·spring boot·后端·thymeleaf