Skip to main content

Maven repository order

org.openrewrite.java.dependencies.FindRepositoryOrder

Determine the order in which dependencies will be resolved for each pom.xml or build.gradle based on its defined repositories and effective settings.

Recipe source

GitHub: FindRepositoryOrder.java, Issue Tracker, Maven Central

This recipe is available under the Apache License Version 2.0.

Example

Before
pom.xml
<project>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1</version>
<repositories>
<repository>
<id>myRepo</id>
<url>https://myrepo.maven.com/repo</url>
</repository>
</repositories>
</project>
After
pom.xml
<!--~~(https://myrepo.maven.com/repo)~~>--><project>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1</version>
<repositories>
<repository>
<id>myRepo</id>
<url>https://myrepo.maven.com/repo</url>
</repository>
</repositories>
</project>

Usage

This recipe has no required configuration options. It can be activated by adding a dependency on org.openrewrite.recipe:rewrite-java-dependencies in your build file or by running a shell command (in which case no build changes are needed):

  1. Add the following to your build.gradle file:
build.gradle
plugins {
id("org.openrewrite.rewrite") version("latest.release")
}

rewrite {
activeRecipe("org.openrewrite.java.dependencies.FindRepositoryOrder")
setExportDatatables(true)
}

repositories {
mavenCentral()
}

dependencies {
rewrite("org.openrewrite.recipe:rewrite-java-dependencies:1.51.0")
}
  1. Run gradle rewriteRun to run the recipe.

See how this recipe works across multiple open-source repositories

Run this recipe on OSS repos at scale with the Moderne SaaS.

The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories.

Please contact Moderne for more information about safely running the recipes on your own codebase in a private SaaS.

Data Tables

Maven repository order

org.openrewrite.maven.table.MavenRepositoryOrder

The order in which dependencies will be resolved for each pom.xml based on its defined repositories and effective settings.xml.

Column NameDescription
Repository IDThe ID of the repository. Note that projects may define the same physical repository with different IDs.
Repository URIThe URI of the repository.
Known to existIf the repository is provably reachable. If false, does not guarantee that the repository does not exist.
RankThe index order of this repository in the repository list.