Skip to content

Latest commit

 

History

History
123 lines (98 loc) · 4.34 KB

dependencylist.md

File metadata and controls

123 lines (98 loc) · 4.34 KB

Dependency report

org.openrewrite.java.dependencies.DependencyList

Emits a data table detailing all Gradle and Maven dependencies.This recipe makes no changes to any source file.

Source

GitHub, Issue Tracker, Maven Central

  • groupId: org.openrewrite.recipe
  • artifactId: rewrite-java-dependencies
  • version: 1.0.1

Options

Type Name Description
Scope scope The scope of the dependencies to include in the report.
boolean includeTransitive Whether or not to include transitive dependencies in the report. Defaults to including only direct dependencies.

Data Tables (Only available on the Moderne platform)

Dependency report

Lists all Gradle and Maven dependencies

Column Name Description
Build tool The build tool used to manage dependencies (Gradle or Maven).
Group id The Group ID of the Gradle project or Maven module requesting the dependency.
Artifact id The Artifact ID of the Gradle project or Maven module requesting the dependency.
Version The version of Gradle project or Maven module requesting the dependency.
Dependency group id The Group ID of the dependency.
Dependency artifact id The Artifact ID of the dependency.
Dependency version The version of the dependency.
Direct Dependency When true the project directly depends on the dependency. When false the project depends on the dependency transitively through at least one direct dependency.

Usage

This recipe has required configuration parameters. Recipes with required configuration parameters cannot be activated directly. To activate this recipe you must create a new recipe which fills in the required parameters. In your rewrite.yml create a new recipe with a unique name. For example: com.yourorg.DependencyListExample. Here's how you can define and customize such a recipe within your rewrite.yml:

{% code title="rewrite.yml" %}

---
type: specs.openrewrite.org/v1beta/recipe
name: com.yourorg.DependencyListExample
displayName: Dependency report example
recipeList:
  - org.openrewrite.java.dependencies.DependencyList:
      scope: Compile
      includeTransitive: true

{% endcode %}

Now that com.yourorg.DependencyListExample has been defined activate it and take a dependency on org.openrewrite.recipe:rewrite-java-dependencies:1.0.1 in your build file: {% tabs %} {% tab title="Gradle" %} {% code title="build.gradle" %}

plugins {
    id("org.openrewrite.rewrite") version("6.1.4")
}

rewrite {
    activeRecipe("com.yourorg.DependencyListExample")
}

repositories {
    mavenCentral()
}

dependencies {
    rewrite("org.openrewrite.recipe:rewrite-java-dependencies:1.0.1")
}

{% endcode %} {% endtab %} {% tab title="Maven" %} {% code title="pom.xml" %}

<project>
  <build>
    <plugins>
      <plugin>
        <groupId>org.openrewrite.maven</groupId>
        <artifactId>rewrite-maven-plugin</artifactId>
        <version>5.2.4</version>
        <configuration>
          <activeRecipes>
            <recipe>com.yourorg.DependencyListExample</recipe>
          </activeRecipes>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>org.openrewrite.recipe</groupId>
            <artifactId>rewrite-java-dependencies</artifactId>
            <version>1.0.1</version>
          </dependency>
        </dependencies>
      </plugin>
    </plugins>
  </build>
</project>

{% endcode %} {% endtab %} {% endtabs %}

Contributors

See how this recipe works across multiple open-source repositories

Moderne Link Image

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.