How can I implement apollographql client into the maven project to activate subscription?

牧云@^-^@ 提交于 2020-06-29 04:24:26

问题


I am trying to create a graphql client in Java project and I am using apollographql library. The problem is that I am not able to get the dependencies using the pom.xml with version different than from Central repository. The other thing is that all of the examples are built with Gradle. Do you have any examples or ideas about how to create a simple subscription client using apollo library and maven project? One of the specific issues that I have is that once apollographql-runtime library is downloaded there is no "subscription" package. I wanted to use this dependency:

<dependency>
<groupId>com.apollographql.apollo</groupId>
<artifactId>apollo-runtime</artifactId>
<version>1.0.0-alpha5</version>
</dependency>

but I am not able to download it using pom.xml. In a different project, it was working with gradle.build file.

tried download .jar file but still no "subscription" package available.

pom.xml

<dependency>
  <groupId>com.apollographql.apollo</groupId>
  <artifactId>apollo-runtime</artifactId>
  <version>1.0.0-alpha5</version>
  <type>pom</type>
</dependency>

I want to import this class:

import com.apollographql.apollo.subscription.WebSocketSubscriptionTransport;

Could not resolve dependencies for project com.brzozaxd.rbpvendor2:rbpvendor2:jar:1.0-SNAPSHOT: The following artifacts could not be resolved: com.apollographql.apollo:apollo-api:jar:1.0.0-alpha5


回答1:


Works for me, and has the mentioned package and class inside it.

<project>

 ....

 <repositories>
    <repository>
      <id>repo2</id>
      <name>appolographql repo</name>
      <url>https://dl.bintray.com/apollographql/android</url>
    </repository>
  </repositories>


  <dependencies>
    <dependency>
        <groupId>com.apollographql.apollo</groupId>
        <artifactId>apollo-runtime</artifactId>
        <version>1.0.0-alpha5</version>
    </dependency>
  </dependencies>

</project>


来源:https://stackoverflow.com/questions/56266153/how-can-i-implement-apollographql-client-into-the-maven-project-to-activate-subs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!