---
title: "maven 之web项目的profile"
author: "85977328"
date: "2014-01-21T18:21:46Z"
tags: []
categories: ["企业架构"]
slug: "maven-web-profile"
draft: false
lastmod: "2014-01-21T18:21:46Z"
id: 2007851
url: "https://phl.iteye.com/blog/2007851"
---

有时候maven管理war项目，需要根据不同的环境，使用不同的配置文件。 pom.xml文件如下 \[code="xml"] 4.0.0 com.chinaso test war 1.0.0 http://maven.apache.org UTF-8 commons-dbcp commons-dbcp 1.4 commons-pool commons-pool 1.5.7 test maven-compiler-plugin 1.6 1.6 UTF-8 org.apache.maven.plugins maven-war-plugin false ${app\_config\_path} false WEB-INF/conf dev src/main/conf/dev true test src/main/conf/test online src/main/conf/online \[/code] 打包命令 mvn clean package -Dmaven.test.skip=true -Pdev 输出日志 \[INFO] --- maven-war-plugin:2.1.1:war (default-war) @ test --- \[INFO] Packaging webapp \[INFO] Assembling webapp \[test] in \[E:\\x\\test\\target\\y] \[INFO] Processing war project \[INFO] Copying webapp webResources \[E:\\E:\\x\\test\\target\\ysrc/main/conf/dev] to \[E:\\x\\test\\target\\y] \[INFO] Copying webapp resources \[E:\\x\\test\\target\\y\\src\\main\\webapp] \[INFO] Webapp assembled in \[4776 msecs] \[INFO] Building war: E:\\x\\test\\target\\vertical-search.war \[WARNING] Warning: selected war files include a WEB-INF/web.xml which will be ignored (webxml attribute is missing from war task, or ignoreWebxml attribute is specified as 'true') 参考文章 http://lishuaibt.iteye.com/blog/614783