我已经设置了Maven Nexus存储库并配置我的项目pom以将工件发送到nexus存储库。为此,我使用了Build Helper Maven Plugin我的pom看起来像这样。
的pom.xml
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.9.1</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${xtendGenDirectory}</source>
<source>src</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-resource</id>
<phase>generate-resources</phase>
<goals>
<goal>add-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>src</directory>
<targetPath>${project.build.directory}/classes</targetPath>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>add-test-resource</id>
<phase>generate-test-resources</phase>
<goals>
<goal>add-test-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>test-output</directory>
<targetPath>${project.build.directory}/test-classes</targetPath>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.4.2</version>
<configuration>
<scmCommentPrefix>TASK-7:</scmCommentPrefix>
<tagNameFormat>releases/v@{project.version}</tagNameFormat>
<pushChanges>false</pushChanges>
<localCheckout>true</localCheckout>
</configuration>
</plugin>
问题是在nexus .jar 工件中它包含我的src文件夹的副本与实际文件而不是 .class 文件。我的要求是nexus jar应该包含 .class 文件而不是实际文件。(。java)。
我已经看到这可以通过执行以下命令来完成。
mvn deploy:deploy-file -DgroupId=org.apache -DartifactId=activemq-distro -Dversion=5.5.1 -Dfile=apache-activemq-5.5.1-bin.tar.gz -DrepositoryId=unapproved-snapshots -Durl=https://xxx
-Dpackaging=tgz
但是我想配置pom来实现每次构建成功,而不是按照上面提到的方式。如何配置pom文件将二进制文件发送到nexus.Do我需要添加任何额外的maven插件来做到这一点?如果有人知道如何做到这一点请告诉我。