As you know, starting from 15 January 2020 Maven central repo requires HTTPS-only access. One of our projects is using Ant and Maven Ant Tasks (dependency management only). Yes, I know it's deprecated, but what is the other option for using pom.xml in old ant builds?
Looks like the Maven Ant Tasks have a bug if the dependency tree contains a link to pom, it always will be accessed through HTTP (despite locally configured https://repo.maven.apache.org/maven2).
Any ideas on how to workaround the bug?
P.S. Yes, that is working configuration (i.e. worked through HTTP) and pom file exists with the correct parameters.
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.abc</groupId>
<artifactId>Test</artifactId>
<version>4.5-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client</artifactId>
<version>8.4.5</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
</project>
Part of build.xml
<artifact:dependencies filesetid="maven.classpath">
<pom file="../pom.xml" />
</artifact:dependencies>
Part of output
[artifact:dependencies] Downloading: com/vaadin/vaadin-client/8.4.5/vaadin-client-8.4.5.pom from repository central at https://repo.maven.apache.org/maven2
[artifact:dependencies] Transferring 6K from central
[artifact:dependencies] Downloading: com/vaadin/vaadin-root/8.4.5/vaadin-root-8.4.5.pom from repository central at https://repo.maven.apache.org/maven2
[artifact:dependencies] Transferring 40K from central
[artifact:dependencies] Downloading: com/vaadin/vaadin-parent/1.1.0/vaadin-parent-1.1.0.pom from repository central at https://repo.maven.apache.org/maven2
[artifact:dependencies] Transferring 8K from central
[artifact:dependencies] Downloading: com/vaadin/vaadin-shared/8.4.5/vaadin-shared-8.4.5.pom from repository central at https://repo.maven.apache.org/maven2
[artifact:dependencies] Transferring 7K from central
[artifact:dependencies] Downloading: com/vaadin/vaadin-server/8.4.5/vaadin-server-8.4.5.pom from repository central at https://repo.maven.apache.org/maven2
[artifact:dependencies] Transferring 13K from central
[artifact:dependencies] Downloading: org/jsoup/jsoup/1.11.2/jsoup-1.11.2.pom from repository central at https://repo.maven.apache.org/maven2
[artifact:dependencies] Transferring 8K from central
[artifact:dependencies] Downloading: com/vaadin/external/gentyref/1.2.0.vaadin1/gentyref-1.2.0.vaadin1.pom from repository central at https://repo.maven.apache.org/maven2
[artifact:dependencies] Transferring 5K from central
[artifact:dependencies] Downloading: com/google/gwt/gwt-elemental/2.8.2/gwt-elemental-2.8.2.pom from repository central at https://repo.maven.apache.org/maven2
[artifact:dependencies] Transferring 1K from central
[artifact:dependencies] Downloading: com/google/gwt/gwt/2.8.2/gwt-2.8.2.pom from repository central at https://repo.maven.apache.org/maven2
[artifact:dependencies] Transferring 9K from central
[artifact:dependencies] Downloading: org/sonatype/oss/oss-parent/4/oss-parent-4.pom from repository central at https://repo.maven.apache.org/maven2
[artifact:dependencies] Transferring 4K from central
[artifact:dependencies] Downloading: com/google/web/bindery/requestfactory/2.8.2/requestfactory-2.8.2.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/com/google/web/bindery/requestfactory/2.8.2/requestfactory-2.8.2.pom
[artifact:dependencies] [WARNING] Unable to get resource 'com.google.web.bindery:requestfactory:pom:2.8.2' from repository central (http://repo1.maven.org/maven2): Error transferring file: Server returned HTTP response code: 501 for URL: http://repo1.maven.org/maven2/com/google/web/bindery/requestfactory/2.8.2/requestfactory-2.8.2.pom
[artifact:dependencies] An error has occurred while processing the Maven artifact tasks.
[artifact:dependencies] Diagnosis:
[artifact:dependencies]
[artifact:dependencies] Unable to resolve artifact: Unable to get dependency information: Unable to read the metadata file for artifact 'com.google.gwt:gwt-elemental:jar': POM 'com.google.web.bindery:requestfactory' not found in repository: Unable to download the artifact from any repository
[artifact:dependencies]
[artifact:dependencies] com.google.web.bindery:requestfactory:pom:2.8.2
[artifact:dependencies]
[artifact:dependencies] from the specified remote repositories:
[artifact:dependencies] central (http://repo1.maven.org/maven2),
[artifact:dependencies] sonatype-nexus-snapshots (https://oss.sonatype.org/content/repositories/snapshots)
[artifact:dependencies]
[artifact:dependencies] for project com.google.web.bindery:requestfactory
[artifact:dependencies] com.google.gwt:gwt-elemental:jar:2.8.2
[artifact:dependencies]
[artifact:dependencies] from the specified remote repositories:
[artifact:dependencies] central (https://repo.maven.apache.org/maven2),
[artifact:dependencies] vaadin-snapshots (https://oss.sonatype.org/content/repositories/vaadin-snapshots/)
[artifact:dependencies]
[artifact:dependencies] Path to dependency:
[artifact:dependencies] 1) com.abc:Test:jar:4.5-SNAPSHOT
[artifact:dependencies] 2) com.vaadin:vaadin-client:jar:8.4.5
[artifact:dependencies]
[artifact:dependencies]
We had the same problem that's why I debugged the jar to find out what might be the problem. Turns out that you can easily fix it by editing the pom-4.0.0.xml located inside the jar (relative path) org\apache\maven\project. Just change the urls to https and you should be fine.
Have you tried to install manually ?
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> \
-DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>
I was looking into a similar issue for building an old version of Thrift. Here's what worked for me. Edit the build.xml
and add a remoteRepository
in the artifact:dependencies
block.
Example:
<artifact:dependencies filesetId="build-dependency-jars" pomRefId="pom">
<remoteRepository id="mavenCentral" url="https://repo1.maven.org/maven2"/>
</artifact:dependencies>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With