Closed KlemenDEV closed 1 year ago
I have also noticed some other parameters are marked as final now and give a warning in eg. IDEA, such as classpath
and jvmOptions
.
Have you tried replacing the deprecated task configuration createExe{...}
with the launch4j{...}
extension?
@KlemenDEV I cannot reproduce this. Could you please add a code snippet or link to the mentioned readme section?
@KlemenDEV I cannot reproduce this. Could you please add a code snippet or link to the mentioned readme section?
Here is the code snippet that one can reproduce this with:
createExe {
copyConfigurable = []
...
}
Have you tried replacing the deprecated task configuration createExe with the launch4j extension?
Yes, I wanted to use "modern" approach and not the legacy method, however, I have tried the following two things:
so seems in this case, classpath and jvmOptions are final and produce warnings which is also probably not ok.
tasks.register<edu.sc.seis.launch4j.tasks.Launch4jLibraryTask>("testTask") {
...
}
but I get the following error:
Could not get unknown property 'register' for task set of type org.gradle.api.internal.tasks.DefaultTaskContainer.
I also tried to import Launch4jLibraryTask like
import edu.sc.seis.launch4j.tasks.Launch4jLibraryTask
but this produces the following error:
unable to resolve class edu.sc.seis.launch4j.tasks.Launch4jLibraryTask
I have also found that I am not the only one having problems with importing or using Launch4jLibraryTask: https://stackoverflow.com/questions/75859510/gradle-launch4j-cant-create-launch4jlibrarytask-due-to-project-afterevaluate-e. The plugin is loaded properly in plugins block and also launch4j and createExe are detected, so there must be something else preventing from importing Launch4jLibraryTask
I have been using 2.5.4 without problems, but in 3.0.0 I just can't find a configuration to make this work. createExe has problem with copyConfigurable, launch4j task with final fields and creating custom Launch4jLibraryTask does not seem to work either.
I guess we will stick with 2.5.4 for now until something is figured out or done on this area.
Being a Property
you should call their methods rather than assigning to it. e.g. jvmOptions.set(…)
I see. I guess we can use method 1. then. Any idea why
unable to resolve class edu.sc.seis.launch4j.tasks.Launch4jLibraryTask
would happen?
Being a Property you should call their methods rather than assigning to it. e.g. jvmOptions.set(…)
launch4j {
...
classpath.set(["./lib/*"])
}
yields exe not working and the following debug log ( --l4j-debug):
Info: Classpath not defined.
So even set does not work
Take a look here how the syntax for creating custom tasks is.
I'll take a look at the warning that IntelliJ shows in your screen grab above. To really help you please submit a runnable and self contained example i.e. a build.gradle file demonstrating the issue you're experiencing.
We should probably add setter methods for the HasMultipleValues<T>
properties.
So here is a demo setup showing the following 3 bugs present in the plugin:
I can also confirm that setting the classpath property yields no effects. Here is what I do:
launch4j {
mainClassName = "com.something..."
classpath.set([
"additional1/*",
"additional2/*"
])
}
When I print the classpath in my main method I see that everything within the libraryDir is included, but I do not see my additional resources.
When I look into the extension I see that the classpath property is not annotated with @Input
, could this be the reason for the property not being mapped?
@KlemenDEV thanks for your example project. All the issues you've found should be fixed as shown in Issue150Test.groovy To create a new LibraryTask in a separate gradle file you have to add the plugin again to the classpath of that file:
buildscript {
repositories{
gradlePluginPortal()
}
dependencies {
classpath 'edu.sc.seis.launch4j:launch4j:3.0.1'
}
}
import edu.sc.seis.launch4j.tasks.Launch4jLibraryTask
tasks.register('createFastStart', Launch4jLibraryTask) {
...
works in your provided example project but fails in the test case as the test environment is not setup to handle this.
Thanks to @etschelp for pointing out the annotation issue. It will be released with the next version 3.0.2, but can be tested now from my artifactory, although I don't see it as a big problem. If you do mind, please open another issue and we'll address it right away.
I just tested this with the 3.0.1 release, and the classpath
property now works as expected. Thanks for fixing this so quickly.
I can also confirm it works fine now and no warning is emitted in IDEA
In the 3.0.0 update,
copyConfigurable = []
generates the following
faultEdit: IntelliJ warning:making it impossible to define custom copyConfigurable and also breaking examples from README.md.