2017-02-10 5 views
0

私は戦争を生成するプロジェクトと、このディレクトリこのディレクトリにはMavenプロジェクトの特定のファイルを戦争中の特定のディレクトリにパックするにはどうすればいいですか?

src/main/texts 

私は、ファイルの種類のOの多くを持って、例えば、* .TXT、* .cvsなど

を持っており、私はこれを行うために使用することができますどのようにMavenプラグイン

war/files/*.txt 

:私は例POF戦争の特定のディレクトリにこのディレクトリの唯一の* .txtファイルを、必要ですか? "src/main/texts"のすべての* .txtファイルをwarのディレクトリ "files"にパックします。

答えて

0

maven warプラグインの「外部Webリソースの追加とフィルタリング」を参照してください。

<configuration> 
     <webResources> 
     <resource> 
      <!-- this is relative to the pom.xml directory --> 
      <directory>TheFolderYouHavedecided<directory> 
     </resource> 
     </webResources> 
    </configuration> 

かを定義することです他の方法:ご使用の構成に次の

<plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-war-plugin</artifactId> 
     <version>3.0.0</version> 
     <configuration> 
      <webResources> 
      <resource> 

       <!-- this is relative to the pom.xml directory --> 
       <directory>src/main/texts</directory> 
       <!-- the default value is ** --> 
       <includes> 
        <include>**/*.txt</include> 
      </includes> 
      <targetPath>war/files</targetPath> 

      </resource> 

      </webResources> 
     </configuration> 
     </plugin> 
1

移動し、別のディレクトリにそれらのファイルをして追加します。here

サンプルプラグインの設定Mavenのドキュメントを参照してください あなたが好きなフォルダ:

<configuration> 
     <webResources> 
     <resource> 
      <!-- this is relative to the pom.xml directory --> 
      <directory>src/main/texts<directory> 
      <includes> 
      <include>**/*.txt</include> 
      </includes> 
      <targetPath>war/files</targetPath> 
     </resource> 
     </webResources> 
    </configuration> 

あなたのプロジェクトの構造と、どの部分を置くべきかを再考することをお勧めします。

http://maven.apache.org/plugins/maven-war-plugin/examples/adding-filtering-webresources.html

関連する問題