maven根据系统指定过滤文件

1.

	<profiles>
		<profile>
			<id>dev</id>
			<activation>
				<activeByDefault>false</activeByDefault>
				<os>
					<family>Windows</family>
				</os>
			</activation>
			<properties>
				<filter.path>src\main\filter\filter-dev.properties</filter.path>
			</properties>
		</profile>
		<profile>
			<id>production</id>
			<activation>
				<activeByDefault>false</activeByDefault>
				<os>
					<family>Linux</family>
				</os>
			</activation>
			<properties>
				<filter.path>${user.home}/antx.properties</filter.path>
			</properties>
		</profile>
	</profiles>

2.

	<build>
		<finalName>xxooname</finalName>
		<filters>
			<filter>${filter.path}</filter>
		</filters>
		<resources>
			<resource>
				<directory>src/main/resources</directory>
				<filtering>true</filtering>
			</resource>
		</resources>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-war-plugin</artifactId>
				<version>2.1.1</version>
				<configuration>
					<failOnMissingWebXml>true</failOnMissingWebXml>
					<webResources>
						<resource>
							<directory>src/main/webapp</directory>
							<includes>
								<include>**/*.xml</include>
								<include>**/*.properties</include>
							</includes>
							<filtering>true</filtering>
						</resource>
					</webResources>
					<webappDirectory>target/exposed/xxoojjyy.war</webappDirectory>
				</configuration>
			</plugin>
		</plugins>
	</build>

你可能感兴趣的:(maven根据系统指定过滤文件)