2017-05-09 7 views
0

私は、選択したプロファイルに基づいてさまざまなソース/リソースを取るプロジェクトがあります。いくつかのプロファイルが、私は日食の下にこれを行う場合、私は後者のみが実際に適用されていることに気づく例えば、以下のスニペットで定義されたプロファイルlocalwildfly複数のアクティブなプロファイルを持つ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> 

組み合わせ可能である必要があり、一部は組み合わせ可能である必要があり、相互に排他的である - I wildflyのプロファイルで定義されているソース/リソースのみが表示されます。

また、結果として得られる完全なPOM Iでは、後者(wildfly)プロファイルの設定だけが適用され、localプロファイルで定義されているソースとリソースが削除されています。

これはプラグインの動作方法ですか、何か不足していますか?

+0

ローカル実行とプロダクションの間にwildflyのソースコードの違いがありますか?これはプロパティなどで処理する必要がありますが、コードでは処理しないでください。 – khmarbaise

+0

@khmarbaise少しOTですが、fyi:そうではありません。そのためプロファイルを組み合わせる必要があります。 Wildflyは、ほとんどのアプリケーションサーバーと同じように独自の特徴を持っています(私の場合は、配信を遅らせるためにJMSメッセージを設定するプロパティ)。このコードは、さまざまなアプリケーションサーバーでこのような特殊性を処理するのに非常に特化していますが、他のすべてのコードは厳密に標準です。 –

+0

ベースプライプルに基づいて、私は特定のコードのために別々のMavenプロジェクトを作成し、そこに別のモジュールを持つ異なる戦争/耳を作ります。 – khmarbaise

答えて

0

いいえ....それは私だけでした。

実行を同じ名前で指定したため、上書きされました。私の悪い。

この質問は司会者によって閉鎖/削除される可能性があります。

関連する問題