2016-04-01 1 views
-1

ファイル内のすべてのファイルを比較してファイルの内容を変更し、ファイルを別のフォルダにコピーすると、あるフォルダから別のフォルダにすべてのファイルをコピーする方法そうでなければプロジェクトの場所。すべてのファイルをフォルダ内のファイルを比較することでコピーする

どのプラグインを試してみるべきですか?

私はmaven-antrun-plugin(バージョン1.7)を使用しようとしていますが、まだ成功していません。

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-antrun-plugin</artifactId> 
     <executions> 
     <execution> 
      <phase>initialize</phase> 
       <configuration> 
        <target name="main"> 
         <ant antfile="/build.xml" target="main" /> 
        </target> 
       </configuration> 
        <goals> 
         <goal>run</goal> 
        </goals> 
     </execution> 
     </executions> 
    <dependency> 
     <groupId>ant-contrib</groupId> 
     <artifactId>ant-contrib</artifactId> 
    <version>1.0b3</version> 
</dependency> 

</plugin> 
+0

を使用して行うことができました。 'Apache Maven AntRun Plugin'はあなたの目的に合致しません。 Read reference document:**このプラグインは、MavenからAntタスクを実行する機能を提供します。 AntスクリプトをPOMに埋め込むこともできます!** https://maven.apache.org/plugins/maven-antrun-plugin/ –

+0

別のプラグインを使用することをお勧めしますか? – eagerToLearn

+0

なぜ2つのプロジェクトを同時に作業するのか分かりません。一般的な言い回し、**ビルドツール**は一度に**一つのプロジェクト**で動作します。 –

答えて

0

私はあなたが基本的な間違いを持っ​​ているのmaven-antrun - プラグインに

<plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-antrun-plugin</artifactId> 
       <executions> 
        <execution> 
         <phase>initialize</phase> 
         <configuration> 
          <target name="build"> 
           <ant antfile="build.xml" 
            target="build" /> 
          </target> 
         </configuration> 
         <goals> 
          <goal>run</goal> 
         </goals> 
        </execution> 
       </executions> 
       <dependencies> 
      <dependency> 
      <groupId>ant-contrib</groupId> 
      <artifactId>ant-contrib</artifactId> 
      <version>1.0b3</version> 
      <exclusions> 
       <exclusion> 
       <artifactId>ant</artifactId> 
       <groupId>ant</groupId> 
       </exclusion> 
      </exclusions> 
      </dependency> 
     </dependencies> 
      </plugin> 

のbuild.xml

<?xml version="1.0" encoding="UTF-8"?> 
<project name="prospector" basedir="/" default="main"> 
<target name="main" depends="etc"/> 

<target name="etc"> 

     <for param="file"> 
      <path> 
       <fileset 
        dir="etc" 
        includes="**/**" /> 
      </path> 
      <sequential> 
       <var name="name" unset="true" /> 
       <basename file="@{file}" property="name" /> 
       <if> 
        <filesmatch file1="@{file}" file2="etc/${name}" /> 
        <then> 
         <echo message="There is no change in ${name}" /> 
        </then> 
        <else> 
         <echo message="There are some changes in ${name}" /> 
         <copy 
          file="@{file}" 
          tofile="etc/${name}" overwrite="true"/> 
        </else> 
       </if> 


      </sequential> 
     </for> 
    </target> 
関連する問題