maven不同环境打不同war包

来源:互联网 发布:java 无参数构造方法 编辑:程序博客网 时间:2024/06/05 21:13
<profiles>        <profile>            <id>local</id>            <properties>                <package.environment>local</package.environment>            </properties>            <activation>                <activeByDefault>true</activeByDefault>            </activation>        </profile>        <profile>            <id>product</id>            <properties>                <package.environment>product</package.environment>            </properties>        </profile>    </profiles>    <build>        <finalName>book</finalName>        <resources>            <resource>                <directory>src/main/resources</directory>                <filtering>true</filtering>                <excludes>                    <exclude>local/*</exclude>                    <exclude>product/*</exclude>                    <exclude>public/*</exclude>                </excludes>            </resource>        </resources>        <plugins>            <plugin>                <groupId>org.apache.maven.plugins</groupId>                <artifactId>maven-war-plugin</artifactId>                <version>2.1.1</version>                <configuration>                    <archive>                        <addMavenDescriptor>false</addMavenDescriptor>                    </archive>                    <warName>book</warName>                    <webResources>                        <resource>                            <directory>src/main/resources/${package.environment}</directory>                            <targetPath>WEB-INF/classes</targetPath>                            <filtering>true</filtering>                        </resource>
             </webResources>                </configuration>            </plugin>        </plugins>    </build>当打包的时候按上图方式执行,这样打包就是将原来下面的文件覆盖掉
0 0
原创粉丝点击