maven的profile设置

<build>
				<filters>
					<filter>profiles/km-prod/build.properties</filter>
				</filters>
				<resources>
					<resource>
						<directory>src/main/resources</directory>
						<filtering>true</filtering>
					</resource>
					<resource>
						<directory>profiles/km-prod/conf</directory>
						<filtering>true</filtering>
					</resource>
					<resource>
						<directory>profiles/km-prod/test</directory>
					</resource>
				</resources>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-war-plugin</artifactId>
						<version>2.4</version>
						<configuration>
							<webResources>
								<resource>
									<directory>${webXmlPath}</directory>
									<targetPath>WEB-INF</targetPath>
								</resource>
								<resource>
									<directory>profiles/km-prod/webapp/static</directory>
									<targetPath>static</targetPath>
								</resource>
								<resource>
									<directory>profiles/km-prod/webapp/resources</directory>
									<targetPath>resources</targetPath>
								</resource>
							</webResources>
							<warSourceExcludes>fedev/**</warSourceExcludes>
						</configuration>
					</plugin>
				</plugins>
			</build>



profile的配置文件如下所示:


classes的目录下面:



在static目录下面:



在resources/css/build下面



1、filtering为true的话,直接用build.properties里面的参数进行覆盖,
					<resource>
						<directory>profiles/km-prod/conf</directory>
						<filtering>true</filtering>
					</resource>



2、设置resource的,默认是覆盖在classes中下面的,不能跨越 classes 上面的目录
<resource>
						<directory>profiles/km-prod/test</directory>
					</resource>

3、如果要覆盖classes上面的目录,比如静态资源,web.xml等等。可以使用maven-war-plugin插件
<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-war-plugin</artifactId>
						<version>2.4</version>
						<configuration>
							<webResources>
								<resource>
									<directory>${webXmlPath}</directory>
									<targetPath>WEB-INF</targetPath>
								</resource>
								<resource>
									<directory>profiles/km-prod/webapp/static</directory>
									<targetPath>static</targetPath>
								</resource>
								<resource>
									<directory>profiles/km-prod/webapp/resources</directory>
									<targetPath>resources</targetPath>
								</resource>
							</webResources>
							<warSourceExcludes>fedev/**</warSourceExcludes>
						</configuration>
					</plugin>
				</plugins>








评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值