【问题标题】:maven dependency in build.xml file is not able to downloadbuild.xml 文件中的 maven 依赖项无法下载
【发布时间】:2020-06-12 14:47:19
【问题描述】:

在 build.xml 中添加了 maven jar 依赖项,目标如下。

<artifact:dependencies pathId="dependency.classpath">
     <dependency groupId="org.glassfish.metro" artifactId="webservices-rt" version="2.4.3"/>
</artifact:dependencies>

在构建期间出现错误

    [artifact:dependencies] 1) org.glassfish.metro:webservices-rt:jar:2.4.3
[artifact:dependencies] 
[artifact:dependencies]   Try downloading the file manually from the project website.
[artifact:dependencies] 
[artifact:dependencies]   Then, install it using the command: 
[artifact:dependencies]       mvn install:install-file -DgroupId=org.glassfish.metro -DartifactId=webservices-rt -Dversion=2.4.3 -Dpackaging=jar -Dfile=/path/to/file
[artifact:dependencies] 
[artifact:dependencies]   Alternatively, if you host your own repository you can deploy the file there: 
[artifact:dependencies]       mvn deploy:deploy-file -DgroupId=org.glassfish.metro -DartifactId=webservices-rt -Dversion=2.4.3 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[artifact:dependencies] 
[artifact:dependencies]   Path to dependency: 
[artifact:dependencies]     1) org.apache.maven:super-pom:pom:2.0
[artifact:dependencies]     2) org.glassfish.metro:webservices-rt:jar:2.4.3

【问题讨论】:

  • 你到底用什么来构建所有这些?这是 Ant 的 Maven 扩展吗?

标签: maven build ant


【解决方案1】:

maven-ant-tasks 插件已被废弃多年。注意页面顶部附近的大红色消息:https://maven.apache.org/ant-tasks/

现在失败了,因为 Maven Central 最近切换到 HTTPS,所以maven-ant-tasks 尝试使用的默认存储库 URL 返回 401 错误。 Apache 建议现在使用 resolver-ant-tasks https://maven.apache.org/resolver-ant-tasks/

您也可以使用 Apache Ivy,或者只是使用 Ant 的 &lt;exec&gt; 任务来运行 mvn 可执行文件,就像在命令行中一样。

【讨论】:

    猜你喜欢
    • 2013-05-22
    • 2020-07-06
    • 2011-12-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-25
    • 2020-06-03
    • 1970-01-01
    相关资源
    最近更新 更多