Reputation: 26919
I am totally new to everything in Java and it gets confusing some times, for example I want to follow some example to learn about Jersey. So I go to their webiste and for Core-Server they say include this in your POM, which is using version 1.2 http://jersey.java.net/nonav/documentation/latest/user-guide.html#chapter_deps
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.12</version>
</dependency>
Then I look at some other examples online and they say include this, using version 1.8
<repositories>
<repository>
<id>maven2-repository.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2/</url>
<layout>default</layout>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.8</version>
</dependency>
</dependencies>
So I guess my main question is what is the correct way of finding these Maven coordinates ans to know what is the correct version number to use?
Upvotes: 0
Views: 93
Reputation: 160181
You should use the version you need.
What you need is determined by what you're doing. If you're following a tutorial letter-by-letter, use the version from the tutorial. To further your knowledge immediately after, try upgrading to the latest version, making use of new features etc.
In general you'll want to use the latest version of a library--unless doing do would break compatibility with a different dependency. You can manage all that through Maven via dependency excludes. You may also want to read this intro as well).
If you're using any given library you likely know its homepage, which will brag about the latest version... usually. If you know the group and artifact you can also look on mvnrepository.com (for example).
In this case, there are 2.x milestones, and the current 1.x release, 1.13.
Upvotes: 1
Reputation: 45576
Books usually reflect the version at the time of writing.
Usually, I would give an advise of using the latest stable version of the library, but if you follow tutorial in the book it may make sense to use the versions from the book.
In this case, if the code you are trying to produce does not work you may know that it is due to the bug in your code, not because of the version mismatch with tutorial.
Once you master the tutorial, switch to the latest version for your production code.
Upvotes: 1
Reputation: 6021
It may seem obvious, but the more recent is the version, the more bug are resolved and features are implemented.
Probably the code would work with either version, but generally speaking I'd choose the more recent version which is compatible with other libraries you are using and with your environment.
Upvotes: 1