Maven build failed due to JDT dependencies – No versions available for org.osgi.service:org.osgi.service.prefs:jar:[1.1.0,1.2.0)

EDIT: The issue is known by the project team and tracked as eclipse-equinox/equinox.bundles#54 on GitHub.

The dependency:

<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.preferences</artifactId>
<version>3.10.0</version>

Which is one of your transitive dependency, references this dependency in its dependencies list:

<dependency>
    <groupId>org.osgi.service</groupId>
    <artifactId>org.osgi.service.prefs</artifactId>
    <version>[1.1.0,1.2.0)</version>
</dependency>

Source: org.eclipse.equinox.preferences-3.10.0.pom on maven central.

It is a mistake. As Maven tells you, this does not exist:

Cannot resolve No versions available for org.osgi.service:org.osgi.service.prefs:jar:[1.1.0,1.2.0) within specified range.

It should have been:

<dependency>
    <groupId>org.osgi</groupId>
    <artifactId>org.osgi.service.prefs</artifactId>
    <version>[1.1.0,1.2.0)</version>
</dependency>

Which exists (note the different groupId).

Because you are not fixing the dependencies you are consuming in your project, and because the dependencies are using version ranges, suddenly you got a new version.

By the way as beingnurd has noted, there is now the newer version 3.10.1 of org.eclipse.equinox.preferences where this wrong dependency is fixed (see org.eclipse.equinox.preferences-3.10.1.pom).

If you continue to use always the newest dependency of the compatible range, the problem will be solved for you.


Now if we take a step back:

You are trying to use following JDT version:

<dependency>
    <groupId>org.eclipse.jdt</groupId>
    <artifactId>org.eclipse.jdt.core</artifactId>
    <version>3.20.0</version>
</dependency>

This corresponds to the Eclipse Version 2019-12 (also called 4.14 internally).


Your problem is that the eclipse projects (org.eclipse.jdt.core and all the dependencies) are using version ranges.
If you look at the org.eclipse.jdt.core dependencies declarations:

  • org.eclipse.platform:org.eclipse.core.resources:[3.12.0,4.0.0)
  • org.eclipse.platform:org.eclipse.core.runtime:[3.13.0,4.0.0)
  • org.eclipse.platform:org.eclipse.core.filesystem:[1.7.0,2.0.0)
  • org.eclipse.platform:org.eclipse.text:[3.6.0,4.0.0)

If you don’t do anything, Maven always takes the latest:

Today (June 2022) this would be:

  • org.eclipse.core.resources: 3.16.100
  • org.eclipse.core.runtime: 3.24.100
  • org.eclipse.core.filesystem: 1.9.300
  • org.eclipse.text: 3.12.0

When the library was published (December 2019) this was:

  • org.eclipse.core.resources: 3.13.600
  • org.eclipse.core.runtime: 3.17.0
  • org.eclipse.core.filesystem: 1.7.600
  • org.eclipse.text: 3.10.0

And of course this is recursive, you need to do this for all the dependencies.


Letting Maven choose always the latest is problematic:

  • It prevents you creating reproducible build, because the dependencies picked by maven depends from what is available on maven central on that day.
  • You need to solve conflicts.
  • You are potentially the first trying out a combination.

This is why I always use a set of projects that were released together. By the way this is also how the Eclipse project itself is doing it (by using P2 update sites and target platform).

I am publishing Maven BOM files to fix the versions: ECentral project


This is how you can do it:

  <repositories>
    <repository>
      <id>ecentral</id>
      <url>https://raw.githubusercontent.com/jmini/ecentral/HEAD/repo</url>
    </repository>
  </repositories>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>fr.jmini.ecentral</groupId>
        <artifactId>eclipse-platform-dependencies</artifactId>
        <version>4.14</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>org.eclipse.jdt</groupId>
      <artifactId>org.eclipse.jdt.core</artifactId>
      <!-- no version needed here, because it is defined in the BOM -->
    </dependency>
  </dependencies>

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)