openrewrite / openrewrite/rewrite

Add something like `JavaParser.dependsOn` for Maven recipes tests or a way to bypass dependency checks

Open
#3,216 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement maven
Dominant language
Java
Stars
3.7k
Forks
570
Avg merge
13h 12m
Merged PRs (30d)
261

Description

I was trying to write a recipe test for a recipe involving an artifactId change using ChangeDependencyGroupIdAndArtifactId recipe.

My problem is that new artifactId is not released yet, so it's not downloadable from any repo (company repo in this case) yet. Additionally, to be able to download from our company maven repository, I guess I need to specify -Dorg.openrewrite.test.readMavenSettingsFromDisk and so on...

Would it be possible to add something like JavaParser.dependsOn to avoid needing to really download any dependency from any repo and work fully offline for tests? Or just a way to disable any dependency check and just work with pom.xml as an agnostic XML file?

What is more weird for me is that the recipe works 100% OK when launched on a real project, so there is no dependency download there and the final pom.xml will have the new artifactId in place, pointing to a not downloadable dependency. No problem for this, openRewrite did the job ok.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Maven recipe test setup involving ChangeDependencyGroupIdAndArtifactId and compare it with JavaParser.dependsOn. Investigate how dependency checks and Maven settings are applied in tests, then determine whether an offline bypass or agnostic pom.xml mode can support an unreleased artifactId. Done means the recipe test runs without downloading the unavailable dependency and still verifies the updated pom.xml.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.