0
Kopie eines Jars aus dem Repository in ein Modulverzeichnis
F�r das Schn�ren eines Software-Paketes ben�tigte ich ein JAR aus meinem Artifactory. Diese Dependency sollte lediglich in ein entsprechendes Output-Directory kopiert werden. Das Maven Dependency-Plugin hat die Aufgabe l�sen k�nnen. Der folgende Pom-Auschnitt kopiert ein Jar (siehe artifactItem) in das konfigurierte OutputDirecory.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | < build > �� �< plugins > �� ��� �< plugin > �� ��� ��� �< groupId >org.apache.maven.plugins</ groupId > �� ��� ��� �< artifactId >maven-dependency-plugin</ artifactId > �� ��� ��� �< version >2.4</ version > �� ��� ��� �< executions > �� ��� ��� ��� �< execution > �� ��� ��� ��� ��� �< id >copy</ id > �� ��� ��� ��� ��� �< phase >package</ phase > �� ��� ��� ��� ��� �< goals > �� ��� ��� ��� ��� ��� �< goal >copy</ goal > �� ��� ��� ��� ��� �</ goals > �� ��� ��� ��� ��� �< configuration > �� ��� ��� ��� ��� ��� �< artifactItems > �� ��� ��� ��� ��� ��� ��� �< artifactItem > �� ��� ��� ��� ��� ��� ��� ��� �< groupId >de.analysisfreaks</ groupId > �� ��� ��� ��� ��� ��� ��� ��� �< artifactId >modulename</ artifactId > �� ��� ��� ��� ��� ��� ��� ��� �< version >1.0.0-SNAPSHOT</ version > �� ��� ��� ��� ��� ��� ��� ��� �< classifier >jar-with-dependencies</ classifier > �� ��� ��� ��� ��� ��� ��� ��� �< overWrite >true</ overWrite > �� ��� ��� ��� ��� ��� ��� ��� �< outputDirectory >${project.build.directory}</ outputDirectory > �� ��� ��� ��� ��� ��� ��� �</ artifactItem >�� ��� ��� ��� ��� ��� ��� ��� � �� ��� ��� ��� ��� ��� �</ artifactItems > �� ��� ��� ��� ��� ��� �< overWriteReleases >false</ overWriteReleases > �� ��� ��� ��� ��� ��� �< overWriteSnapshots >true</ overWriteSnapshots > �� ��� ��� ��� ��� �</ configuration > �� ��� ��� ��� �</ execution > �� ��� ��� �</ executions > �� ��� �</ plugin > �� �</ plugins > </ build > |
Beispiele aus der Plugin-Doku: http://maven.apache.org/plugins/maven-dependency-plugin/examples/copying-artifacts.html