您的位置:首页 > 运维架构

maven 定义profile.properties

2015-12-17 16:30 369 查看
生产项目部署,需要把war包中的properties 放到指定路径中,maven 可以指定profile.properties 路径<profiles>

<profile>

<id>local</id>

<activation>

<activeByDefault>true</activeByDefault>

</activation>

<properties>

<profile.properties>properties</profile.properties>

<profile.product>false</profile.product>

</properties>

</profile>

<profile>

<id>product</id>

<properties>

<profile.properties>profiles/${project.artifactId}/properties</profile.properties>

<profile.product>true</profile.product>

</properties>

</profile>

</profiles>

<build>

<finalName>${project.artifactId}</finalName>

<resources>

<resource>

<directory>src/main/resources</directory>

<filtering>true</filtering>

</resource>

</resources>

<plugins>

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-archetype-plugin</artifactId>

<version>2.3</version>

</plugin>

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-compiler-plugin</artifactId>

<version>2.3.2</version>

<configuration>

<source>1.7</source>

<target>1.7</target>

<encoding>UTF-8</encoding>

</configuration>

</plugin>

</plugins>

</build>

创建配置文件所在的文件夹/tomcat/profiles/scout-server/properties

打开 tomcat安装目录\bin\setenv.sh,增加 CLASSPATH=/tomcat/:$CLASSPATH:

jenkins 打包输入命令 -Pproduct 即可指定生产环境的路径
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: