Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@
import lombok.Value;
import org.jspecify.annotations.Nullable;
import org.openrewrite.*;
import org.openrewrite.maven.table.MavenRepositoryOrder;

@Value
@EqualsAndHashCode(callSuper = false)
public class FindRepositoryOrder extends Recipe {
// Populated by the sub-recipes. Listed here so the data table is included in the recipe metadata.
transient MavenRepositoryOrder repositoryOrder = new MavenRepositoryOrder(this);

String displayName = "Maven repository order";

Expand Down
3 changes: 1 addition & 2 deletions src/main/resources/META-INF/rewrite/recipes.csv
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ maven,org.openrewrite.recipe:rewrite-java-dependencies,org.openrewrite.java.depe
maven,org.openrewrite.recipe:rewrite-java-dependencies,org.openrewrite.java.dependencies.DependencyInsight,Dependency insight for Gradle and Maven,"Finds dependencies, including transitive dependencies, in both Gradle and Maven projects. Matches within all Gradle dependency configurations and Maven scopes.",1,,Dependencies,Java,,,Basic building blocks for transforming Java code.,"[{""name"":""groupIdPattern"",""type"":""String"",""displayName"":""Group pattern"",""description"":""Group ID glob pattern used to match dependencies."",""example"":""com.fasterxml.jackson*"",""required"":true},{""name"":""artifactIdPattern"",""type"":""String"",""displayName"":""Artifact pattern"",""description"":""Artifact ID glob pattern used to match dependencies."",""example"":""jackson-*"",""required"":true},{""name"":""version"",""type"":""String"",""displayName"":""Version"",""description"":""Match only dependencies with the specified version. Node-style [version selectors](https://docs.openrewrite.org/reference/dependency-version-selectors) may be used. All versions are searched by default."",""example"":""1.x""},{""name"":""scope"",""type"":""String"",""displayName"":""Scope"",""description"":""Match dependencies with the specified Maven scope. All scopes are searched by default."",""example"":""compile"",""valid"":[""compile"",""test"",""runtime"",""provided"",""system""]}]","[{""name"":""org.openrewrite.maven.table.DependenciesInUse"",""displayName"":""Dependencies in use"",""description"":""Direct and transitive dependencies in use."",""columns"":[{""name"":""projectName"",""type"":""String"",""displayName"":""Project name"",""description"":""The name of the project that contains the dependency.""},{""name"":""sourceSet"",""type"":""String"",""displayName"":""Source set"",""description"":""The source set that contains the dependency.""},{""name"":""groupId"",""type"":""String"",""displayName"":""Group"",""description"":""The first part of a dependency coordinate `com.google.guava:guava:VERSION`.""},{""name"":""artifactId"",""type"":""String"",""displayName"":""Artifact"",""description"":""The second part of a dependency coordinate `com.google.guava:guava:VERSION`.""},{""name"":""version"",""type"":""String"",""displayName"":""Version"",""description"":""The resolved version.""},{""name"":""datedSnapshotVersion"",""type"":""String"",""displayName"":""Dated snapshot version"",""description"":""The resolved dated snapshot version or `null` if this dependency is not a snapshot.""},{""name"":""scope"",""type"":""String"",""displayName"":""Scope"",""description"":""Dependency scope. This will be `compile` if the dependency is direct and a scope is not explicitly specified in the POM.""},{""name"":""count"",""type"":""Integer"",""displayName"":""Count"",""description"":""How many times does this dependency appear.""}]}]"
maven,org.openrewrite.recipe:rewrite-java-dependencies,org.openrewrite.java.dependencies.DependencyList,Dependency report,Emits a data table detailing all Gradle and Maven dependencies. This recipe makes no changes to any source file.,1,,Dependencies,Java,,,Basic building blocks for transforming Java code.,"[{""name"":""scope"",""type"":""Scope"",""displayName"":""Scope"",""description"":""The scope of the dependencies to include in the report.Defaults to \""Compile\"""",""example"":""Compile"",""valid"":[""Compile"",""Runtime"",""TestRuntime""]},{""name"":""includeTransitive"",""type"":""boolean"",""displayName"":""Include transitive dependencies"",""description"":""Whether or not to include transitive dependencies in the report. Defaults to including only direct dependencies.Defaults to false."",""example"":""true"",""value"":false},{""name"":""validateResolvable"",""type"":""boolean"",""displayName"":""Validate dependencies are resolvable"",""description"":""When enabled the recipe will attempt to download every dependency it encounters, reporting on any failures. This can be useful for identifying dependencies that have become unavailable since an LST was produced.Defaults to false."",""example"":""true"",""valid"":[""true"",""false""],""value"":false}]","[{""name"":""org.openrewrite.java.dependencies.table.DependencyListReport"",""displayName"":""Dependency report"",""description"":""Lists all Gradle and Maven dependencies"",""columns"":[{""name"":""buildTool"",""type"":""String"",""displayName"":""Build tool"",""description"":""The build tool used to manage dependencies (Gradle or Maven).""},{""name"":""groupId"",""type"":""String"",""displayName"":""Group id"",""description"":""The Group ID of the Gradle project or Maven module requesting the dependency.""},{""name"":""artifactId"",""type"":""String"",""displayName"":""Artifact id"",""description"":""The Artifact ID of the Gradle project or Maven module requesting the dependency.""},{""name"":""version"",""type"":""String"",""displayName"":""Version"",""description"":""The version of Gradle project or Maven module requesting the dependency.""},{""name"":""dependencyGroupId"",""type"":""String"",""displayName"":""Dependency group id"",""description"":""The Group ID of the dependency.""},{""name"":""dependencyArtifactId"",""type"":""String"",""displayName"":""Dependency artifact id"",""description"":""The Artifact ID of the dependency.""},{""name"":""dependencyVersion"",""type"":""String"",""displayName"":""Dependency version"",""description"":""The version of the dependency.""},{""name"":""direct"",""type"":""boolean"",""displayName"":""Direct Dependency"",""description"":""When `true` the project directly depends on the dependency. When `false` the project depends on the dependency transitively through at least one direct dependency.""},{""name"":""resolutionFailure"",""type"":""String"",""displayName"":""Resolution failure"",""description"":""The reason why the dependency could not be resolved. Blank when resolution was not attempted.""}]},{""name"":""org.openrewrite.maven.table.MavenMetadataFailures"",""displayName"":""Maven metadata failures"",""description"":""Attempts to resolve maven metadata that failed."",""columns"":[{""name"":""group"",""type"":""String"",""displayName"":""Group id"",""description"":""The groupId of the artifact for which the metadata download failed.""},{""name"":""artifactId"",""type"":""String"",""displayName"":""Artifact id"",""description"":""The artifactId of the artifact for which the metadata download failed.""},{""name"":""version"",""type"":""String"",""displayName"":""Version"",""description"":""The version of the artifact for which the metadata download failed.""},{""name"":""mavenRepositoryUri"",""type"":""String"",""displayName"":""Maven repository"",""description"":""The URL of the Maven repository that the metadata download failed on.""},{""name"":""snapshots"",""type"":""String"",""displayName"":""Snapshots"",""description"":""Does the repository support snapshots.""},{""name"":""releases"",""type"":""String"",""displayName"":""Releases"",""description"":""Does the repository support releases.""},{""name"":""failure"",""type"":""String"",""displayName"":""Failure"",""description"":""The reason the metadata download failed.""}]}]"
maven,org.openrewrite.recipe:rewrite-java-dependencies,org.openrewrite.java.dependencies.FindDependency,Find Maven and Gradle dependencies,Finds direct dependencies declared in Maven and Gradle build files. This does *not* search transitive dependencies. To detect both direct and transitive dependencies use `org.openrewrite.java.dependencies.DependencyInsight` This recipe works for both Maven and Gradle projects.,1,,Dependencies,Java,,,Basic building blocks for transforming Java code.,"[{""name"":""groupId"",""type"":""String"",""displayName"":""Group ID"",""description"":""The first part of a dependency coordinate identifying its publisher."",""example"":""com.google.guava"",""required"":true},{""name"":""artifactId"",""type"":""String"",""displayName"":""Artifact ID"",""description"":""The second part of a dependency coordinate uniquely identifying it among artifacts from the same publisher."",""example"":""guava"",""required"":true},{""name"":""version"",""type"":""String"",""displayName"":""Version"",""description"":""An exact version number or node-style semver selector used to select the version number."",""example"":""3.0.0""},{""name"":""versionPattern"",""type"":""String"",""displayName"":""Version pattern"",""description"":""Allows version selection to be extended beyond the original Node Semver semantics. So for example, setting 'version' to \""25-29\"" can be paired with a metadata pattern of \""-jre\"" to select Guava 29.0-jre"",""example"":""-jre""},{""name"":""configuration"",""type"":""String"",""displayName"":""Configuration"",""description"":""For Gradle only, the dependency configuration to search for dependencies in. If omitted then all configurations will be searched."",""example"":""api""}]",
maven,org.openrewrite.recipe:rewrite-java-dependencies,org.openrewrite.java.dependencies.FindRepositoryOrder,Maven repository order,Determine the order in which dependencies will be resolved for each `pom.xml` or `build.gradle` based on its defined repositories and effective settings.,1,Search,Maven,,,,,,
maven,org.openrewrite.recipe:rewrite-java-dependencies,org.openrewrite.java.dependencies.FindRepositoryOrder,Maven repository order,Determine the order in which dependencies will be resolved for each `pom.xml` or `build.gradle` based on its defined repositories and effective settings.,1,Search,Gradle,,,,,,
maven,org.openrewrite.recipe:rewrite-java-dependencies,org.openrewrite.java.dependencies.FindRepositoryOrder,Maven repository order,Determine the order in which dependencies will be resolved for each `pom.xml` or `build.gradle` based on its defined repositories and effective settings.,1,,Dependencies,Java,,,Basic building blocks for transforming Java code.,,"[{""name"":""org.openrewrite.maven.table.MavenRepositoryOrder"",""displayName"":""Maven repository order"",""description"":""The order in which dependencies will be resolved for each `pom.xml` based on its defined repositories and effective `settings.xml`."",""columns"":[{""name"":""id"",""type"":""String"",""displayName"":""Repository ID"",""description"":""The ID of the repository. Note that projects may define the same physical repository with different IDs.""},{""name"":""uri"",""type"":""String"",""displayName"":""Repository URI"",""description"":""The URI of the repository.""},{""name"":""knownToExist"",""type"":""boolean"",""displayName"":""Known to exist"",""description"":""If the repository is provably reachable. If false, does not guarantee that the repository does not exist.""},{""name"":""rank"",""type"":""int"",""displayName"":""Rank"",""description"":""The index order of this repository in the repository list.""}]}]"
maven,org.openrewrite.recipe:rewrite-java-dependencies,org.openrewrite.java.dependencies.AddDependency,Add Gradle or Maven dependency,"For a Gradle project, add a gradle dependency to a `build.gradle` file in the correct configuration based on where it is used. Or For a maven project, Add a Maven dependency to a `pom.xml` file in the correct scope based on where it is used.",1,,Dependencies,Java,,,Basic building blocks for transforming Java code.,"[{""name"":""groupId"",""type"":""String"",""displayName"":""Group ID"",""description"":""The first part of a dependency coordinate `com.google.guava:guava:VERSION`."",""example"":""com.google.guava"",""required"":true},{""name"":""artifactId"",""type"":""String"",""displayName"":""Artifact ID"",""description"":""The second part of a dependency coordinate `com.google.guava:guava:VERSION`"",""example"":""guava"",""required"":true},{""name"":""version"",""type"":""String"",""displayName"":""Version"",""description"":""An exact version number or node-style semver selector used to select the version number."",""example"":""29.X""},{""name"":""versionPattern"",""type"":""String"",""displayName"":""Version pattern"",""description"":""Allows version selection to be extended beyond the original Node Semver semantics. So for example, Setting 'version' to \""25-29\"" can be paired with a metadata pattern of \""-jre\"" to select Guava 29.0-jre"",""example"":""-jre""},{""name"":""onlyIfUsing"",""type"":""String"",""displayName"":""Only if using"",""description"":""Used to determine if the dependency will be added and in which scope it should be placed."",""example"":""org.junit.jupiter.api.*""},{""name"":""classifier"",""type"":""String"",""displayName"":""Classifier"",""description"":""A classifier to add. Commonly used to select variants of a library."",""example"":""test""},{""name"":""familyPattern"",""type"":""String"",""displayName"":""Family pattern"",""description"":""A pattern, applied to groupIds, used to determine which other dependencies should have aligned version numbers. Accepts '*' as a wildcard character."",""example"":""com.fasterxml.jackson*""},{""name"":""extension"",""type"":""String"",""displayName"":""Extension"",""description"":""For Gradle only, The extension of the dependency to add. If omitted Gradle defaults to assuming the type is \""jar\""."",""example"":""jar""},{""name"":""configuration"",""type"":""String"",""displayName"":""Gradle configuration"",""description"":""The Gradle dependency configuration name within which to place the dependency. When omitted the configuration will be determined by the Maven scope parameter. If that parameter is also omitted, configuration will be determined based on where types matching `onlyIfUsing` appear in source code."",""example"":""implementation""},{""name"":""scope"",""type"":""String"",""displayName"":""Maven scope"",""description"":""The Maven scope within which to place the dependency. When omitted scope will be determined based on where types matching `onlyIfUsing` appear in source code."",""example"":""runtime"",""valid"":[""compile"",""provided"",""runtime"",""test""]},{""name"":""releasesOnly"",""type"":""Boolean"",""displayName"":""Releases only"",""description"":""For Maven only, Whether to exclude snapshots from consideration when using a semver selector""},{""name"":""type"",""type"":""String"",""displayName"":""Type"",""description"":""For Maven only, The type of dependency to add. If omitted Maven defaults to assuming the type is \""jar\""."",""example"":""jar"",""valid"":[""jar"",""pom"",""war""]},{""name"":""optional"",""type"":""Boolean"",""displayName"":""Optional"",""description"":""Set the value of the `<optional>` tag. No `<optional>` tag will be added when this is `null`.""},{""name"":""acceptTransitive"",""type"":""Boolean"",""displayName"":""Accept transitive"",""description"":""Default false. If enabled, the dependency will not be added if it is already on the classpath as a transitive dependency."",""example"":""true""}]",
maven,org.openrewrite.recipe:rewrite-java-dependencies,org.openrewrite.java.dependencies.DependencyResolutionDiagnostic,Dependency resolution diagnostic,"Recipes which manipulate dependencies must be able to successfully access the artifact repositories and resolve dependencies from them. This recipe produces two data tables used to understand the state of dependency resolution.

Expand Down