Re: Maven Ant Tasks - cannot connect to Maven Central anymore

2020-01-25 Thread Cristian Caprar
Hi Vladimir,

I am aware of https://issues.apache.org/jira/browse/MANTTASKS-206 
, but this is not the 
problem we are having.

Our problem only happens in the downloadAndConfigureMaven branch, where any 
other setting is ignored and the default hardcoded central repo HTTP url is 
injected.

This default repo does not come from 
AbstractArtifactWithRepositoryTask#getDefaultRemoteRepository (even though it 
should be changed there also, to https), but it comes from the very maven 
project definition that is in org.apache.maven:maven-project:2.2.1 (which also 
keeps using http). If that would change to HTTPS, it would be used.

I forked the repo, created a feature branch and submitted a PR to the main repo.

Hope it is useful.

Cristi C.





> On 16 Jan 2020, at 23:53, Vladimir Sitnikov  
> wrote:
> 
> Cristi>Is there any place to contribute the change?
> 
> Here:
> https://github.com/apache/maven-ant-tasks/blob/ed4d9a3bd1a41613791f2466f19c225898d45519/src/main/java/org/apache/maven/artifact/ant/AbstractArtifactWithRepositoryTask.java#L55
> 
> PS. https://issues.apache.org/jira/browse/MANTTASKS-206 seems to specify
> the way to override the URL.
> 
> Vladimir



Re: Maven Ant Tasks - cannot connect to Maven Central anymore

2020-01-16 Thread Vladimir Sitnikov
Cristi>Is there any place to contribute the change?

Here:
https://github.com/apache/maven-ant-tasks/blob/ed4d9a3bd1a41613791f2466f19c225898d45519/src/main/java/org/apache/maven/artifact/ant/AbstractArtifactWithRepositoryTask.java#L55

PS. https://issues.apache.org/jira/browse/MANTTASKS-206 seems to specify
the way to override the URL.

Vladimir


Maven Ant Tasks - cannot connect to Maven Central anymore

2020-01-16 Thread 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 
http://repo1.maven.org/maven2 ) and all our 
builds fail.

Details:
- 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 
“http://repo1.maven.org/maven2”

We tried to pass 
-DremoteRepositories=central::default::http://nexus.ourdomain.com/repository/maven-central/
  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.