Closed kaymanov-emitter closed 3 years ago
Hello,
My opinion is that it's not a good idea to move the generated sources into the src folder: these files are the product of the build, and as such, they should remain in the build folder.
But you do what you want of course! :)
And yes, it's in the documentation pages. All the plugin goal/tasks are documented, thanks to maven tools. It's available here: https://graphql-maven-plugin-project.graphql-java-generator.com/graphql-maven-plugin/plugin-info.html
Oups, I missed my copy/paste in the first version of thi answer (the link is correct). Take care of this parameter name:
The parameter you're looking for is targetSourceFolder
Etienne
I think you're right after all, the generated files should stay in the /build
directory.
I do have an issue using this plugin however with the following error when running ./gradlew build
:
* What went wrong:
Execution failed for task ':bootJar'.
> Unsupported api 17301504
My bootJar task isn't doing anything special though:
bootJar {
archiveFileName = "${rootProject.name}.${version}.${archiveExtension.get()}"
}
This error happens when I add the plugin to gradle and try to run a full build. Without it the build works fine.
Have you come across this specific error before? I have tried this using Gradle 7.0.0 and 6.8.2. Will try with some older versions tomorrow.
No, I never encountered this error. It seems to be related to bootJar, not to the graphql plugin, correct ?
There is probably a mismatch in dependency versions, somewhere. What spring and spring boot version are you using ?
Perhaps this post can help ?
I have managed to track the problem down to a the combination of this plugin when used with Spring Boot. The bootJar task of Spring fails when this plugin is activated along side it.
I'll investigate further.
It seems that upgrading the Gradle Spring Boot plugin from 2.3.10 -> 2.5.0 has resolved the issue, but it's not clear why just yet.
I'll read over the changelog on Monday and try to pin down the exact fix.
You can probably mark this as closed now though. Thanks for your help!
Hello,
I am trying out your plugin and it seems great so far but I have this one issue that I'm unable to resolve by looking through your examples.
In my project I only have some client setup like so:
And the generated files always end up in
/build/generated/generateClientCode/
.Is it possible to change the target directory of the generated client code directly into
/src/main/java/myapp/
?I want to do this to avoid having to move the generated files into the /src/ folder every time I generate code from a new schema, and would prefer to keep the gradle
/build/
folder free of Java source files.Apologies if this has already been answered in your documentation.