<profiles>
<profile>
<id>localid>
<activation>
<activeByDefault>trueactiveByDefault>
activation>
<build>
<filters>
<filter>src/main/resources/local/deploy.propertiesfilter>
filters>
<resources>
<resource>
<directory>src/main/resources/common/directory>
<filtering>truefiltering>
resource>
<resource>
<directory>src/main/resources/local/directory>
<filtering>truefiltering>
resource>
resources>
build>
profile>
<profile>
<id>testid>
<activation>
<activeByDefault>falseactiveByDefault>
activation>
<build>
<filters>
<filter>src/main/resources/test/deploy.propertiesfilter>
filters>
<resources>
<resource>
<directory>src/main/resources/common/directory>
<filtering>truefiltering>
resource>
<resource>
<directory>src/main/resources/test/directory>
<filtering>truefiltering>
resource>
resources>
build>
profile>
profiles>
<build>
<resources>
<resource>
<directory>src/main/resources/directory>
<filtering>truefiltering>
<includes>
<include>deploy/*include>
includes>
<targetPath>${project.build.directory}targetPath>
resource>
resources>
<plugins>
<plugin>
<groupId>org.apache.maven.pluginsgroupId>
<artifactId>maven-compiler-pluginartifactId>
plugin>
plugins>
build>
deploy文件夹下 这些文件中的${key}会被替换掉为真正的值
#!/bin/bash
base="${deploy.base}"
name="${project.name}"
java_home="${deploy.java.home}"
bin_home="${deploy.bin.home}"
conf_home="${deploy.conf.home}/resin"
deploy="${deploy.base}"
webapp="${deploy}/${project.name}"
servers=(${deploy.。。.server})
resin="${deploy.resin.home}"
而${deploy.base} ..这些是在deploy.properites中定义
详解
我们分析下
在dispather-servlet下
<context:component-scanbase-package="com.。。。.webapp"/>
<beanclass="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<propertyname="locations">
<list>
<value>classpath:dubbo.propertiesvalue>
list>
property>
bean>
只有简单配置这些,在使用maven命令的时候 mvn clean package -PprofileId ,就可以根据不同环境打不同的包了