To get started with the Moderne CLI (Command Line Interface)

Shyam Ramath
3 min readMar 6, 2024

--

The step-by-step set-up guide builds the repository using Modern CLI.

The Moderne platform expects to find projects with a git origin & branch, to be able to link back any commits through the platform to your repository

* What to do next

> Run mod run /Users/ameya/Work/Shyam/development/src/github/openrewrite — recipe=<RecipeName>

Modern Cli
— — — — — — — — — -

mod config recipes moderne install <recipe_search_term>
mod config recipes moderne install org.openrewrite.java.search.FindTypes

mod config moderne edit https://app.moderne.io — token mat-YOUR_TOKEN_HERE
mod config moderne edit — token mat-1SPC-4X-5Jy4a2ChzKoNAALNMw3DjbEI https://app.moderne.io

# For JFrog Artifactory
mod config lsts artifacts artifactory edit <repository url> — user=${ARTIFACTS_USER} — password=${ARTIFACTS_PWD} ${ARTIFACT_REPOSITORY_URL}
# For other artifact repositories, such as Sonatype Nexus
mod config lsts artifacts maven edit <repository url> — user=${ARTIFACTS_USER} — password=${ARTIFACTS_PWD} ${ARTIFACT_REPOSITORY_URL}

mod config build maven arguments edit “-Pmdep.skip”
mod config build maven arguments show
mod config build maven arguments delete

mod config build maven arguments show — local ./path/to/your/project
mod config build maven arguments show — local /Users/ameya/Work/Shyam/development/src/github/langchains-project/langchain4j/spring-boot-example
mod config build maven arguments show — local /Users/ameya/Work/Shyam/development/src/github/langchains-project/langchain4j
mod config build maven arguments edit “-Pmdep.skip” — local ./working-set — save

mod build /Users/ameya/Work/Shyam/development/src/github/langchains-project/langchain4j/spring-boot-example
mod build /Users/ameya/Work/Shyam/development/src/github/maven_plugins/maven_dependency_check
mod build — local /Users/ameya/Work/Shyam/development/src/github/openrewrite
mod run /Users/ameya/Work/Shyam/development/src/github/openrewrite — recipe=org.openrewrite.staticanalysis.CommonStaticAnalysis
mod config recipes moderne install org.openrewrite.staticanalysis.CommonStaticAnalysis

mod config recipes yaml install /Users/ameya/Work/Shyam/development/src/github/openrewrite/FindFixVulnerableDependecnyRecipe/src/main/resources/META-INF/rewrite/rewrite.yml

mod run /Users/ameya/Work/Shyam/development/src/github/openrewrite — recipe=org.escuela.tech.DependencyVulnerabilityCheckExample
mod build /Users/ameya/Work/Shyam/development/src/github/langchains-project/langchain4j
mod build /Users/ameya/Work/Shyam/development/src/github/openrewrite

mod run /Users/ameya/Work/Shyam/development/src/github/openrewrite — recipe=OwaspTopTe
mod run /Users/ameya/Work/Shyam/development/src/github/openrewrite — recipe=org.openrewrite.java.security.OwaspTopTen
mod study /Users/ameya/Work/Shyam/development/src/github/openrewrite — last-recipe-run — data-table org.openrewrite.table.RecipeRunStats

mod config recipes moderne install org.openrewrite.staticanalysis.CommonStaticAnalysis
mod config recipes moderne install org.openrewrite.java.search.FindTypes
mod config recipes list

mod study /Users/ameya/Work/Shyam/development/src/github/openrewrite — last-recipe-run — data-table my-test-table
npm install -g diff2html-cli

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
How to install and run a custom recipe in Moderne CLI : mod config recipes yaml install /path/to/yaml
— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
mod config recipes yaml install /Users/ameya/Work/Shyam/development/src/github/openrewrite/FindFixVulnerableDependecnyRecipe/src/main/resources/META-INF/rewrite/rewrite.yml
mod run /Users/ameya/Work/Shyam/development/src/github/openrewrite — recipe=org.escuela.tech.DependencyVulnerabilityCheckExample

mod study /Users/ameya/Work/Shyam/development/src/github/openrewrite — last-recipe-run — data-table org.openrewrite.java.dependencies.table.DependencyListReport
mod study /Users/ameya/Work/Shyam/development/src/github/openrewrite — last-recipe-run — data-table org.openrewrite.java.dependencies.table.VulnerabilityReport
mod study /Users/ameya/Work/Shyam/development/src/github/openrewrite — last-recipe-run — data-table org.openrewrite.table.SourcesFileResults

> Run mod git apply /Users/ameya/Work/Shyam/development/src/github/openrewrite — last-recipe-run to apply the changes
> Run mod git apply /Users/ameya/Work/Shyam/development/src/github/openrewrite — recipe-run 20240306144120-hWqtA to apply the changes
— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —

mod config recipes moderne install org.openrewrite.java.search.FindMethods
mod run /Users/ameya/Work/Shyam/development/src/github/openrewrite — recipe=org.openrewrite.java.search.FindMethods
mod study /Users/ameya/Work/Shyam/development/src/github/openrewrite — last-recipe-run — data-table org.openrewrite.table.SourcesFileErrors

--

--

No responses yet