Closed rafalskalny closed 9 months ago
Hello,
Thank you for the detailed analysis.
I'm still surprised that I didn't encounter this in all the existing integration tests.
Of course, I'll delivered that.
In the meanwhile, can you check the workaround that I suggested in the #184 ?
Etienne
Hi,
Thank you for your response.
Unfortunately, the workaround you mentioned does not work for me. The scalar classes (e.g. record CustomerId
) that are referenced in graphql schema files (e.g. scalar CustomerId
) are part of the same maven project where the graphql-maven-plugin is executed to generate model classes. Since both are in the same Maven project, the artifact containing the scalar classes obviously hasn't been built yet when the plugin generates the model classes - it is impossible to reference an artifact that hasn't been built yet.
For it to work in my case, the plugin would have to add all classes from the `src/main/java' directory to the classpath. This is not a perfect approach, however, as it gets very complicated when it comes to implementing support for multi-module Maven projects.
I have to wait for the fix to be released.
Cheers Rafal
Hello,
The correction for this issue has been released the 2.3 version. I'll see to add it into the 1.x version
Correction available in 2.3 and 1.18.12 versions.
Hey,
we are using graphql-maven-plugin 1.x to generate java model classes from graphqls files.
We have custom scalars defined with our custom classes, e.g.:
and the java class which backs the scalar is:
Unfortunately the generation of the java classes stopped working for us when version
1.18.10
was released. The reason for this is this commit: https://github.com/graphql-java-generator/graphql-maven-plugin-project/commit/cb0ad28b#diff-ddaf51417f6600ca7ae82284e8c0b25bded77c66552242f6083382fad4325ee2 and the change to thecom.graphql_java_generator.util.GraphqlUtils#getPackageName
method. The reason the generation does not work any more is because theClass<?> cls = Class.forName(classFullName);
code fromcom.graphql_java_generator.util.GraphqlUtils#getPackageName
is not able to loadCustomerId
class from the project (theCustomerId
class is not a JDK class).If the current code:
gets replaced with:
then the class generation with my custom scalars gets fixed.
Could you please apply this change to both 1.x and 2.x versions of the plugin?
Thanks