1

I am trying to create Java WebSocket client (STOMP + sockJs) following this sample. But I am not able to find maven/gradle dependency for

org.springframework.web.socket.messaging.WebSocketStompClient

Even maven search did not give any results.

After some searching I found that this is a part of

4.2.0.BUILD-SNAPSHOT

and the javadoc for this class is here.

I have tried to import

 org.springframework:spring-messaging:4.2.0.BUILD-SNAPSHOT 

and

 org.springframework:spring-web:4.2.0.BUILD-SNAPSHOT

But I was not able to import this class. I want to know if it is possible to import the 4.2.0.BUILd-SNAPSHOT from gradle.

If it is possible how do I know which spring module (like spring-web / spring-messaging) from the javadoc?

EDIT : am I correct in assuming that it is part of 4.2.0 from the Javadoc URL?

Karthik
  • 4,950
  • 6
  • 35
  • 65

3 Answers3

1

You need to add the snapshot repository if you want to use them:

<dependencies>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>4.2.0.BUILD-SNAPSHOT</version>
    </dependency>
</dependencies>

<repositories>
    <repository>
        <id>spring-snapshots</id>
        <name>Spring Snapshots</name>
        <url>http://repo.spring.io/snapshot</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>
Sergi Almar
  • 8,054
  • 3
  • 32
  • 30
  • Thank you for the answer :) This is what I was looking for (though I found 4.2.0.RC1 later). – Karthik Jun 30 '15 at 15:03
  • I have just seen your talk at at SpringOne2GX 2014. If it is not too much to ask for, Could you please answer [this question](http://stackoverflow.com/questions/31108780/stomp-or-xmpp-over-websocket). – Karthik Jun 30 '15 at 15:11
0

Please add this in your POM.xml :Please match the version with your Spring-framework version.

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-websocket</artifactId>
    <version>4.0.0.RELEASE</version>
</dependency>

Then do a mvn clean && mvn install from console if you are on linux or maven install from Eclipse.

We are Borg
  • 5,117
  • 17
  • 102
  • 225
  • If this didn't help you, let me know, I have few other suggestions. – We are Borg Jun 30 '15 at 12:40
  • Do you 4.2.0.RELEASE? If so, it would not work since 4.2.0 is not into release yet. If not , It does not make sense to add 4.0.0.RELEASE as I am already using 4.1.6.RLEASE I wanted to know how to use build-snapshot correctly. – Karthik Jun 30 '15 at 12:49
  • Bhai, english sudharo, I cannot understand what you just said. You can use the above dependency, it is not an issue. – We are Borg Jun 30 '15 at 12:50
  • we are Borg Yeah, but I think first you should know what is the latest spring version. – Karthik Jun 30 '15 at 12:59
  • Yes.. What is the spring version?? Are you using Spring 4.0? or you match the dependency. – We are Borg Jun 30 '15 at 13:00
  • Please read the question again, I want to use **4.2.0** snapshot, not 4.0.0 – Karthik Jun 30 '15 at 13:01
  • Why are you using Snapshot branch? You shouldnt... Promise me you will use 4.1.6.. :P – We are Borg Jun 30 '15 at 13:02
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/81972/discussion-between-we-are-borg-and-karthik). – We are Borg Jun 30 '15 at 13:02
0

I was not able to import 4.2.0.BUILD-SNAPSHOT but I was able to import 4.2.0.RC1 release.

I checked the pom.xml of the sample and just imported the same version as it is.

Karthik
  • 4,950
  • 6
  • 35
  • 65