Maven Ant Tasks - cannot connect to Maven Central anymore

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Maven Ant Tasks - cannot connect to Maven Central anymore

Cristian Caprar
Hi everyone,

I know this component is retired, but some projects still use it (we are using SAP Commerce and it makes use if it…).

As of 15 January 2020, the only way to access Maven Central is by https. This starts the issue.

The problem: Maven Ant Task throws an error that it cannot connect to <>) and all our builds fail.

- in Maven Ant Tasks, the mvn task (Mvn class) is being called in our case without a mavenHome (because we are running the build in a Docker container and it does not have Maven in it)
- this task tries to resolve the Maven dependency by itself (downloadAndConfigureMaven method)
- it creates a DependenciesTask without without any configured remote repository and executes it
- the DependenciesTask will create a default remote repository configuration, in base class AbstractArtifactWithRepositoryTask#getDefaultRemoteRepository
- this default remote repo is unfortunately hardcoded to “”

We tried to pass -DremoteRepositories=central::default:: <> as a command line argument to the Mvn task, but this is ignored by the task as described above.

What I plan to do is to use this command line argument to setup a correct remote repo in the dependencies task when resolving Maven.

Is there any place to contribute the change?

If someone has the same problem, feel free to contact me.

Thank you and all the best,
Cristi C.