0
在我的项目中,我有几个文件可以打包成一个ZIP文件并将其上传到Nexus存储库。如何使用Maven将ZIP文件上传到Nexus并避免在Nexus中创建pom工件?
我实现了使用Maven Assembly插件两个动作:
的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>
现在,当我看着我的Nexus看到两个工件:
<dependency>
<groupId>com.ddd.tools</groupId>
<artifactId>mytool</artifactId>
<version>2.1.0</version>
<type>pom</type>
</dependency>
和
<dependency>
<groupId>com.ddd.tools</groupId>
<artifactId>mytool</artifactId>
<version>2.1.0</version>
<classifier>bin</classifier>
<type>zip</type>
</dependency>
我只是在后者的ZIP神器感兴趣,因为它是我上传的ZIP文件。
我如何从Nexus中摆脱第一个POM神器?或者有任何我可能需要它的场景?
首先,您的pom中的finalName配置对上传到Nexus没有用处。而且你不能阻止这个pom神器,因为它是必要的。是的,所有的时候,你都在使用这种依赖关系,pom工件被用来识别工件。你粘贴的片段只是作为依赖的用法,但他们需要用来分析这是什么样的工件以及它是否具有其他依赖关系(在这种情况下不需要)的pom工件。 – khmarbaise