我已遵循 netbeans 的以下指南:从源代码构建
不幸的是,在运行 ant build 时,当它尝试从 maven 中央存储库下载时,它使用的 URL 似乎已过时,新的 URL 似乎在新网址。我应该在哪里进行更改,或者这可能是我的系统的问题?
错误(省略了一些网址):
Buildfile: /home/teste/Downloads/netbeans-11.2-source/build.xml
-jdk-pre-preinit:
-jdk-preinit:
-jdk-warn:
-jdk-presetdef-basic:
-jdk-default:
-jdk-init:
-load-build-properties:
bootstrap:
[downloadbinaries] Could not download 16398550402B27F81CD0D508CEF54B3E47A4A6DA-apache-rat-0.12.jar to /home/teste/.hgexternalcache/16398550402B27F81CD0D508CEF54B3E47A4A6DA-apache-rat-0.12.jar: java.io.IOException: Cannot connect to http://central.maven.org/maven2/org/apache/rat/apache-rat/0.12/apache-rat-0.12.jar
BUILD FAILED
/home/teste/Downloads/netbeans-11.2-source/nbbuild/build.xml:71: Failed to download binaries - see log message for the detailed reasons.
nmap 也抱怨没有在这个 maven url 上找到目标,所以它似乎真的消失了。
无论哪种方式,如果可以以构建使用的方式获取文件,那么它也可以解决我的问题
答案1
vim ./nbbuild/antsrc/org/netbeans/nbbuild/extlibs/DownloadBinaries.java
163 private byte[] mavenFile(MavenCoordinate mc) throws IOException { 164 String cacheName = mc.toMavenPath(); 165 File local = new File(new File(new File(new File(System.getProperty("user.home")), ".m2"), "repository"), ca cheName.replace('/', File.separatorChar)); 166 final String url; 167 if (local.exists()) { 168 url = local.toURI().toString(); 169 } else { 170 url = "https://repo1.maven.org/maven2/" + cacheName; 171 } 172 URL u = new URL(url); 173 返回 downloadFromServer(u); 174 }
更改 170 行