1

Whenever I'd like to check whether some dependencies of my project have newer versions, at the end I allways find myself googling after it. My problem is independent from the given version of Eclipse, it's been presense since I use this IDE.

I have the naive (natural?) expectation that the content assist in the POM editor would list ALL available versions, but it only lists the ones already existing in my .m2 folder. Google didn't help me, found no answers either here. Neither playing around with settings did the trick.

Could anyone give me a hint at least on a proper search string?

EDIT

Index download is enabled. Under 'googling' above I meant searching maven.org. After scrambling the proxy settings, maven log contained lines like

!MESSAGE Unable to update index for central|https://repo.maven.apache.org/maven2

That gave me the ultimate idea where to search.

I have no idea where the index is stored on my computer, but the fact that https://repo.maven.apache.org/maven2 is somehow processed implies that my Eclipse should know about all versions, but keeps its secrets.

hurjup
  • 23
  • 5
  • 3
    Searching for artifacts I strongly recommend https://search.maven.org/ Also you should enable to download the index of central see https://stackoverflow.com/questions/24252256/how-do-i-enable-index-downloads-in-eclipse-for-maven-dependency-search – khmarbaise Dec 09 '19 at 10:46
  • Ich use `mvn coordinates artifaktname` – Michal Dec 09 '19 at 10:50
  • When using the POM snippets proposed by https://mvnrepository.com which starts with a comment that contains a link, you can just Ctrl+click that link. It should also not be too difficult to create a Jenkins job or something similar that checks `pom.xml` files for new dependencies versions. – howlger Dec 09 '19 at 11:50
  • You can also use the Maven goal https://www.mojohaus.org/versions-maven-plugin/display-dependency-updates-mojo.html – J Fabian Meier Dec 09 '19 at 12:22

1 Answers1

0

Do the following to check dependencies for available new versions:

  1. Right-click the pom.xml file and choose Run As > Maven Build...
  2. In the Edit Configuration dialog enter into the field Goals: versions:display-dependency-updates
  3. Click Run

This will run a Maven build that prompts in the Console view something similar like the following:

...
[INFO] The following dependencies in Dependencies have newer versions:
[INFO]   com.fasterxml.jackson.core:jackson-core .............. 2.9.0 -> 2.10.1
[INFO]   net.sf.saxon:Saxon-HE ............................. 9.9.1-2 -> 9.9.1-6
[INFO]   org.eclipse.jgit:org.eclipse.jgit ...
[INFO]                             4.9.0.201710071750-r -> 5.5.1.201910021850-r
[INFO]   org.junit.jupiter:junit-jupiter-api ................ 5.1.0 -> 5.6.0-M1
[INFO]   org.junit.jupiter:junit-jupiter-engine ............. 5.1.0 -> 5.6.0-M1
[INFO]   org.slf4j:slf4j-simple ........................ 1.7.20 -> 2.0.0-alpha1
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.936 s
[INFO] Finished at: 2019-12-09T13:59:37+01:00
[INFO] ------------------------------------------------------------------------

It is also recommended having a comment with a link at the beginning of each dependency which can be opened via Ctrl+click or via F3:

<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-core</artifactId>
    <version>2.9.0</version>
</dependency>
howlger
  • 31,050
  • 11
  • 59
  • 99
  • Though it is better a workaround of the actual problem, this approach can save some time upon updating dependencies and plugins. – hurjup Dec 10 '19 at 11:34
  • @hurjup You might report a feature request or - event better - propose a patch to Eclipse m2e (but keep in mind querying the versions takes time and there might not always be an internet connection). Alternatively or in addition, you could do a cron job that will let you know when new versions are available (for example with Jenkins). – howlger Dec 10 '19 at 12:02