Basil Bourque
Basil Bourque

Reputation: 338875

Maven does not list current version of a library

With a Maven 3 based project in NetBeans 8 beta, when I context+click on the "Dependencies" item of the "Projects" navigator and choose "Add Dependency…" menu item, I get a dialog box for searching the repository.

Every time I type in "slf4j-api" and choose the found item "org.slf4j : self4j-api", I get different results. Sometimes in the list of versions I get 1.7.0, sometimes 1.7.5, but never the latest: 1.7.6 available for download from the slf4j download page.

Why does the list change when I search and display a list a minute later?

So I got try a search for "logback-classic", and click on "ch.qos.logback : logback-classic". The greatest version number is 1.0.13. That was released in May of last year. Since then version 1.1.0 was released 2014-01-28, and 1.1.1 on 2014-02-05.

Why does Maven not offer these later versions?

Is it a caching problem? Is there some way to force the dialog in Netbeans to update its list of available versions?

Upvotes: 1

Views: 639

Answers (2)

lforet
lforet

Reputation: 16

Netbeans index all maven repositories in order to find all dependencies and versions. It is a time consuming task so by default it is launched once a week.

If you want to refresh the index go to Tools > Option > Java > Maven > Index and click «Index now»

If you still don't find the last version of your dependency, it is probably that the library has not been uploaded to repositories. To configure repositories go to Window > Services > Maven Repositories.

The documentation is a little outdated but you can find more information, here : http://wiki.netbeans.org/MavenBestPractices#Dependency_management

Upvotes: 0

Aaron Digulla
Aaron Digulla

Reputation: 328644

I've seen the same problem in Eclipse. It often happens when the IDE can't update it's cached copy of the Maven index.

A quick fix is to put the latest version that I know into the POM and build the project once. The IDE will then download the dependency and from then on, it will know that this version exists.

The longer fix is to look into your IDE's error log to find out why it can't update it's copy of the index files. Often, you need to configure your IDE to use the correct HTTP proxy settings.

Upvotes: 1

Related Questions