brianm/really-executable-jars-maven-plugin

scriptFile needs to be in the shaded jar but README suggests otherwise

tomdz opened this issue · 7 comments

tomdz commented

The README suggests that the scriptFile can be some file somewhere in the project (src/packaging/someScript.extension) but actually it currently has to be in the shaded jar (https://github.com/brianm/really-executable-jars-maven-plugin/blob/master/src/main/java/org/skife/waffles/ReallyExecutableJarMojo.java#L169-170).
Either the README should be updated or the plugin should use file resolution instead of the classloader.

Ah, looks like someone changed the behavior at some point.

My tendency would be to make it part of the project -- do you have a preference?

tomdz commented

I'd prefer it to be a plain path. You can always point it to src/main/resources/... and usually there is no reason to include the script as a file in the jar.

With the latest release version (1.4.0), I encounter this issue too. I understand too that the readme said that the configured script file is a direct path.
If the file cannot be found in the constructed jar, a NullPointerException occurs here because of the null InputStream scriptIn variable.

Stack trace:

Caused by: java.lang.NullPointerException
        at java.io.Reader.<init>(Reader.java:78)
        at java.io.InputStreamReader.<init>(InputStreamReader.java:72)
        at org.codehaus.plexus.util.IOUtil.copy(IOUtil.java:248)
        at org.codehaus.plexus.util.IOUtil.toString(IOUtil.java:307)
        at org.codehaus.plexus.util.IOUtil.toString(IOUtil.java:295)
        at org.skife.waffles.ReallyExecutableJarMojo.makeExecutable(ReallyExecutableJarMojo.java:172)
        at org.skife.waffles.ReallyExecutableJarMojo.execute(ReallyExecutableJarMojo.java:129)

If the script must be read in the constructed jar, a log and null check may be added.

Makes sense to me that way to, let me fix right now!

Can you check this for me? If it looks good, will merge and release.

Released 1.4.1, is up on oss.s.o and should sync to central before long.

Nice! Tested with version 1.4.1 release plugin from the central repository and it works fine (build ok and jar tests ok).