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
相关推荐
yuren_xia12 分钟前
Spring MVC中自定义日期类型格式转换器
java·spring·mvc
GottdesKrieges1 小时前
OceanBase数据库磁盘空间管理
java·数据库·oceanbase
Themberfue2 小时前
Redis ⑦-set | Zset
java·开发语言·数据库·redis·sql·缓存
此木|西贝6 小时前
【设计模式】享元模式
java·设计模式·享元模式
李少兄7 小时前
解决Spring Boot多模块自动配置失效问题
java·spring boot·后端
bxlj_jcj7 小时前
JVM性能优化之年轻代参数设置
java·性能优化
八股文领域大手子7 小时前
深入理解缓存淘汰策略:LRU 与 LFU 算法详解及 Java 实现
java·数据库·算法·缓存·mybatis·哈希算法
不当菜虚困7 小时前
JAVA设计模式——(八)单例模式
java·单例模式·设计模式
m0_740154677 小时前
Maven概述
java·maven