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>
  • 相关阅读:
    再谈树形dp
    洛谷 P3627 [APIO2009]抢掠计划
    树状数组
    树形dp 入门
    洛谷P2014 选课
    洛谷P2015 二叉苹果树
    9 vue.js 被观察数组的变异方法
    8 vue的v-model指令学习
    7vue-事件修饰符
    6.vue事件绑定-click
  • 原文地址:https://www.cnblogs.com/montya/p/2874437.html
Copyright © 2011-2022 走看看