Class GraphQLMojo

All Implemented Interfaces:
CommonConfiguration, GenerateClientCodeConfiguration, GenerateCodeCommonConfiguration, GenerateServerCodeConfiguration, GraphQLConfiguration, org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

@Mojo(name="graphql", defaultPhase=GENERATE_SOURCES, requiresProject=true) @ThreadSafe public class GraphQLMojo extends AbstractGraphQLMojo

This goal is deprecated. The graphql goal generates the java code from one or more GraphQL schemas. It allows to work in Java with graphQL, in a schema first approach.

It will be maintained in the future 2.x versions. The generateClientCode and generateServerCode should be used instead.
The graphql goal has two main modes:
  • client mode: it does the same jobs as the generateClientCode goal. It generates a class for each query, mutation and subscription type. These classes contain the methods to call the queries, mutations and subscriptions. That is: to execute a query against the GraphQL server, you just have to call one of this method. It also generates the POJOs from the GraphQL schema. The GraphQL response is stored in these POJOs, for an easy and standard use in Java.
  • server mode: it does the same jobs as the generateServerCode goal. It generates the whole heart of the GraphQL server. The developer has only to develop request to the data. That is the main method (in a jar project) or the main server (in a war project), and all the Spring wiring, based on graphql-java-spring, itself being build on top of graphql-java. It also generates the POJOs. An option allows to annotate them with the standard JPA annotations, to make it easy to link with a database. This goal generates the interfaces for the DataFetchersDelegate (often named providers) that the server needs to implement
Author:
etienne-sf
  • Constructor Details

    • GraphQLMojo

      public GraphQLMojo()