有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java如何在maven nexus存储库中存储二进制文件

我已经设置了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文件夹副本,而不是。类文件。我的要求是nexusjar应该包含。类文件,而不是实际文件。(.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。我需要添加任何额外的maven插件来实现这一点吗?如果有人知道怎么做,请告诉我


共 (0) 个答案