简体   繁体   中英

Maven and graphql-java

I am trying to run HelloWorld example from http://graphql-java.readthedocs.io/en/stable/getting_started.html#hello-world

I have compilation issues:

Information:java: Errors occurred while compiling module 'graphqlApp'
Information:javac 1.8.0_131 was used to compile java sources
Information:25.07.17 22:41 - Compilation completed with 17 errors and 3 warnings in 1s 873ms
Warning:java: source value 1.5 is obsolete and will be removed in a future release
Warning:java: target value 1.5 is obsolete and will be removed in a future release
Warning:java: To suppress warnings about obsolete options, use -Xlint:-options.
/home/marcin/graphqlApp/src/main/java/HelloWorld.java
Error:(1, 15) java: package graphql does not exist
Error:(2, 22) java: package graphql.schema does not exist
Error:(3, 22) java: package graphql.schema does not exist
Error:(7, 22) java: package graphql does not exist
Error:(7, 1) java: static import only from classes and interfaces
Error:(8, 29) java: package graphql.schema does not exist
Error:(8, 1) java: static import only from classes and interfaces
Error:(9, 29) java: package graphql.schema does not exist
Error:(9, 1) java: static import only from classes and interfaces
Error:(14, 9) java: cannot find symbol
  symbol:   class GraphQLObjectType
  location: class HelloWorld
Error:(17, 31) java: cannot find symbol
  symbol:   variable GraphQLString
  location: class HelloWorld
Error:(16, 24) java: cannot find symbol
  symbol:   method newFieldDefinition()
  location: class HelloWorld
Error:(14, 39) java: cannot find symbol
  symbol:   method newObject()
  location: class HelloWorld
Error:(22, 9) java: cannot find symbol
  symbol:   class GraphQLSchema
  location: class HelloWorld
Error:(22, 32) java: cannot find symbol
  symbol:   variable GraphQLSchema
  location: class HelloWorld
Error:(26, 9) java: cannot find symbol
  symbol:   class GraphQL
  location: class HelloWorld
Error:(26, 27) java: cannot find symbol
  symbol:   variable GraphQL
  location: class HelloWorld

My Maven file:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>graphqlApplication</groupId>
    <artifactId>graphqlApplication</artifactId>
    <version>1.0-SNAPSHOT</version>

    <repositories>
        <repository>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <id>bintray-andimarek-graphql-java</id>
            <name>bintray</name>
            <url>http://dl.bintray.com/andimarek/graphql-java</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>com.graphql-java</groupId>
            <artifactId>graphql-java</artifactId>
            <version>3.0.0</version>
        </dependency>
    </dependencies>
</project>

What is wrong with my Maven configuration?

To use the latest build from the bintray repository change the dependency version. You can find the releases here .

<dependencies>
    <dependency>
        <groupId>com.graphql-java</groupId>
        <artifactId>graphql-java</artifactId>
        <version>2019-04-09T05-29-53-bd9240c</version>
    </dependency>
</dependencies>

If you want to use the latest stable version (11.0.0) remove the unnecessary repositories declaration and use it this way.

<!-- https://mvnrepository.com/artifact/com.graphql-java/graphql-java -->
<dependency>
    <groupId>com.graphql-java</groupId>
    <artifactId>graphql-java</artifactId>
    <version>11.0.0</version>
</dependency>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM