首页 > 其他 > 详细

maven war多环境对应

时间:2015-09-16 18:16:21      阅读:275      评论:0      收藏:0      [点我收藏+]

<build>  

<plugin>

<groupId>com.juvenxu.portable-config-maven-plugin</groupId>

<artifactId>portable-config-maven-plugin</artifactId>

<version>1.1.4</version>

<executions>

<execution>

<goals>

<goal>replace-package</goal>

</goals>

</execution>

</executions>

<configuration>

<portableConfig>src/main/portable/${package.environment}.xml</portableConfig>

</configuration>

</plugin>

<build>

<profiles>

<profile>

<id>product</id>

<properties>

<package.environment>product</package.environment>

</properties>

</profile>

<profile>

<id>dev</id>

<properties>

<package.environment>dev</package.environment>

</properties>

<activation>

<activeByDefault>true</activeByDefault>

</activation>

</profile>

</profiles>


src/main/portable/dev.xml

<?xml version="1.0" encoding="utf-8" ?>

<portable-config>

    <config-file path="WEB-INF/classes/Application.properties">

        <replace key="connection.url">jdbc:mysql://localhost:3306/dbname?zeroDateTimeBehavior=convertToNull&amp;allowMultiQueries=true&amp;useUnicode=true&amp;characterEncoding=utf-8</replace>

        <replace key="connection.username">xxxxxx</replace>

        <replace key="connection.password">yyyyyy</replace>

    </config-file>

    <config-file path="WEB-INF/classes/spring-jms.xml">

        <replace xpath="/beans/bean[@id=‘jmsConnectionFactory‘]/property[@name=‘brokerURL‘]/@value">tcp://localhost:61616</replace>

        <replace xpath="/beans/bean[@id=‘jmsConnectionFactory‘]/property[@name=‘userName‘]/@value">xxxxxxx</replace>

        <replace xpath="/beans/bean[@id=‘jmsConnectionFactory‘]/property[@name=‘password‘]/@value">yyyyy</replace>

    </config-file>

</portable-config>




maven war多环境对应

原文:http://my.oschina.net/u/1453451/blog/506925

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!