maven-dependency プラグインを使用して zip ファイルを解凍できますが、現在、その zip ファイル内に他の zip ファイルが含まれているという問題があり、それらも解凍する必要があります。これどうやってするの?
35152 次
4 に答える
43
Ant タスク ランナー プラグインを使用して、任意のファイルを解凍できます。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>prepare</id>
<phase>validate</phase>
<configuration>
<tasks>
<echo message="prepare phase" />
<unzip src="zips/archive.zip" dest="output/" />
<unzip src="output/inner.zip" dest="output/" />
<unzip dest="output">
<fileset dir="archives">
<include name="prefix*.zip" />
</fileset>
</unzip>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
于 2010-07-16T11:06:13.037 に答える
24
ANT の使用はもはやクールではありません ;)
http://maven.apache.org/plugins/maven-dependency-plugin/examples/unpacking-artifacts.html
zip (archive.zip) ファイルを解凍するためのサンプル コード:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<phase>process-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>foo</groupId>
<artifactId>archive</artifactId>
<version>1.0-SNAPSHOT</version>
<type>zip</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
最初に、ファイル archive.zip を maven リポジトリーにインストールする必要があります。たとえば、タスクアーティファクトのアタッチ
org.codehaus.mojo:build-helper-maven-plugin:build-helper:attach-artifact
于 2011-10-04T12:55:41.757 に答える
4
プラグインの依存関係を使用することもできます。依存関係をアンパックするという目標があります ( http://maven.apache.org/plugins/maven-dependency-plugin/unpack-dependencies-mojo.htmlを参照) 。
于 2011-03-01T14:57:31.420 に答える