jbang icon indicating copy to clipboard operation
jbang copied to clipboard

Resolution of <script> files by jbang-maven-plugin in multimodule projects

Open tombentley opened this issue 5 months ago • 3 comments

Describe the bug

When using the jbang-maven-plugin in a submodule of a multi-module maven project the <configuration>/<script> is resolved relative to the cwd of the mvn process, not relative to the submodule's pom.xml.

To Reproduce

  1. Create a multimaven project, with subproject foo.
  2. In ./foo/pom.ml configure the jbang plugin with a <script>my_script.java</script>
  3. Create ./foo/my_script.java,
  4. Invoke mvn from the root project and observe that the script is not found by the plugin.
  5. Move the script to the root project mv ./foo/my_script.java .
  6. Invoke mvn from the root project and observe that the script is now found by the plugin.

Expected behavior

Usually file references within a pom.xml are relative to that pom.xml

JBang version

$ jbang version --verbose
[jbang] [0:188] jbang version 0.126.2

and

<groupId>dev.jbang</groupId>
<artifactId>jbang-maven-plugin</artifactId>
<version>0.0.7</version>

Additional context

While you can work around problem of finding the script using maven properties, like <script>${project.basedir}/my_script.java</script>, any filename arguments given to the script will likewise be resolved relative to the maven process cwd.

tombentley avatar Jun 12 '25 23:06 tombentley

Hi @tombentley , long time no see :-)

Btw, I'm guessing this issue is better opened here https://github.com/jbangdev/jbang-maven-plugin , because I don't think it's an issue with JBang itself.

quintesse avatar Jun 13 '25 11:06 quintesse

Hi @quintesse, it has been a while indeed!

I would have opened the issue in that repo (it was the first place I looked), but it doesn't appear to have issues enabled.

I found a few issues here about the maven plugin, so figured this was the place.

tombentley avatar Jun 13 '25 17:06 tombentley

Hmm that's weird. Is that on purpose @maxandersen or should we enable the issues?

quintesse avatar Jun 15 '25 20:06 quintesse