-
Notifications
You must be signed in to change notification settings - Fork 6
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
Incompatibility with Micronaut Application plugin #7
Comments
I was able to reproduce on my Windows 10 machine with the following: plugins {
id("io.mateo.cxf-codegen") version "1.0.0-rc.3"
id("io.micronaut.application") version "1.3.4"
}
repositories {
mavenCentral()
// https://github.com/grails/grails-core/issues/11825
maven {
url = uri("https://repo.grails.org/artifactory/core")
}
}
dependencies {
cxfCodegen("jakarta.xml.ws:jakarta.xml.ws-api:2.3.3")
cxfCodegen("jakarta.annotation:jakarta.annotation-api:1.3.5")
}
application {
mainClass.set("com.example.Example")
}
cxfCodegen {
wsdl2java {
register("gps") {
wsdl.set(file("src/main/resources/wsdl/service.wsdl"))
}
}
} If you remove the Micronaut plugin, it works: plugins {
id("io.mateo.cxf-codegen") version "1.0.0-rc.3"
- id("io.micronaut.application") version "1.3.4"
} I have not worked with Micronaut so I will need to investigate what the various Micronaut plugins are doing to cause the From my brief testing, you do not need to execute any |
I will try this again later. I wonder if it works if the cxf plugin is after the micronaut plugin? It's worth a try, if this is a problem in micronaut, I will happily log the issue there. |
I think I narrowed it down to these lines from More specifically this line: https://github.com/micronaut-projects/micronaut-gradle-plugin/blob/v1.5.1/src/main/java/io/micronaut/gradle/MicronautApplicationPlugin.java#L109 tasks.withType(JavaExec.class, javaExec -> { ... }) That is equivalent to: tasks.withType(JavaExec.class).all(...) What I think is happening is that the Micronaut Application plugin is causing the wsdl2java tasks to be realized. Per the Gradle docs (point 7):
Since the Micronaut Application plugin is targeting all With all of that said, my testing was as follows:
- tasks.withType(JavaExec.class, javaExec -> { ... })
+ tasks.withType(JavaExec.class).configureEach(javaExec -> { ... })
IMO, the Micronaut Application plugin should be more selective as to which However, I think it is unfair to place the issue solely on Micronaut here. There may be an issue within the cxf-codegen plugin that I am not seeing. I'll need to put together a build scan to get deeper insights as noted in the troubleshooting docs |
I think I may have a fix: @@ -101,7 +101,10 @@ public class CxfCodegenPlugin implements Plugin<Project> {
task.setClasspath(configuration.get());
task.setGroup(WSDL2JAVA_GROUP);
task.setDescription("Generates Java sources for '" + option.getName() + "'");
- task.setArgs(option.generateArgs());
+ // Generate arguments at the very last moment to avoid realization issues.
+ task.doFirst("generateArgsFor" + name, (exec) -> {
+ ((Wsdl2JavaTask) exec).setArgs(option.generateArgs());
+ });
});
});
} My brief testing shows that this works with the Micronaut Application plugin. I am also not sure if this should be considered a bug or an enhancement |
Thanks, that looks awesome, especially as I was thinking the issue might actually be with the micronaut plugin |
…sks in extension Calling setArgs in a task action makes the whole action have no inputs during configuration time, which leads to the task always being up to date. To prevent realization issues (ciscoo#7), the tasks are defined in the extension when the container is configured, so realizing them at any point should just work (as they have all the arguments set right away).
Unfortunately the fix for this will need to be reverted since it had undesired consequences. Trying to resolve #13 leads to the same issue as this one, so the fix isn't really a fix. |
Where:
Build file 'D:\Development\Projects\Zilch\issuer-service\build.gradle' line: 121
build.gradle has:
and later on:
The property seems present and correct.
The text was updated successfully, but these errors were encountered: