Created attachment 37159 [details] Build file to reproduce the issue Trying to import remote ant file fails when importing from https://gitlab.com/.. . Build file to reproduce the issue is attached. JDK version: 1.8.0_212 Ant version: 1.10.7 Error message generated: Cannot find https://gitlab.com/MedisoArt/public/java-commons/raw/master/build.xml imported from [local build.xml]. Important notes: 1. Importing from other servers works as expected. 2. Importing from gitlab worked as expected on 23 March 2020. Now it fails.
This looks like some server side change/policy that that URL might have placed. I can access that URL from browser, curl and wget but when Ant tries it from Java code, it's receiving a 403 error. In fact, even the following trivial Java program (which is almost what Ant does internally) results in a 403: import java.net.URL; import java.io.InputStream; public class Fetch { public static void main(final String[] args) throws Exception { final URL targetURL = new URL("https://gitlab.com/MedisoArt/public/java-commons/raw/master/build.xml"); try (final InputStream is = targetURL.openConnection().getInputStream()) { is.read(); } System.out.println("Done"); } } You might have to talk to whoever manages that URL to understand what restrictions are in place to access that URL (and what changed on 23 March 2020). Maybe they are using some request headers to decide whether or not to allow access to the resource.
This is the error that I get when I run that trivial Java program: Exception in thread "main" java.io.IOException: Server returned HTTP response code: 403 for URL: https://gitlab.com/MedisoArt/public/java-commons/raw/master/build.xml at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1900) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:268)
It works with Java 14 but not with Java 8. It seems some server side configuration is prohibiting Java8 - the TLS handshake looks fine, though.