Just my 2 Euro cent:
- there's an address hardcoded here
  --
\maven-ant-tasks-2.1.3\src\main\java\org\apache\maven\artifact\ant\AbstractArtifactWithRepositoryTask.java (1 hit)       Line 55:         remoteRepository.setUrl( "http://repo1.maven.org/maven2"; );
  --
  so :
  a) recompile
  b) binary patch or ...
- you could override it in settings.
  (or pointing to a mirror, or a local artifactory)

Good luck,

    Davide

On 19/05/2020 03:55, Rick Mann wrote:
Hi there. If anyone can help with the following, I'd sure appreciate it:

• Get Ivy to set a classpath (cachepath)
• Get Maven Artifact Resolver Ant Tasks installed

macOS 10.15.4, Java 11

Details
-------

I have this really old ant-based server project I'm trying to update. It uses 
the org.apache.maven.artifact.ant artifact resolver, and it has served me well 
in the past. Now it's constantly having issues resolving dependencies (not the 
ones I specify explicitly, but secondary dependencies).

Usually it fails because it's trying to fetch artifacts using http instead of https, even 
though I've specified my repositories using https. It seems to have a hard-wired 
"central" pointing to <http://repo1.maven.org/maven2>. I've scoured my drive 
for a settings.xml file that might be setting this, but can't find one. Looking at the .poms in 
the artifact chain, I don't see them incorrectly specifying a repository, either (just in case 
they can).

```
[artifact:dependencies] Downloading: 
org/jboss/shrinkwrap/resolver/shrinkwrap-resolver-bom/2.2.0/shrinkwrap-resolver-bom-2.2.0.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/org/jboss/shrinkwrap/resolver/shrinkwrap-resolver-bom/2.2.0/shrinkwrap-resolver-bom-2.2.0.pom
[artifact:dependencies] [WARNING] Unable to get resource 
'org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-bom:pom:2.2.0' from 
repository central (http://repo1.maven.org/maven2): Error transferring file: 
Server returned HTTP response code: 501 for URL: 
http://repo1.maven.org/maven2/org/jboss/shrinkwrap/resolver/shrinkwrap-resolver-bom/2.2.0/shrinkwrap-resolver-bom-2.2.0.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 
'org.hibernate.validator:hibernate-validator:jar': POM 
'org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-bom' not found in 
repository: Unable to download the artifact from any repository
[artifact:dependencies]
[artifact:dependencies]   
org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-bom:pom:2.2.0
[artifact:dependencies]
[artifact:dependencies] from the specified remote repositories:
[artifact:dependencies]   central (http://repo1.maven.org/maven2)
[artifact:dependencies]
[artifact:dependencies]  for project 
org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-bom
[artifact:dependencies]   
org.hibernate.validator:hibernate-validator:jar:6.1.5.Final
[artifact:dependencies]
[artifact:dependencies] from the specified remote repositories:
[artifact:dependencies]   maven-group (https://repo1.maven.org/maven2/),
[artifact:dependencies]   central (http://repo1.maven.org/maven2),
[artifact:dependencies]   main.repository (https://repo1.maven.org/maven2),
[artifact:dependencies]   jboss-public-repository-group 
(https://repository.jboss.org/nexus/content/groups/public-jboss/)
[artifact:dependencies]
[artifact:dependencies] Path to dependency:
[artifact:dependencies]         1) org.apache.maven:super-pom:pom:2.0
```

I've tried moving to Ivy, but for some reason Ivy refuses to set my classpath 
(https://stackoverflow.com/questions/61869872/ant-ivy-wont-set-compile-classpath).

After a LOT of googling, I finally tracked down evidence that 
org.apache.maven.artifact.ant is deprecated, and I should be using 
org.apache.maven.resolver.ant (Maven Artifact Resolver Ant Tasks) instead. So I 
tried following the directions 
[here](https://maven.apache.org/resolver-ant-tasks/) to no avail.


```
$ ant build
Buildfile: /Users/rmann/Projects/Personal/SatDB/repo/branches/v1.0/build.xml

   [taskdef] Could not load definitions from resource 
org/apache/maven/resolver/ant/antlib.xml. It could not be found.
```

My guess is I don't have the jar file. So I try to track it down, but it's not 
pre-built, as far as I can tell. I downloaded the sources, but there seems to 
be no way to build it directly. The build.xml requires the maven ant tasks!

As I was writing this, I had the idea to see if the jar was in a maven repo, 
and I found it 
[here](https://repo1.maven.org/maven2/org/apache/maven/resolver/maven-resolver-ant-tasks/1.2.0/).
 Dropping that into ~/.ant/lib fixed the missing task, but now it needs 
org/eclipse/aether/resolution/ArtifactResolutionException. Why does Ant/Maven 
need stuff from Eclipse?

I've been out of the Java development game for 10 years, but the ecosystem sure 
seems to be an even bigger mess than it was then. This email only scratches the 
surface of what I've gone through to try to resurrect this project.

Thanks,

--
Ing. Davide Grandi
linkedin : http://linkedin.com/in/davidegrandi


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org

Reply via email to