将jar添加到artifatory后,maven构建失败.m2 / repository不包含jar文件

时间:2014-08-25 20:20:38

标签: java maven grails intellij-idea artifactory

我尝试将jasperreports.jar文件添加到libs-release-local:net / sf / jasperreports / jasperreports / 5.0.1 / jasperreports-5.0.1.jar下的工件中,部署成功。

pom.xml依赖

<dependency>
  <groupId>jasperreports-htmlcomponent</groupId>
  <artifactId>jasperreports-htmlcomponent</artifactId>
            <version>5.0.1</version>
        </dependency>

        <dependency>
            <groupId>net.sf.jasperreports</groupId>
            <artifactId>jasperreports</artifactId>
            <!--version>5.1.0</version-->
            <version>5.0.1</version>
            <exclusions>
                <exclusion>
                    <groupId>xml-apis</groupId>
                    <artifactId>xml-apis</artifactId>
                </exclusion>
                <exclusion>
                    <artifactId>commons-collections</artifactId>
                    <groupId>commons-collections</groupId>
                </exclusion>
            </exclusions>
        </dependency>

但是当我尝试从Intellij运行应用程序时,我得到了依赖的错误路径 这两个jar文件都存在于artifactory中,但未被识别。

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.864 s
[INFO] Finished at: 2014-08-25T15:51:47-05:00
[INFO] Final Memory: 16M/243M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.grails:grails-maven-plugin:2.3.4:run-app (default-cli) on project MPF-SalesQuote: Failed to create classpath for Grails execution. Could not transfer artifact com.lowagie:itext:jar:2.1.7.js1 from/to metasystems-snapshots (http://javaguru.metasystems.com:8081/artifactory/metasystems-snapshot): Failed to transfer file: http://javaguru.metasystems.com:8081/artifactory/metasystems-snapshot/com/lowagie/itext/2.1.7.js1/itext-2.1.7.js1.jar. Return code is: 409, ReasonPhrase: The repository 'metasystems-snapshot' rejected the artifact 'metasystems-snapshot:com/lowagie/itext/2.1.7.js1/itext-2.1.7.js1.jar' due to its snapshot/release handling policy..
[ERROR] com.lowagie:itext:jar:2.1.7.js1
[ERROR] 
[ERROR] from the specified remote repositories:
[ERROR] metasystems-snapshots (http://javaguru.metasystems.com:8081/artifactory/metasystems-snapshot, releases=true, snapshots=true),
[ERROR] metasystems-release (http://javaguru.metasystems.com:8081/artifactory/metasystems-release, releases=true, snapshots=true),
[ERROR] local-releases (http://javaguru.metasystems.com:8081/artifactory/libs-release-local, releases=true, snapshots=true),
[ERROR] grails (http://repo.grails.org/grails/core, releases=true, snapshots=true),
[ERROR] grails-plugins (http://repo.grails.org/grails/plugins, releases=true, snapshots=true),
[ERROR] Metasystems Inc. (http://javaguru.metasystems.com:8081/artifactory/libs-release-local, releases=true, snapshots=true),
[ERROR] central-mirror (http://javaguru.metasystems.com:8081/artifactory/remote-repos, releases=true, snapshots=false)
[ERROR] Path to dependency:
[ERROR] 1) com.metasystems:MPF-SalesQuote:grails-app:1.0-SNAPSHOT
[ERROR] 2) net.sf.jasperreports:jasperreports:jar:5.0.1
[ERROR] 3) com.lowagie:itext:jar:2.1.7.js1
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoEx

ecutionException

2 个答案:

答案 0 :(得分:1)

返回代码是:409,ReasonPhrase:存储库'metasystems-snapshot'拒绝了工件'metasystems-snapshot:com / lowagie / itext / 2.1.7.js1 / itext-2.1.7.js1.jar'由于它的快照/发布处理政策..

正如错误代码409所示,您正在尝试将快照版本部署到仅发布的存储库中。因此冲突。在pom.xml中选择快照存储库而不是发行版,或者选择发行版而不是发行版的快照库。

答案 1 :(得分:0)

此解决方案对我有用,顺便说一句,由于下载额外存储库,它使部署速度变慢。

Jasper Library download forbidden when running maven: mvn package

对不起,我可以从其他问题中发布一个答案(这是解决方案) 请在您的pom.xml

中添加以下存储库
<repositories> 
    <repository>
        <id>jasperreports</id>
        <url>http://jasperreports.sourceforge.net/maven2</url>
    </repository>
    <repository>
        <id>jaspersoft-third-party</id>
        <url>http://jaspersoft.artifactoryonline.com/jaspersoft/t‌​hird-party-ce-artifa‌​cts/</url>
    </repository>
</repositories>