TheBoegl / gradle-launch4j

A gradle-plugin to create windows executables with launch4j
Apache License 2.0
305 stars 42 forks source link

Unable to use empty `libraryDir` with latest version #153

Closed thc202 closed 1 year ago

thc202 commented 1 year ago

In previous versions (e.g. 2.5.4) it was possible to use an empty name for the libraryDir. In version 3.0.3 it leads to an error:

Caused by: java.lang.IllegalArgumentException: path may not be null or empty string. path=''
        at org.gradle.api.internal.file.AbstractBaseDirFileResolver.doResolve(AbstractBaseDirFileResolver.java:59)
        at org.gradle.api.internal.file.AbstractFileResolver.resolve(AbstractFileResolver.java:74)
        at org.gradle.api.internal.file.AbstractFileResolver.resolve(AbstractFileResolver.java:48)
        at org.gradle.api.internal.file.DefaultFilePropertyFactory$FixedDirectory.file(DefaultFilePropertyFactory.java:129)
        at org.gradle.api.internal.file.DefaultFilePropertyFactory$DefaultDirectoryVar.lambda$file$1(DefaultFilePropertyFactory.java:361)
        at org.gradle.api.internal.provider.BiProvider.calculateOwnValue(BiProvider.java:73)
        at org.gradle.api.internal.provider.AbstractMinimalProvider.calculateOwnPresentValue(AbstractMinimalProvider.java:72)
        at org.gradle.api.internal.provider.AbstractMinimalProvider.get(AbstractMinimalProvider.java:92)
        at org.gradle.api.provider.Provider$get$0.call(Unknown Source)
        at edu.sc.seis.launch4j.tasks.DefaultLaunch4jTask.copyLibraries(DefaultLaunch4jTask.groovy:335)
        at edu.sc.seis.launch4j.tasks.DefaultLaunch4jTask$copyLibraries$0.callCurrent(Unknown Source)
        at edu.sc.seis.launch4j.tasks.Launch4jLibraryTask.run(Launch4jLibraryTask.groovy:47)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

We are specifying an empty name because the JAR file is in the same directory as the executable. Is this no longer supported or a bug?

TheBoegl commented 1 year ago

That seems like another bug introduced with the refactorings to use gradle providers and properties.

TheBoegl commented 1 year ago

@thc202, does it work if you use libraryDir = '.'? If so, is this ok to use as a workaround or would you appreciate the plugin changing it to that for you?

thc202 commented 1 year ago

It does, thank you! I should have tried that… The only difference is that it sets the chdir property to . (while before it would be left empty), but that's fine.

Edit: Setting the chdir to an empty value prevents the above difference.