zoukankan      html  css  js  c++  java
  • maven 之 根据不同环境,选择不同的配置文件。

    没用maven前,本地开发用的是一套配置,然后 测试环境和生产环境 又是另一个套,为了方便,以前还特地写了shell去弄。

    自从用了maven后,这个问题就很好解决了

    pom.xml

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>com.toprays</groupId>
        <artifactId>dfadmin</artifactId>
        <version>1.0</version>
        <packaging>war</packaging>
        <name />
        <description />
        <dependencies>
                                *****
        </dependencies>
        <profiles>
            <profile>
                <id>dev</id>
                <properties>
                    <resPath>config</resPath>
                </properties>
            </profile>
            <profile>
                <id>pro</id>
                <properties>
                    <resPath>product</resPath>
                </properties>
                <activation>
                    <activeByDefault>true</activeByDefault>
                </activation>
            </profile>
        </profiles>
        <build>
            <finalName>dfadmin</finalName>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId> 
                    <artifactId>maven-war-plugin</artifactId>
                    <version>2.1.1</version>
                    <configuration>
                        <webappDirectory>${basedir}/webapps</webappDirectory>
                        <warSourceDirectory>${basedir}/webapps</warSourceDirectory>
                         <webResources>  
                            <resource>  
                              <directory>${resPath}</directory>  
                              <targetPath>WEB-INF/classes</targetPath>
                              <filtering>true</filtering>
                            </resource>
                          </webResources>  
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>1.5</source>
                        <target>1.5</target>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </project>
  • 相关阅读:
    自我介绍 Self Introduction
    HDU1864 最大报销额
    HDU2955 Robberies
    Sicily 1509. Rails
    Sicily 1031. Campus
    Sicily 1090. Highways
    Sicily 1034. Forest
    Sicily 1800. Sequence
    Sicily 1150. 简单魔板
    CodeVS4919 线段树练习4
  • 原文地址:https://www.cnblogs.com/montya/p/2874437.html
Copyright © 2011-2022 走看看