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
相关推荐
金銀銅鐵9 分钟前
[Java] 以 IntStream 为例,浅析 Stream 的实现
java·后端
曳渔1 小时前
UDP/TCP套接字编程简单实战指南
java·开发语言·网络·网络协议·tcp/ip·udp
hqxstudying2 小时前
JAVA项目中邮件发送功能
java·开发语言·python·邮件
最初的↘那颗心2 小时前
Java HashMap深度解析:原理、实现与最佳实践
java·开发语言·面试·hashmap·八股文
小兔兔吃萝卜2 小时前
Spring 创建 Bean 的 8 种主要方式
java·后端·spring
Q_Q5110082852 小时前
python的软件工程与项目管理课程组学习系统
spring boot·python·django·flask·node.js·php·软件工程
亲爱的马哥2 小时前
重磅更新 | 填鸭表单TDuckX2.9发布!
java
Java中文社群2 小时前
26届双非上岸记!快手之战~
java·后端·面试
whitepure2 小时前
万字详解Java中的面向对象(二)——设计模式
java·设计模式
whitepure2 小时前
万字详解Java中的面向对象(一)——设计原则
java·后端