You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Much existing, legacy Maven plugin code uses org.sonatype.aether to interact with (download, upload, query) Maven repositories such as the central repository.

Some plugin use this for tests, especially integration tests, but not in the plugin itself.

This page describes how to convert that old code to the current APIs from Maven resolver.

Artifacts, Libraries, and Dependencies

The oldest dependencies have the group ID org.sonatype.aether.

Old dependencies have the group ID org.eclipse.aether.

The up to date code lives in org.apache.maven.resolver.

When migration is complete, no pom.xml should import a dependency with the group ID org.sonatype.aether or org.eclipse.aether

Web searches will uncover a lot of outdated, buggy documentation based on org.sonatype.aether and org.eclipse.aether. In particular ignore all documentation on eclipse.org.

Packages

Old code lives in the org.sonatype.aether package. When you're done no references to this package should remain. 

New code lives in the org.eclipse.aether package. This includes code that comes from org.apache.maven.resolver. That is, in the newest code the group ID does not match the Java package name.

You cannot simply rename packages in the Java source code. Subpackages have also been renamed or moved and classes have been renamed or deleted as well.

Step-by-step guide

  1. Add a dependency on Apache Maven resolver to the necessary modules. In most cases these will be modules that already depend on org.sonatype.aether. For example, if you already have
    <dependency>
      <groupId>org.sonatype.aether</groupId>
      <artifactId>aether-connector-file</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.sonatype.aether</groupId>
      <artifactId>aether-connector-wagon</artifactId>
      <scope>test</scope>
    </dependency>
    You would add
    <dependency>
      <groupId>org.apache.maven.resolver</groupId>
      <artifactId>maven-resolver-transport-file</artifactId>
      <version>1.4.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.resolver</groupId>
      <artifactId>maven-resolver-transport-wagon</artifactId>
      <version>1.4.1</version>
      <scope>test</scope>
        </dependency>
    1. Sometimes these dependencies can be test scoped.




  • No labels