maven war多环境对应

<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多环境对应)