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

Documentation support is weak. #167

Closed
reduxdj opened this issue May 3, 2022 · 4 comments
Closed

Documentation support is weak. #167

reduxdj opened this issue May 3, 2022 · 4 comments
Labels
type: documentation Documentation updates

Comments

@reduxdj
Copy link

reduxdj commented May 3, 2022

It would be nice to consider making the documentation better. If you are new to SpringBoot, this project is a minefield of broken dependencies, assumptions and the examples are kind of broken out of the box.

If you are trying to consider this as a pitch for companies to go federated, you might consider trying to get one of your own junior devs to try to set this project up and then see how many times they have to slack you for information that's assumed or simply doesn't work out of the box.

This is library is really frustrating...

mvn -pl spring-example spring-boot:run -Dspring-boot.run.profiles=graphql-java-tools

May 04, 2022 11:19:29 AM com.diffplug.spotless.FormatExceptionPolicyLegacy error
SEVERE: Step 'removeUnusedImports' found problem in 'src/main/java/com/apollographql/federation/graphqljava/tracing/HTTPRequestHeaders.java':
null
java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:119)
	at java.base/java.lang.reflect.Method.invoke(Method.java:577)
	at com.diffplug.spotless.java.GoogleJavaFormatStep$State.lambda$constructRemoveUnusedFunction$3(GoogleJavaFormatStep.java:190)
	at com.diffplug.spotless.java.GoogleJavaFormatStep$State.lambda$createRemoveUnusedImportsOnly$1(GoogleJavaFormatStep.java:167)
	at com.diffplug.spotless.FormatterFunc.apply(FormatterFunc.java:32)
	at com.diffplug.spotless.FormatterStepImpl$Standard.format(FormatterStepImpl.java:78)
	at com.diffplug.spotless.FormatterStep$Strict.format(FormatterStep.java:76)
	at com.diffplug.spotless.Formatter.compute(Formatter.java:230)
	at com.diffplug.spotless.PaddedCell.calculateDirtyState(PaddedCell.java:201)
	at com.diffplug.spotless.PaddedCell.calculateDirtyState(PaddedCell.java:188)
	at com.diffplug.spotless.maven.SpotlessCheckMojo.process(SpotlessCheckMojo.java:52)
	at com.diffplug.spotless.maven.AbstractSpotlessMojo.execute(AbstractSpotlessMojo.java:150)
	at com.diffplug.spotless.maven.AbstractSpotlessMojo.execute(AbstractSpotlessMojo.java:141)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
	at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:301)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:211)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:165)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:157)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:121)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:127)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:294)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:960)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:293)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:196)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	at java.base/java.lang.reflect.Method.invoke(Method.java:577)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
Caused by: java.lang.IllegalAccessError: class com.google.googlejavaformat.java.RemoveUnusedImports (in unnamed module @0x7253c53) cannot access class com.sun.tools.javac.util.Context (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.util to unnamed module @0x7253c53
	at com.google.googlejavaformat.java.RemoveUnusedImports.removeUnusedImports(RemoveUnusedImports.java:188)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	... 33 more

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for federation-parent 2.0.0-alpha.6-SNAPSHOT:
[INFO]
[INFO] federation-parent .................................. SUCCESS [  0.578 s]
[INFO] federation-graphql-java-support-api ................ FAILURE [  2.608 s]
[INFO] federation-graphql-java-support .................... SKIPPED
[INFO] federation-spring-example .......................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.519 s
[INFO] Finished at: 2022-05-04T11:19:29-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.diffplug.spotless:spotless-maven-plugin:2.12.2:check (default) on project federation-graphql-java-support-api: Execution default of goal com.diffplug.spotless:spotless-maven-plugin:2.12.2:check failed: java.lang.reflect.InvocationTargetException: class com.google.googlejavaformat.java.RemoveUnusedImports (in unnamed module @0x7253c53) cannot access class com.sun.tools.javac.util.Context (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.util to unnamed module @0x7253c53 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :federation-graphql-java-support-api

For example: import mdg.engine.proto.Reports;
is a dependency that won't even resolve when trying to use eclipse and build the project that way.

Thanks for your time.

@martinbonnin
Copy link
Contributor

martinbonnin commented May 4, 2022

Hi 👋 Thanks for sending this and sorry for the issues!

I 100% agree that the documentation should be improved. I'm myself coming from a Gradle background and it took me a while to get used to the different projects and conventions here.

About some specific issues:

Caused by: java.lang.IllegalAccessError: class com.google.googlejavaformat.java.RemoveUnusedImports

You just bumped into diffplug/spotless#834. This thread is long and I haven't processed all of it. All in all, my personal experience with spotless isn't great so far. Most of the times it gets in the way more than it helps so I wouldn't be against ditching it altogether but until there's a decision on that, I opened #169 as a follow up.

In the short term, you can downgrade your JDK to something < 16 and it should do the job.

mdg.engine.proto.Reports; is a dependency that won't even resolve when trying to use eclipse and build the project that way.

This is happening because Reports.java is a generated file from the protobuf maven plugin. If you build the project from the command line (./mvnw test-compile), it should be create the file and the class should be found.

I'm not sure there's a good solution for that one. Checking Reports.java in source control isn't great because it duplicates the .proto files. You could try to open the project in IntelliJ but it'll most likely going to be the same issue. IntelliJ might have a plugin that generates code on the fly but I'm unsure this is a thing with eclipse. In all cases, building the project once should make the error disappear.

Overall, and as we move towards a Federation2 release, I'm hoping the documentation and sample code can be updated so that the initial onboarding is better. Until then feel free to comment on this issue and we can investigate any issue you have setting up your project.

@reduxdj
Copy link
Author

reduxdj commented May 9, 2022

Thanks. I appreciate the thoughtful response. I was frustrated because we did this as a POC and had a time box of 3 weeks to see it might be an approach before we got put on to other features. We actually switched out the library to https://netflix.github.io/dgs/ and we've been swimming ever since. We had no pain in setting up that library. It is really easy on the eyes and the documentation is fantastic. Any reason why you haven't combined efforts here? I would assume that Netflix supports 183 million global customers is reason enough to try out their library. Also curious that you don't link to it in apollo documentation in the list of supported federated clients?

@martinbonnin
Copy link
Contributor

That makes a lot of sense. DGS is a nice library and actually it uses federation-jvm under the hood. I guess the main reason why the documentation for federation-jvm is lacking is this exact reason. federation-jvm is a low level library and most users end up using it through a higher level dependency like DGS. This is no excuse of course for not improving documentation.

Also curious that you don't link to it in apollo documentation in the list of supported federated clients?

There is a list of compatible servers at https://www.apollographql.com/docs/federation/other-servers/. It contains DGS (for Federation1, Federation2 coming shortly). But maybe that page was not easy to find? Were you looking into other places?

@dariuszkuc dariuszkuc added the type: documentation Documentation updates label May 27, 2022
@dariuszkuc
Copy link
Member

Hello 👋

federation-jvm is a low level library that other libraries (such as DGS) can built on top to provide higher level abstraction. This is similar approach as taken by graphql-java.

As for the mentioned issues:

If documentation still needs updating, feel free to re-open this issue with additional details.

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

No branches or pull requests

3 participants