Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for custom JSR-223 based formatters #945

Merged
merged 1 commit into from
Sep 27, 2021

Conversation

tisoft
Copy link
Contributor

@tisoft tisoft commented Sep 23, 2021

Added support for custom JSR-223 based formatters in Maven.

<jsr223> <!-- specify replacements using JSR223 scripting -->
  <name>Greetings to Mars</name>
  <engine>nashorn</engine>
  <script>source.replace('World','Mars');</script>
</jsr223>

Allows an end user to create arbitrary custom formatters inside the pom. Javascript is supported by the "nashorn" engine provided by the JDK. Other engines can be used, if they are in the classpath.

@tisoft
Copy link
Contributor Author

tisoft commented Sep 23, 2021

Note: I didn't implement this for grade, since the custom step is available there. If you want this step also available in the gradle plugin, I can add it there, too.

@nedtwigg
Copy link
Member

I think this is great, and I agree it makes sense to keep it maven-only. Only thing missing imo is that it needs a changelog entry in the root CHANGES.md too.

@tisoft tisoft force-pushed the jsr223 branch 2 times, most recently from aa5019e to b6ea481 Compare September 26, 2021 07:21
@tisoft
Copy link
Contributor Author

tisoft commented Sep 26, 2021

  • Updated root CHANGES.md
  • Load script engine from JarState
  • Added test for using a JSR-223 from a dependency

@nedtwigg
Copy link
Member

Please merge the latest origin/main into this PR. That should fix CI, at which point I can merge and release.

@nedtwigg
Copy link
Member

I went ahead and merged origin/main for you. Looks like the test failure is real.

https://app.circleci.com/pipelines/github/diffplug/spotless/1259/workflows/d151483f-7468-4aed-89fa-c2fcd9a2718c/jobs/7153/tests#failed-test-0

@tisoft
Copy link
Contributor Author

tisoft commented Sep 27, 2021

I'll have a look

@tisoft
Copy link
Contributor Author

tisoft commented Sep 27, 2021

Rebased and fixed the test failure. The new test failure seems to be unrelated.

@nedtwigg nedtwigg merged commit a9e8357 into diffplug:main Sep 27, 2021
@nedtwigg
Copy link
Member

Want me to cut a release now, or should I wait until POM sorting gets merged too?

@tisoft
Copy link
Contributor Author

tisoft commented Sep 27, 2021

I'll have a go at the pom sorting, no need for a new release for me.

@tisoft tisoft deleted the jsr223 branch September 27, 2021 20:06
@nedtwigg
Copy link
Member

Released in plugin-maven 2.15.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants