Skip to content
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

Exception when executing with --info #36

Open
inidona opened this issue Jun 23, 2021 · 4 comments
Open

Exception when executing with --info #36

inidona opened this issue Jun 23, 2021 · 4 comments

Comments

@inidona
Copy link

inidona commented Jun 23, 2021

I got the following exception when running the generation with --info switch enabled.
Without --info generation works as expected.
I am using the version 2.0.0 of your plugin.

I looks like the error is in the logging line at
AbstractXjcGeneratorWorkAction.kt:159)

thanks
andreas

Caused by: org.gradle.workers.internal.DefaultWorkerExecutor$WorkExecutionException: A failure occurred while executing org.unbrokendome.gradle.plugins.xjc.work.xjc23.XjcGeneratorWorkAction

Caused by: org.gradle.api.internal.provider.MissingValueException: Cannot query the value of this property because it has no value available.
at org.gradle.api.internal.provider.AbstractMinimalProvider.get(AbstractMinimalProvider.java:86)
at org.unbrokendome.gradle.plugins.xjc.work.common.AbstractXjcGeneratorWorkAction.buildOptions(AbstractXjcGeneratorWorkAction.kt:159)
at org.unbrokendome.gradle.plugins.xjc.work.common.AbstractXjcGeneratorWorkAction.execute(AbstractXjcGeneratorWorkAction.kt:31)
at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:63)
at org.gradle.workers.internal.AbstractClassLoaderWorker$1.create(AbstractClassLoaderWorker.java:49)
at org.gradle.workers.internal.AbstractClassLoaderWorker$1.create(AbstractClassLoaderWorker.java:43)
at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:97)
at org.gradle.workers.internal.AbstractClassLoaderWorker.executeInClassLoader(AbstractClassLoaderWorker.java:43)
at org.gradle.workers.internal.IsolatedClassloaderWorker.run(IsolatedClassloaderWorker.java:49)
at org.gradle.workers.internal.IsolatedClassloaderWorker.run(IsolatedClassloaderWorker.java:30)

@dlmiles
Copy link

dlmiles commented Mar 8, 2023

Any other details ? Which Gradle version ? Do you have a basic build.gradle project that can reproduce this exception.

@kosten27
Copy link

kosten27 commented Feb 5, 2024

I encountered the same issue after performing the following upgrades:

org.unbroken-dome.xjc: 1.4.3 -> 2.0.0
Gradle: 6.4.1 -> 8.5
JDK: 11 -> 21
I have two tasks xjcGenerate and a custom task xjcGenerate2.

Issue:
Execution failed for task ':xjcGenerate2'.
A failure occurred while executing org.unbrokendome.gradle.plugins.xjc.work.xjc30.XjcGeneratorWorkAction.
Cannot query the value of this property because it has no value available.

As mentioned by @inidona, the error is in the logging line at AbstractXjcGeneratorWorkAction.kt:159. parameters.catalogResolvedArtifacts is null, therefore parameters.catalogResolvedArtifacts.get() throws the NPE.

There is a workaround for this issue by adding catalogResolutionClasspath = sourceSets.main.compileClasspath in the custom xjcGenerate2 task.

@dlmiles
Copy link

dlmiles commented Feb 5, 2024

If you did not have that custom task, does it run and run without error? even if the extra task was not executed, the introduction (default initialization) of the custom XJC Plugin task is necessary to trigger the problem ?

Can you share the XJC plugin parts of your gradle.build file ? Maybe it needs to initialize to an empty collection (original reporter indicates the fatal error only occurs with --info which I assume is a logging matter), or inherit a value, or default to the current sourceSets ("main" in the example you presented) and lookup the relevant "compileClasspath" collection. Does your project also work as expected if you initialize it to an empty collection ?

If you are able to share gradle.build fragment please describe the intention being achieved, so that is clear to all.

Thanks

@kosten27
Copy link

`xjcGenerate {
source = fileTree("$projectDir/build/resources/generator/xsd") {
include 'REQUEST.xsd'
}
outputDirectory = file("$rootDir/src/generated-sources/jaxb")
extraArgs = ["-Xfluent-api", "-Xsetters", "-Xvalue-constructor", "-Xsimplify"]
targetPackage = "com.domain.project.dto.request"
doLast {
copy {
from "$rootDir/src/generated-sources/jaxb"
into file("$rootDir/src/generated-sources/dummyjaxb")
}
}
}

tasks.register('xjcGenerate2', XjcGenerate) {
source = fileTree("$projectDir/build/resources/generator/xsd") {
include 'RESPONSE.xsd'
}
bindingFiles = fileTree("$projectDir/src/main/resources/bindings") { include 'bindings.xjb' }
outputDirectory = file("$rootDir/src/generated-sources/jaxb")
extraArgs = ["-Xfluent-api", "-Xsetters", "-Xvalue-constructor", "-Xsimplify"]
targetPackage = "com.domain.project.dto.response"
catalogResolutionClasspath = sourceSets.main.compileClasspath
}`

It works fine without this custom task even if this task wasn't executed.
The catalogResolutionClasspath property expects a value of type org.gradle.api.artifacts.Configuration, so it can't consume an empty collection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants