moderneinc / rewrite-recipe-starter

A forkable starter for building your own recipes and deploying them on the Moderne SaaS
26 stars 52 forks source link

Avoid unintentionally bundling with JUnit 3 → disable copy plugin by default #57

Closed Philzen closed 3 months ago

Philzen commented 3 months ago

After having applied the latest updates to my project, i was surprised finding a JUnit 3 jar in src/main/resources/META-INF/rewrite/classpath/ (blast from the past :laughing: ).

If not actively removed this:

  1. increases the compiled project's JAR by ~400 % (in my case it went from ~20Kb to ~127Kb)
  2. adds a legacy dependency to the classpath that most probably most consumers of the starter template won't need
  3. would increase the likelihood that the JUnit3 JAR accidentally gets added to the repo on git add .

Therefore i propose to keep the copy plugin disabled by default, as this makes for a better DX when traded off against the above points.

Point 3. begs the question whether src/main/resources/META-INF/rewrite/classpath/ shouldn't also be added to .gitignore?

timtebeek commented 3 months ago

Thanks for the feedback! This was intentionally added as an example in

I've updated the PR to make it clear what the plugin adds, and when to enable the plugin, as junit:junit isn't used by default.

Had doubted to add a link to the docs there; but at the very least the docs could point out how to configure this with Maven and point here. https://docs.openrewrite.org/authoring-recipes/modifying-methods-with-javatemplate#add-parameters-to-setcustomerinfo https://docs.openrewrite.org/authoring-recipes/multiple-versions