首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >boot项目添加运行参数的maven插件

boot项目添加运行参数的maven插件

作者头像
阿超
发布2023-12-16 09:44:32
发布2023-12-16 09:44:32
7350
举报
文章被收录于专栏:快乐阿超快乐阿超

不存在十全十美的文章,如同不存在彻头彻尾的绝望。——村上春树

之前说了 单元测试添加运行参数的maven插件

难道对于非单元测试就只能手动写命令了吗?当然不是!我们只需要使用:

代码语言:javascript
复制
<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <executions>
        <execution>
            <goals>
                <goal>repackage</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
     <jvmArguments>
                    -Dfile.encoding=UTF-8
                    -Dsun.jnu.encoding=UTF-8
                    --add-opens=java.base/java.util=ALL-UNNAMED
                    --add-opens=java.base/java.lang=ALL-UNNAMED
                    --add-opens=java.base/java.lang.invoke=ALL-UNNAMED
                    --add-opens=java.base/java.lang.reflect=ALL-UNNAMED
                    --add-opens=java.base/sun.reflect.annotation=ALL-UNNAMED
                    --add-opens=java.base/sun.reflect.generics.visitor=ALL-UNNAMED
                    --add-opens=java.base/sun.reflect.generics.tree=ALL-UNNAMED
                    --add-opens=java.base/sun.reflect.generics.scope=ALL-UNNAMED
                    --add-opens=java.base/sun.reflect.generics.parser=ALL-UNNAMED
                    --add-opens=java.base/sun.reflect.generics.factory=ALL-UNNAMED
    </jvmArguments>
        <excludes>
            <exclude>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
            </exclude>
        </excludes>
    </configuration>
</plugin>

配置以后即可来到对应目录使用:

代码语言:javascript
复制
spring-boot:run -f pom.xml

如果有目录也可以:

代码语言:javascript
复制
mvn spring-boot:run -f yourpackage/pom.xml

即可在运行boot项目时自动添加上述参数

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2023-12-13,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档