2017-05-09 6 views
0

선택한 프로필에 따라 다양한 소스/리소스를 사용할 수있는 프로젝트가 있습니다. 일부 프로파일은 내가 이클립스에서 이렇게하면 나는 후자 만이 실제로 적용되는 것을 알 수 예를 들어, 아래buid-helper-plugin (복수 활성 프로필 포함)

<profiles> 
    <profile> 
     <id>local</id> 
     <build> 
      <pluginManagement> 
       <plugins> 
        <plugin> 
         <groupId>org.codehaus.mojo</groupId> 
         <artifactId>build-helper-maven-plugin</artifactId> 
         <inherited>true</inherited> 
         <executions> 
          <execution> 
           <id>add-sources</id> 
           <phase>generate-sources</phase> 
           <goals> 
            <goal>add-source</goal> 
           </goals> 
           <configuration> 
            <sources> 
             <source>profiles/local/src/main/java</source> 
            </sources> 
           </configuration> 
          </execution> 
          <execution> 
           <phase>generate-resources</phase> 
           <goals> 
            <goal>add-resource</goal> 
           </goals> 
           <configuration> 
            <resources> 
             <resource> 
              <directory>profiles/local/src/main/resources</directory> 
              <filtering>true</filtering> 
             </resource> 
            </resources> 
           </configuration> 
          </execution> 
         </executions> 
        </plugin> 
       </plugins> 
      </pluginManagement> 
     </build> 
    </profile> 

    <profile> 
     <id>wildfly</id> 
     <build> 
      <pluginManagement> 
       <plugins> 
        <plugin> 
         <groupId>org.codehaus.mojo</groupId> 
         <artifactId>build-helper-maven-plugin</artifactId> 
         <inherited>true</inherited> 
         <executions> 
          <execution> 
           <id>add-sources</id> 
           <phase>generate-sources</phase> 
           <goals> 
            <goal>add-source</goal> 
           </goals> 
           <configuration> 
            <sources> 
             <source>profiles/wildfly/src/main/java</source> 
            </sources> 
           </configuration> 
          </execution> 
          <execution> 
           <phase>generate-resources</phase> 
           <goals> 
            <goal>add-resource</goal> 
           </goals> 
           <configuration> 
            <resources> 
             <resource> 
              <directory>profiles/wildfly/src/main/resources</directory> 
              <filtering>true</filtering> 
             </resource> 
            </resources> 
           </configuration> 
          </execution> 
         </executions> 
        </plugin> 
       </plugins> 
      </pluginManagement> 
     </build> 
    </profile> 
</profiles> 

결합해야 니펫에 정의 된 프로파일 localwildfly 일부가 결합해야한다, 상호 배타적 - 나는 wildfly 프로필에 정의 된 소스/리소스 만 참조하십시오.

결과로 나온 완전한 POM에서는 후자 (wildfly) 프로필 구성 만 적용되므로 local 프로필에 정의 된 소스와 리소스가 제거됩니다.

플러그인이 작동하는 방식입니까, 아니면 뭔가 빠졌습니까?

+0

로컬 실행과 프로덕션간에 wildfly에 대한 소스 코드 차이점이 있습니까? 이 코드는 속성 등으로 처리해야하지만 코드에서는 처리하지 말아야합니다. – khmarbaise

+0

@khmarbaise 약간의 OT이지만, fyi : 아니요, 그 이유 때문에 프로파일을 결합 할 필요가 있습니다. Wildfly는 대부분의 응용 프로그램 서버와 마찬가지로 고유 한 단서를 가지고 있습니다 (필자의 경우 JMS 메시지를 전달하기 위해 설정하는 속성). 이 코드는 다른 응용 프로그램 서버에서 이러한 특수성을 처리하는 데 매우 특화된 반면 다른 모든 코드는 엄격하게 표준입니다. –

+0

기본 priciple에 따라 특정 코드에 대해 별도의 메이븐 프로젝트를 만들고 거기에 다른 모듈로 다른 전쟁/귀를 생성합니다. – khmarbaise

답변

0

좋아요. 나는 단지 저였습니다.

실행을 동일한 이름으로 지정 했으므로 무시되었습니다. 내 잘못이야.

이 질문은 운영자가/삭제할 수 있습니다.