In meinem Projekt habe ich einige Dateien, die ich in eine ZIP-Datei packe und sie auf ein Nexus-Repository hochlade.Wie ZIP-Datei mit Maven auf Nexus hochladen und Pom Artefakt in Nexus erstellen?
implementiert ich beide Aktionen Maven Montage Plugin:
pom.xml
<groupId>com.ddd.tools</groupId>
<artifactId>mytool</artifactId>
<version>2.1.0</version>
<packaging>pom</packaging>
<name>Tool</name>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<!-- File bin.xml saves information about which files are to be included to the ZIP archive. -->
<descriptor>bin.xml</descriptor>
<finalName>${pom.artifactId}-${pom.version}</finalName>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
BIN.XML
<assembly ...>
<id>bin</id>
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>src/release</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>Tool.exe</include>
</includes>
</fileSet>
</fileSets>
</assembly>
Nun, wenn ich in Nexus sehe ich zwei Artefakte sehen:
<dependency>
<groupId>com.ddd.tools</groupId>
<artifactId>mytool</artifactId>
<version>2.1.0</version>
<type>pom</type>
</dependency>
und
<dependency>
<groupId>com.ddd.tools</groupId>
<artifactId>mytool</artifactId>
<version>2.1.0</version>
<classifier>bin</classifier>
<type>zip</type>
</dependency>
Ich bin nur in der letzten ZIP Artefakt interessiert, weil es die ZIP-Datei, die ich hochgeladen.
Wie kann ich das erste POM-Artefakt von Nexus loswerden? Oder gibt es ein Szenario, wo ich es brauchen könnte?
Zunächst ist die finalName-Konfiguration in Ihrem Pom für den Upload in Nexus nutzlos. Und du kannst das Pom-Artefakt nicht verhindern, weil es notwendig ist. Und ja, immer wenn Sie diese Art von Abhängigkeit verwenden, wird das Pom-Artefakt zur Identifizierung des Artefakts verwendet. Sie eingefügt Snippets sind nur für die Verwendung als Abhängigkeit, aber sie brauchen das Pom-Artefakt, das benötigt wird, um zu analysieren, welche Art von Artefakt das ist und ob es andere Abhängigkeiten hat .. (nicht in diesem Fall). – khmarbaise