无法构建 Apache-ant-1.10.5

无法构建 Apache-ant-1.10.5

我正在尝试构建 BLFS 8.4 尝试使用 fetch.xml ant 构建脚本下载运行时依赖项时发生错误: bootstrap/bin/ant -f fetch.xml -Ddest=optional

错误:

BUILD FAILED
/sources/BLFS/apache-ant-1.10.5/fetch.xml:212: The following error occurred while executing this line:
sources/BLFS/apache-ant-1.10.5/fetch.xml:122: Unable to resolve artifact: Missing:
--------
1) org.apache.ant:ant-antunit:jar:1.4

Try downloading the file manually from the project website.

Then, install it using the command:
mvn install:install-file -DgroupId=org.apache.ant -DartifactId=ant-antunit -Dversion=1.4 -Dpackaging=jar -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:

mvn deploy:deploy-file -DgroupId=org.apache.net -DartifactId=ant-antunit -Dversion=1.4 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

Path to dependency:
1) org.apache.maven:super-pom:pom:2.0
2) org.apache.ant:ant-antunit:jar:1.4

----------
1 required artifact is missing.

for artifact:
org.apache.maven:super-pom:pom:2.0

from the specified remote repositories:
central (http://repo1.maven.org/maven2/)

由于硬件限制,我在主机上构建 BLFS 8.4。我用的是bash 5.0

答案1

我尝试使用以下说明手动构建版本构建 Ant(Ant 手册) 结合安装 Apache Ant (BLFS 8.4)并得到你的错误:

$ export JAVA_HOME=/path/to/my/java-11-openjdk-amd64
$ ./bootstrap.sh
$ bootstrap/bin/ant -f fetch.xml -Ddest=optional
...
[artifact:dependencies] Downloading: org/apache/ant/ant-antunit/1.4/ant-antunit-1.4.pom from repository central at http://repo1.maven.org/maven2/
[artifact:dependencies] Error transferring file: Server returned HTTP response code: 501 for URL: http://repo1.maven.org/maven2/org/apache/ant/ant-antunit/1.4/ant-antunit-1.4.pom
[artifact:dependencies] [WARNING] Unable to get resource 'org.apache.ant:ant-antunit:pom:1.4' from repository central (http://repo1.maven.org/maven2/): Error transferring file: Server returned HTTP response code: 501 for URL: http://repo1.maven.org/maven2/org/apache/ant/ant-antunit/1.4/ant-antunit-1.4.pom
[artifact:dependencies] Downloading: org/apache/ant/ant-antunit/1.4/ant-antunit-1.4.jar from repository central at http://repo1.maven.org/maven2/
[artifact:dependencies] Error transferring file: Server returned HTTP response code: 501 for URL: http://repo1.maven.org/maven2/org/apache/ant/ant-antunit/1.4/ant-antunit-1.4.jar
[artifact:dependencies] [WARNING] Unable to get resource 'org.apache.ant:ant-antunit:jar:1.4' from repository central (http://repo1.maven.org/maven2/): Error transferring file: Server returned HTTP response code: 501 for URL: http://repo1.maven.org/maven2/org/apache/ant/ant-antunit/1.4/ant-antunit-1.4.jar
[artifact:dependencies] An error has occurred while processing the Maven artifact tasks.
...

如果你打开http://repo1.maven.org/maven2/org/apache/ant/ant-antunit/1.4/ant-antunit-1.4.pom你会看到 https 是必需的。

解决方案

编辑URL./lib/libraries.properties并将其更改为(第 29 行)m2.repohttphttps

# Repository to use by default for fetching dependencies.
m2.repo=https://repo1.maven.org/maven2/

并运行

bootstrap/bin/ant -f fetch.xml -Ddest=optional

再次。

相关内容