【问题标题】:maven build fails after adding jar to artifatory .m2/repository do not contain the jar file将 jar 添加到人工制品后,maven 构建失败 .m2/repository 不包含 jar 文件
【发布时间】:2014-08-25 20:20:38
【问题描述】:

我尝试将 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 文件都存在于工件中,但未被识别。

[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

执行异常

【问题讨论】:

    标签: java maven grails intellij-idea artifactory


    【解决方案1】:

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

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

    【讨论】:

    • 我也有同样的想法,但错误消息似乎表明回购支持快照/发布:[错误]元系统快照(javaguru.metasystems.com:8081/artifactory/metasystems-snapshot,发布=真,快照=真),是这是从远程主机返回的,还是在本地定义的?
    • 顺便说一句...我认为问题在于在运行应用程序目标期间拉出工件而不是在部署时
    • 是的,它是一个快照版本,在 pom.xml 中显示 1.0.SNAPSHOT。一旦我使用 grails -Dgrails.env=test war 构建了战争,我重命名了战争并将其部署在测试服务器中。我应该将版本更改为“RELEASE”吗?有什么具体我需要做的吗?
    • 我有 pom.xml 中提到的快照和发布存储库
    • @coffeeaddict 此错误仅来自远程主机。在本地,它运行良好。
    【解决方案2】:

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

    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>
    

    【讨论】:

      猜你喜欢
      • 2011-05-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多