{"id":14975980,"url":"https://github.com/aoudiamoncef/apollo-client-maven-plugin","last_synced_at":"2025-10-02T07:30:37.452Z","repository":{"id":35952521,"uuid":"167633284","full_name":"aoudiamoncef/apollo-client-maven-plugin","owner":"aoudiamoncef","description":"Generate a Java/Kotlin GraphQL client based on introspection data and predefined queries.","archived":false,"fork":true,"pushed_at":"2024-11-20T21:56:44.000Z","size":342,"stargazers_count":92,"open_issues_count":4,"forks_count":28,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-12-02T23:07:44.150Z","etag":null,"topics":["apollo","apollo-client","apollographql","graphql","graphql-client","graphql-java","graphql-query-builder","graphql-tools","maven-plugin","query-builder","query-generator"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"Cox-Automotive/apollo-client-maven-plugin","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aoudiamoncef.png","metadata":{"files":{"readme":"README.adoc","changelog":null,"contributing":"CONTRIBUTING.adoc","funding":null,"license":"COPYING","code_of_conduct":"CODE_OF_CONDUCT.adoc","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-26T00:42:56.000Z","updated_at":"2024-11-20T21:56:49.000Z","dependencies_parsed_at":"2023-01-16T23:31:07.888Z","dependency_job_id":null,"html_url":"https://github.com/aoudiamoncef/apollo-client-maven-plugin","commit_stats":null,"previous_names":[],"tags_count":43,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aoudiamoncef%2Fapollo-client-maven-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aoudiamoncef%2Fapollo-client-maven-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aoudiamoncef%2Fapollo-client-maven-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aoudiamoncef%2Fapollo-client-maven-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aoudiamoncef","download_url":"https://codeload.github.com/aoudiamoncef/apollo-client-maven-plugin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234952006,"owners_count":18912501,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apollo","apollo-client","apollographql","graphql","graphql-client","graphql-java","graphql-query-builder","graphql-tools","maven-plugin","query-builder","query-generator"],"created_at":"2024-09-24T13:53:04.904Z","updated_at":"2025-10-02T07:30:32.170Z","avatar_url":"https://github.com/aoudiamoncef.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"= Apollo GraphQL Client Code Generation Maven Plugin\n\n:project-owner:      aoudiamoncef\n:project-name:       apollo-client-maven-plugin\n:project-groupId:    com.github.aoudiamoncef\n:project-artifactId: apollo-client-maven-plugin-parent\n:project-version:    7.0.0\n\nimage:https://github.com/{project-owner}/{project-name}/workflows/Build/badge.svg[\"Build Status\",link=\"https://github.com/{project-owner}/{project-name}/actions\"]\nimage:https://img.shields.io/maven-central/v/{project-groupId}/{project-artifactId}.svg[Download,link=\"https://search.maven.org/#search|ga|1|g:{project-groupId} AND a:{project-artifactId}\"]\nimage:https://snyk.io/test/github/{project-owner}/{project-name}/badge.svg[Known Vulnerabilities,link=https://snyk.io/test/github/{project-owner}/{project-name}]\nimage:https://img.shields.io/badge/License-MIT-yellow.svg[License: MIT,link=https://opensource.org/licenses/MIT]\n\nMaven plugin that calls the https://github.com/apollographql/apollo-kotlin[Apollo Kotlin compiler] to generate your Java/Kotlin sources.\n\n== Usage\n\n* A simple usage example can be found in https://github.com/{project-owner}/{project-name}/tree/main/apollo-client-maven-plugin-tests[plugin tests].\n\n* A complete project with https://github.com/{project-owner}/spring-boot-apollo-graphql[Spring Boot].\n\n=== Apollo 2 support\n\n* Go to support https://github.com/aoudiamoncef/apollo-client-maven-plugin/tree/support/apollo-2[branch].\n\n=== Getting Started\n\n. Add the apollo runtime library to your project's dependencies:\n+\n[source,xml]\n----\n\u003cdependencies\u003e\n   \u003cdependency\u003e\n       \u003cgroupId\u003ecom.apollographql.apollo3\u003c/groupId\u003e\n       \u003cartifactId\u003eapollo-runtime\u003c/artifactId\u003e\n       \u003cversion\u003e3.8.2\u003c/version\u003e\n   \u003c/dependency\u003e\n\u003c/dependencies\u003e\n----\n\n. Add the code generator plugin to your project's build:\n+\n[source,xml,subs=\"attributes+\"]\n----\n\u003cplugins\u003e\n    \u003cplugin\u003e\n        \u003cgroupId\u003ecom.github.aoudiamoncef\u003c/groupId\u003e\n        \u003cartifactId\u003eapollo-client-maven-plugin\u003c/artifactId\u003e\n        \u003cversion\u003e{project-version}\u003c/version\u003e\n        \u003cexecutions\u003e\n            \u003cexecution\u003e\n                \u003cgoals\u003e\n                    \u003cgoal\u003egenerate\u003c/goal\u003e\n                \u003c/goals\u003e\n                \u003cconfiguration\u003e\n                    \u003cservices\u003e\n                        \u003cexample-api\u003e\n                            \u003ccompilationUnit\u003e\n                                \u003cname\u003eexample\u003c/name\u003e\n                                \u003ccompilerParams\u003e\n                                    \u003cschemaPackageName\u003ecom.example.graphql.client\u003c/schemaPackageName\u003e\n                                \u003c/compilerParams\u003e\n                            \u003c/compilationUnit\u003e\n                        \u003c/example-api\u003e\n                    \u003c/services\u003e\n                \u003c/configuration\u003e\n            \u003c/execution\u003e\n        \u003c/executions\u003e\n    \u003c/plugin\u003e\n\u003c/plugins\u003e\n----\n\n. Create a file `src/main/graphql/SERVICE_NAME/schema.json` with the JSON results of an https://gist.github.com/aoudiamoncef/a59527016e16a2d56309d62e01ff2348[introspection query], OR you can automatically generate this file by setting `introspection.enabled` to true and `endpointUrl` to your GraphQL endpoint.\nAt build time, the plugin will query the server and install this file per the value of `schemaFile`.\n. Create files for each query you'd like to generate classes for under `src/main/graphql/SERVICE_NAME`:\n.. Query file names must match the name of the query they contain\n.. Query files must end with `.graphql` OR `.gql` by default.\n.. Any subdirectories under `src/main/graphql/SERVICE_NAME` are treated as extra package names to append to `schemaPackageName` in the plugin config.\n. Run `mvn generate-sources` to generate classes for your queries.\n\n. If you run into compilation issues such as `package com.apollographql.apollo3.api does not exist`, you may need to explicitly add the following runtime libraries to your pom.xml\n+\n[source,xml]\n---\n\u003cdependency\u003e\n      \u003cgroupId\u003ecom.apollographql.apollo3\u003c/groupId\u003e\n      \u003cartifactId\u003eapollo-api-jvm\u003c/artifactId\u003e\n      \u003cversion\u003e3.8.2\u003c/version\u003e\n\u003c/dependency\u003e\n \u003cdependency\u003e\n    \u003cgroupId\u003ecom.apollographql.apollo3\u003c/groupId\u003e\n    \u003cartifactId\u003eapollo-runtime-jvm\u003c/artifactId\u003e\n    \u003cversion\u003e3.8.2\u003c/version\u003e\n\u003c/dependency\u003e\n---\n\n=== Configuration Options\n\nAll plugin configuration properties and their defaults:\n\n[source,xml]\n----\n\u003cconfiguration\u003e\n    \u003cservices\u003e\n        \u003c!--Complete default configuration--\u003e\n        \u003clahzouz-complete-api\u003e\n            \u003cenabled\u003etrue\u003c/enabled\u003e\n            \u003caddSourceRoot\u003etrue\u003c/addSourceRoot\u003e\n            \u003caddTestSourceRoot\u003efalse\u003c/addTestSourceRoot\u003e\n            \u003csourceFolder\u003e${project.basedir}/src/main/graphql/lahzouz\u003c/sourceFolder\u003e\n            \u003cschemaPath\u003e${project.basedir}/src/main/graphql/lahzouz/schema.json\u003c/schemaPath\u003e\n            \u003cincludes\u003e\n                \u003cinclude\u003e**/*.graphql\u003c/include\u003e\n                \u003cinclude\u003e**/*.gql\u003c/include\u003e\n                \u003cinclude\u003e**/*.json\u003c/include\u003e\n                \u003cinclude\u003e**/*.sdl\"\u003c/include\u003e\n            \u003c/includes\u003e\n            \u003cexcludes\u003e\u003c/excludes\u003e\n            \u003ccompilationUnit\u003e\n                \u003cname\u003elahzouz\u003c/name\u003e\n                \u003coutputDirectory\u003e\n                    ${project.build.directory}/generated-sources/graphql-client/lahzouz/\n                \u003c/outputDirectory\u003e\n                \u003ctestDirectory\u003e\n                    ${project.build.directory}/generated-sources/graphql-client/lahzouz/test/\n                \u003c/testDirectory\u003e\n                \u003cdebugDirectory\u003e\n                    ${project.build.directory}/generated-sources/graphql-client/lahzouz/debug/\n                \u003c/debugDirectory\u003e\n                \u003cgenerateOperationDescriptors\u003efalse\u003c/generateOperationDescriptors\u003e\n                \u003ccompilerParams\u003e\n                    \u003crootFolders\u003e\n                        \u003crootFolder\u003e${project.basedir}/src/main/graphql/lahzouz/\u003c/rootFolder\u003e\n                    \u003c/rootFolders\u003e\n                    \u003cscalarsMapping\u003e\u003c/scalarsMapping\u003e\n                    \u003coperationIdGeneratorClass\u003e\u003c/operationIdGeneratorClass\u003e\n                    \u003coperationManifestFormat\u003epersistedQueryManifest\u003c/operationManifestFormat\u003e\n                    \u003cschemaPackageName\u003ecom.lahzouz.apollo.graphql.client\u003c/schemaPackageName\u003e\n                    \u003cpackageName\u003ecom.lahzouz.apollo.graphql.client\u003c/packageName\u003e\n                    \u003ccodegenModels\u003eOPERATION\u003c/codegenModels\u003e\n                    \u003cflattenModels\u003etrue\u003c/flattenModels\u003e\n                    \u003cgenerateApolloMetadata\u003efalse\u003c/generateApolloMetadata\u003e\n                    \u003cgenerateAsInternal\u003efalse\u003c/generateAsInternal\u003e\n                    \u003cgenerateFilterNotNull\u003efalse\u003c/generateFilterNotNull\u003e\n                    \u003cgenerateFragmentImplementations\u003efalse\u003c/generateFragmentImplementations\u003e\n                    \u003cgenerateKotlinModels\u003efalse\u003c/generateKotlinModels\u003e\n                    \u003cgenerateOptionalOperationVariables\u003efalse\u003c/generateOptionalOperationVariables\u003e\n                    \u003cgenerateQueryDocument\u003etrue\u003c/generateQueryDocument\u003e\n                    \u003cgenerateResponseFields\u003efalse\u003c/generateResponseFields\u003e\n                    \u003cgenerateSchema\u003efalse\u003c/generateSchema\u003e\n                    \u003cgenerateTestBuilders\u003efalse\u003c/generateTestBuilders\u003e\n                    \u003cgenerateDataBuilders\u003efalse\u003c/generateDataBuilders\u003e\n                    \u003cgenerateModelBuilders\u003efalse\u003c/generateModelBuilders\u003e\n                    \u003cnullableFieldStyle\u003eNONE\u003c/nullableFieldStyle\u003e\n                    \u003cuseSemanticNaming\u003etrue\u003c/useSemanticNaming\u003e\n                    \u003ctargetLanguage\u003eJAVA\u003c/targetLanguage\u003e\n                    \u003csealedClassesForEnumsMatching\u003e\u003c/sealedClassesForEnumsMatching\u003e\n                    \u003calwaysGenerateTypesMatching\u003e\u003c/alwaysGenerateTypesMatching\u003e\n                    \u003cmetadataOutputFile\u003e\n                        ${project.build.directory}/generated/metadata/apollo/lahzouz/metadata.json\n                    \u003c/metadataOutputFile\u003e\n                \u003c/compilerParams\u003e\n            \u003c/compilationUnit\u003e\n            \u003cintrospection\u003e\n                \u003cenabled\u003efalse\u003c/enabled\u003e\n                \u003cendpointUrl\u003e\u003c/endpointUrl\u003e\n                \u003cheaders\u003e\u003c/headers\u003e\n                \u003cschemaFile\u003e${project.basedir}/src/main/graphql/lahzouz/schema.json\u003c/schemaFile\u003e\n                \u003cconnectTimeoutSeconds\u003e10\u003c/connectTimeoutSeconds\u003e\n                \u003creadTimeoutSeconds\u003e10\u003c/readTimeoutSeconds\u003e\n                \u003cwriteTimeoutSeconds\u003e10\u003c/writeTimeoutSeconds\u003e\n                \u003cuseSelfSignedCertificat\u003efalse\u003c/useSelfSignedCertificat\u003e\n                \u003cuseGzip\u003efalse\u003c/useGzip\u003e\n                \u003cprettyPrint\u003efalse\u003c/prettyPrint\u003e\n            \u003c/introspection\u003e\n        \u003c/lahzouz-complete-api\u003e\n\n        \u003c!--Minimal configuration--\u003e\n        \u003clahzouz-min-api\u003e\n            \u003ccompilationUnit\u003e\n                \u003cname\u003elahzouz\u003c/name\u003e\n            \u003c/compilationUnit\u003e\n        \u003c/lahzouz-min-api\u003e\n\n        \u003c!--Auto configuration--\u003e\n        \u003clahzouz\u003e\u003c/lahzouz\u003e\n    \u003c/services\u003e\n\u003c/configuration\u003e\n----\n\n==== Custom Types\n\nTo use https://www.apollographql.com/docs/kotlin/essentials/custom-scalars[custom Scalar Types] you need to\ndefine mapping configuration then register your custom adapter:\n\n[source,xml]\n----\n\u003cconfiguration\u003e\n    ...\n    \u003cscalarsMapping\u003e\n        \u003cLong\u003ejava.time.LocalDate\u003c/Long\u003e\n    \u003c/scalarsMapping\u003e\n    ...\n\u003c/configuration\u003e\n----\n\nImplementation of a custom adapter for `java.time.LocalDate`:\n\n[source,java]\n----\nimport com.apollographql.apollo3.api.Adapter;\nimport com.apollographql.apollo3.api.CustomScalarAdapters;\nimport com.apollographql.apollo3.api.json.JsonReader;\nimport com.apollographql.apollo3.api.json.JsonWriter;\nimport org.jetbrains.annotations.NotNull;\n\nimport java.io.IOException;\nimport java.time.LocalDate;\nimport java.time.format.DateTimeFormatter;\n\npublic class LocalDateGraphQLAdapter implements Adapter\u003cLocalDate\u003e {\n    private static final DateTimeFormatter dateFormatter = DateTimeFormatter.ISO_DATE;\n\n    @Override\n    public LocalDate fromJson(@NotNull final JsonReader reader, @NotNull final CustomScalarAdapters customScalarAdapters) throws IOException {\n        String dateString = reader.nextString();\n        return LocalDate.parse(dateString, dateFormatter);\n    }\n\n    @Override\n    public void toJson(@NotNull final JsonWriter writer, @NotNull final CustomScalarAdapters customScalarAdapters, final LocalDate value) throws IOException {\n        writer.value(value.format(dateFormatter));\n    }\n}\n----\n\n[source,xml]\n----\n\u003cconfiguration\u003e\n    ...\n    \u003cscalarsMapping\u003e\n        \u003cDate\u003e\n            \u003ctargetName\u003ejava.time.LocalDate\u003c/targetName\u003e\n            \u003cexpression\u003enew com.example.LocalDateGraphQLAdapter()\u003c/expression\u003e\n        \u003c/Date\u003e\n    \u003c/scalarsMapping\u003e\n    ...\n\u003c/configuration\u003e\n----\n\n==== Test Sources\n\nTo generate sources for tests:\n[source,xml]\n----\n\u003cconfiguration\u003e\n    ...\n    \u003caddSourceRoot\u003efalse\u003c/addSourceRoot\u003e\n    \u003caddTestSourceRoot\u003etrue\u003c/addTestSourceRoot\u003e\n    \u003ccompilationUnit\u003e\n        \u003cname\u003eexample\u003c/name\u003e\n        \u003coutputDirectory\u003e${project.basedir}/target/generated-test-sources/apollo/example\u003c/outputDirectory\u003e\n        \u003cdebugDirectory\u003e${project.basedir}/target/generated-test-sources/apollo/example/debug\u003c/debugDirectory\u003e\n        \u003ctestDirectory\u003e${project.basedir}/target/generated-test-sources/apollo/example/debug\u003c/testDirectory\u003e\n    \u003ccompilationUnit/\u003e\n    ...\n\u003c/configuration\u003e\n----\n\n\n=== Using Apollo Client\n\nSee https://www.apollographql.com/docs/kotlin/[documentation]","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faoudiamoncef%2Fapollo-client-maven-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faoudiamoncef%2Fapollo-client-maven-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faoudiamoncef%2Fapollo-client-maven-plugin/lists"}