2016-05-23 8 views
1

次のエラーが発生します。 install_pathが設定されていないのでしょうか?その場合は、プロファイルを使用するときに、デフォルトのプラグインが実行されていないことを意味しますか(install_path)?Mavenで子プロファイルを使用しているときに親のデフォルトプラグインが実行されていますか?

実行

mvn clean install site -Pfull

エラー:mavenのクリーン・プラグイン:2.5:クリーン

ゴール org.apache.maven.pluginsの実行に失敗しました(クリーン展開フォルダー)bo-full: ファイルセットのヌル(包含:[]、除外:[])のベースディレクトリーがありません。

<project> 
    <plugins> 
     <plugin> 
      <!-- Workaround maven not being able to set a property conditionally based on environment variable --> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-antrun-plugin</artifactId> 
      <version>1.8</version> 
      <executions> 
       <execution> 
        <phase>validate</phase> 
        <goals> 
         <goal>run</goal> 
        </goals> 
        <configuration> 
         <exportAntProperties>true</exportAntProperties> 
         <target> 
          <property environment="env"/> 
          <condition property="install.path" value="${env.SERVER_HOME}" else="C:\MY_SERVER"> 
           <isset property="env.SERVER_HOME" /> 
          </condition> 
          <echo message="${install.path}"/> 
         </target> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 
... 

子供:プロファイルを使用する場合

<project> 
    <profiles> 
     <profile> 
      <id>full</id> 
      <build> 
       <plugins> 
        <plugin> 
         <artifactId>maven-clean-plugin</artifactId> 
         <executions> 
          <execution> 
           <id>clean-deploy-folder</id> 
           <phase>pre-site</phase> 
           <goals> 
            <goal>clean</goal> 
           </goals> 
           <configuration> 
            <excludeDefaultDirectories>true</excludeDefaultDirectories> 
            <filesets> 
             <fileset> 
              <directory>${install.path}</directory> 
             </fileset> 
            </filesets> 
           </configuration> 
          </execution> 
         </executions> 
        </plugin> 
... 

答えて

0

1)デフォルトのプラグインがあっても実行されなければなりません。ビルドログをたどることでこれが起こっていることを確認してください。プラグインの実行はすべて、プラグイン自体が何もログに記録しなくても、mavenによって記録されます。

2)クリーンアップの実行は、プロパティを作成する実行と同じMavenプロジェクト/モジュールで行う必要があります。その理由の1つは、子モジュールを個別に構築できることです(利用可能であれば、ローカル/リモートリポジトリからの親pom.xmlを使用します)。何らかの理由で不動産が原子炉建屋内で適切に伝播されない可能性もあります。

3)問題が実際にプロパティの伝播とantrunプラグインに問題がある場合は、antrunの実行をMavenプロファイルに置き換えることができます。それは次のようになります:

<properties> 
    <!-- default value goes here: --> 
    <install.path>C:\MY_SERVER</install.path> 
</properties> 

<profiles> 
    <profile> 
    <id>env</id> 
    <activation> 
     <property> 
     <!-- activate this profile when property is specified: --> 
     <name>env.SERVER_HOME</name> 
     </property> 
    </activation> 
    <properties> 
     <!-- override default property value: --> 
     <install.path>${env.SERVER_HOME}</install.path> 
    </properties> 
    </profile> 
</profiles> 
関連する問題