SpringBoot 不同的环境,打不同的包名

同一台服务器上装了开发、测试环境。如果放在不同的目录下,文件名相同,在使用Java Sprintboot jar 项目启动、停止脚本 脚本时,会对启动、停止操作有影响

默认为:${artifactId}-${version}
pom.xml

 <!--与build标签同级别,放在project标签中-->
    <profiles>
        <profile>
            <id>dev</id>
            <properties>
                <activeProfile>dev</activeProfile>
            </properties>
            <build>
                <finalName>${artifactId}-${activeProfile}-${version}</finalName>
            </build>
            <!-- 默认环境 -->
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
        </profile>
        <profile>
            <id>pre</id>
            <properties>
                <activeProfile>pre</activeProfile>
            </properties>
            <build>
                <finalName>${artifactId}-${activeProfile}-${version}</finalName>
            </build>
        </profile>
        <profile>
            <id>pro</id>
            <properties>
                <activeProfile>pro</activeProfile>
            </properties>
            <build>
                <finalName>${artifactId}-${activeProfile}-${version}</finalName>
            </build>
        </profile>
    </profiles>
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId> 
            </plugin>
        </plugins>
    </build>
spring:
  profiles:
    active: @activeProfile@

image

posted @   VipSoft  阅读(32)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 本地部署 DeepSeek:小白也能轻松搞定!
· 基于DeepSeek R1 满血版大模型的个人知识库,回答都源自对你专属文件的深度学习。
· 如何给本地部署的DeepSeek投喂数据,让他更懂你
· 在缓慢中沉淀,在挑战中重生!2024个人总结!
· 大人,时代变了! 赶快把自有业务的本地AI“模型”训练起来!
历史上的今天:
2023-11-29 Excel 条件格式
2022-11-29 Kubernetes(K8S) Service 介绍
点击右上角即可分享
微信分享提示