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

1

1

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

Entirely answered 22/5, 2019 at 23:16 Comment(3)
I found the info that "Currently there is no official support for using apollo android without gradle" but may be there is any workaround for that ?Entirely
What do you mean with different version? I assume the jar you are looking for is this one: mvnrepository.com/artifact/com.apollographql.apollo/…?Lansquenet
@Lansquenet yes but it is not able to resolve dependencies using pom.xml so I can't use the packages that are included in this repository :/Entirely
L
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>
Lansquenet answered 22/5, 2019 at 23:42 Comment(3)
Thank you for the reply I will check it today. Do you mind to share your code to see how are you using it inside the classes? ;)Entirely
@Kamil: Sorry, I have no code for that. I just verified the maven part.Lansquenet
Thank you for your help. The dependencies seem to be working now and I am trying to develop some Java app that uses the grpahql client to get data from a sever and to handle simple subscription to display current/refreshed date and time.Entirely

© 2022 - 2024 — McMap. All rights reserved.