Maven 和 graphql-java

Maven and graphql-java

我正在尝试 运行 来自 http://graphql-java.readthedocs.io/en/stable/getting_started.html#hello-world

的 HelloWorld 示例

我有编译问题:

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

我的 Maven 文件:

<?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>

我的 Maven 配置有什么问题?

要使用 bintray 存储库中的最新版本,请更改依赖项版本。您可以找到版本 here.

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

如果你想使用最新的稳定版本 (11.0.0) 删除不必要的存储库声明并以这种方式使用它。

<!-- 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>