2011-12-19 11 views
1

我々は、リリースまでをパックするのmavenを使用し、インストールフォルダを持っている、
このインストールフォルダには、いくつかの静的ファイルを持っている、とのpom.xml
ビルド目標はコピーすることです静的ファイルをターゲットインストールフォルダにコピーし、リポジトリからいくつかのZIPファイル(
)を展開して展開し、/ unzippedの下のターゲットフォルダに配置します。Mavenの - モジュールおよびというモジュールVS依存性やdependencySets

インストールフォルダ:

/installation_folder 
pom.xml 
    /some_files 
      /file1 
      /file2 

ターゲットフォルダのような次のようになります。この「インストールPOM」で

/target 
    /installation_files 
     /some_files 
      /file1 
      /file2 
     /unzipped 
      /prj1 - unzipped artifact prj1 from the repository 
      /prj2 - unzipped artifact prj2 from the repository 

- 私は、アセンブリXMLへの参照を持っています。静的ファイルをコピーして、リポジトリからアーティファクトを取得することができます。
質問は、リポジトリからzipをコピーし、ターゲット/解凍されたフォルダに展開します。
モジュールとmoduleSetまたは依存関係とdependencySetsを使用する必要がありますか? project.group installation_project ポンポン

<modules> 
    <module>prj1</module>   
    <module>prj2</module>  
</modules> 

...

とassembly.xml:

<moduleSets> 
    <moduleSet> 
     <includes> 
      <include>*:*</include> 
     </includes> 
      <binaries> 
      <unpack>true</unpack> 
      </binaries> 
     </binaries> 
    </moduleSet> 


はのpom.xml + assembly.xmlは次のようになります。
これは次のようになります。

<project> 
<groupId>project.group</groupId> 
<artifactId>installation_project</artifactId> 
<packaging>pom</packaging> 

    <dependencies> 

     <dependency> 
      <artifactId>prj1</artifactId> 
      <groupId>gruop_id</groupId> 
      <version>1.0-SNAPSHOT</version> 
      <type>zip</type> 
     </dependency> 
     <dependency> 
      <artifactId>prj2</artifactId> 
      <groupId>gruop_id</groupId> 
      <version>2.0</version> 
      <type>zip</type> 
     </dependency> 
    </dependencies> 

...

とassembly.xml:

<dependencySets> 
    <dependencySet> 
     <outputDirectory>installation_files/unzipped/</outputDirectory> 
     <outputFileNameMapping>${artifact.artifactId}</outputFileNameMapping> 
     <includes> 
      <include>*:*:zip</include> 
     </includes> 
     <unpack>true</unpack> 
    </dependencySet> 
</dependencySets> 

ありがとうございました!

答えて

1

もう一つの方法は、goal = unpackを使って依存関係プラグインを作成することです。

<plugin> 
    <artifactId>maven-dependency-plugin</artifactId> 
    <executions> 
    <execution> 
     <id>unpack</id> 
     <phase>generate-resources</phase> 
     <goals> 
      <goal>unpack</goal> 
     </goals> 
     <configuration> 
     <artifactItems> 
      <artifactItem> 
       <groupId></groupId> 
       <artifactId></artifactId> 
       <version></version> 
       <type></type> 
       <overWrite></overWrite> 
       <outputDirectory></outputDirectory> 
      </artifactItem> 
     </artifactItems> 
     </configuration> 
    </execution> 
    </executions> 
</plugin> 

もう一つの方法は、アセンブリのプラグインを使用することですが、私は非常に面倒では通常、簡単解凍/ビュンよりも複雑なアセンブリを作成するために意図されていることがわかります。

関連する問題