copy-dependencies ゴールを使用して、現在のアーティファクトの依存関係をコピーします。ただし、スコープが「提供」されている依存関係はコピーされません。修正方法は?
xml 構成は標準です。
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>install</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>lib</outputDirectory>
<overWriteReleases>true</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
<excludeArtifactIds>project-services</excludeArtifactIds>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<finalName>project-web</finalName>
</build>
なぜ私はこれをしたいのですか?ant ビルドと maven ビルドの両方をサポートする必要があるためです。したがって、 mvn install -oを実行して、すべての依存関係を別のディレクトリにコピーしたいと思います。Ant build.xml に、そのディレクトリへのパスをクラスパスとして含めます。その後、Ant は ear ファイルを構築し、システムの tools.jar やその他の「提供された」jar を含まない lib ディレクトリ全体を含めます。Apache Maven のバージョンは 3.0.3 です