How can you find the latest version of a maven artifact from Java using aether?

The Aether Team maintains a demo page with such an example: FindNewestVersion. Simplified a bit, this is what it comes down to. Add to your POM the Aether dependencies: <dependencies> <dependency> <groupId>org.eclipse.aether</groupId> <artifactId>aether-impl</artifactId> <version>${aetherVersion}</version> </dependency> <dependency> <groupId>org.eclipse.aether</groupId> <artifactId>aether-connector-basic</artifactId> <version>${aetherVersion}</version> </dependency> <dependency> <groupId>org.eclipse.aether</groupId> <artifactId>aether-transport-file</artifactId> <version>${aetherVersion}</version> </dependency> <dependency> <groupId>org.eclipse.aether</groupId> <artifactId>aether-transport-http</artifactId> <version>${aetherVersion}</version> </dependency> <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-aether-provider</artifactId> <version>${mavenVersion}</version> </dependency> … Read more

How to get access to Maven’s dependency hierarchy within a plugin

The dependency plugin has the tree goal that does most of this work. It processes a MavenProject using the DependencyTreeBuilder, this returns a DependencyNode with hierarchical information about the resolved dependencies (and their transitive dependencies). You can copy much of the code directly from the TreeMojo. It uses the CollectingDependencyNodeVisitor to traverse the tree and … Read more