2011-12-05 3 views
6

일부 가변 속성 값을 갖고 Maven 프로필을 사용하여 올바른 결과를 얻으려고합니다. 내 최대 절전 모드 xml, log4j.properties 및 didnt에 대해이 작업을 수행했습니다.maven 변수 속성 필터링

그래서 # 1 프로젝트에서/src/main/resources 아래에 여러 파일이 있습니다.

<properties> 
    <log.level>DEBUG</log.level> 
</properties> 


<profiles> 
    <profile> 
     <id>production</id> 
     <properties> 
    <log.level>INFO</log.level> 
     </properties> 
    </profile> 
</profiles> 

<build> 
    <resources> 
     <resource> 
      <directory>src/main/resources</directory> 
      <filtering>true</filtering> 
     </resource> 
    </resources> 
</build> 

문제없이 작동 위 : 그리고 다음과 같이 받는다는에 필터링 특성과 자원을 설정합니다. 그러나, 내 프로젝트 # 2 - 나는/src/main/webapp/WEB-INF 아래에있는 변수 속성을 가진 파일을 가지고있다. 위와 똑같은 일을한다. 단, WEB- INF이고 작동하지 않습니다./src/main/resources 아래에있는 파일에 대해 프로젝트 # 2를 시도했지만 제대로 작동했습니다.

그래서 리소스 필터링에는 파일이/src/main/webapp/WEB-INF에있을 때 문제가 있지만 전쟁이 생성 될 때 WEB-INF 폴더로 이동하도록 파일이 있어야합니다.

아무에게도이 작업을 수행하는 방법에 대한 포인터가 있습니까? 여기

<properties> 
     <wsdl.url>http://stage/wsdl-url</wsdl.url> 
</properties> 

<profiles> 
    <profile> 
     <id>production</id> 
     <properties> 
    <wsdl.url>http://prod/wsdl-url</wsdl.url> 
     </properties> 
    </profile> 
</profiles> 

<build> 
    <resources> 
     <resource> 
      <directory>src/main/webapp/WEB-INF</directory> 
      <filtering>true</filtering> 
     </resource> 
    </resources> 
</build> 

답변

5

나는 또한이 문제를 가지고 있었다 (자원 필터링을 완전히 무시됩니다) 작업을 나던 pom.xml 파일에서 다음 snipet이다; - 내가 필요로 그냥 뭐

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-war-plugin</artifactId> 
    <configuration> 
     <filters> 
      <filter>filter.properties</filter> 
     </filters> 
     <webResources> 
      <resource> 
       <directory>WebContent/WEB-INF</directory> 
       <filtering>true</filtering> 
       <targetPath>WEB-INF</targetPath> 
      </resource> 
     </webResources> 
    </configuration> 
</plugin> 
+0

감사 : 나는 POM의 주요 <resources> 섹션은 전쟁 플러그인에 의해 무시되고 의심, 따라서 내가 직접 플러그인을 구성과 함께 왔어요 –