Maven和graphql-java

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Maven和graphql-java相关的知识,希望对你有一定的参考价值。

我试图从qazxsw poi运行Hello World示例

我有编译问题:

http://graphql-java.readthedocs.io/en/stable/getting_started.html#hello-world

我的Maven档案:

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配置有什么问题?

答案

要使用bintray存储库中的最新版本,请更改依赖项版本。你可以找到发布<?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>

here

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

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

以上是关于Maven和graphql-java的主要内容,如果未能解决你的问题,请参考以下文章

如何为 GraphQLObjectType 的 GraphQLList 定义 Relay 片段?

突变查询 graphql-java

graphql-java 循环类型依赖

Graphql-java 中的自定义标量

Spring boot graphql-java 和订阅

graphql-java 错误数据(如扩展)被填充到客户端的“消息”字段中