How to add JDT to Maven dependency?

I am trying to create a project that depends on the JDT core . I used the records in the center of Maven until I realized that they were outdated for several years . After joking a bit, I came across https://repo.eclipse.org . I found the repository I needed and added it:

<repository> <id>eclipse</id> <name>Eclipse Repository</name> <url>https://repo.eclipse.org/content/groups/eclipse/</url> </repository> ... <dependency> <groupId>org.eclipse.jdt</groupId> <artifactId>org.eclipse.jdt.core</artifactId> <version>3.10.0.v20140316-0146</version> </dependency> 

But then I started getting the error:

The type org.eclipse.core.runtime.IProgressMonitor cannot be resolved. This indirectly refers to the required .class files

I managed to find the type in one of the Nexus repositories and added it:

 <repository> <id>eclipse-acceleo</id> <name>Eclipse Repository</name> <url>https://repo.eclipse.org/content/groups/acceleo/</url> </repository> ... <dependency> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.common</artifactId> <version>3.6.200.v20130402-1505</version> </dependency> 

Now i get an error

The type org.eclipse.core.runtime.Plugin cannot be resolved. it indirectly refers to the required .class files

And I cannot find the class in any of the Nexus repositories. org.eclipse.jdt.core.JavaCore is a class that references org.eclipse.core.runtime.Plugin .

1. What dependency do I need to add to enable org.eclipse.core.runtime.Plugin ?
2. Is there a better way to make JDT dependent on Maven?

/ e1

I found org.eclipse.core.runtime.Plugin using http://grepcode.com . This time, the updated dependency is in Maven Central (and not in the Eclipse Nexus repo):

 <dependency> <groupId>org.eclipse.core</groupId> <artifactId>runtime</artifactId> <version>3.9.100-v20131218-1515</version> </dependency> 

Now, when I try to run my tests, I get the following exception everywhere:

 java.lang.NoClassDefFoundError: org/eclipse/core/resources/IResource at org.eclipse.jdt.core.dom.ASTParser.<init>(ASTParser.java:177) at org.eclipse.jdt.core.dom.ASTParser.newParser(ASTParser.java:126) . . . Caused by: java.lang.ClassNotFoundException: org.eclipse.core.resources.IResource at java.net.URLClassLoader$1.run(URLClassLoader.java:372) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:360) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 30 more 

At this point, I plan to download the full JAR and add it as a system dependency. Is there a better way to add JDT to Maven dependency?

+7
java eclipse maven eclipse-jdt
source share
3 answers

Temporary work around until the best solution is found (all dependencies in the center of Maven):

 <dependency> <groupId>org.eclipse.tycho</groupId> <artifactId>org.eclipse.jdt.core</artifactId> <version>3.9.1.v20130905-0837</version> </dependency> <dependency> <groupId>org.eclipse.core</groupId> <artifactId>runtime</artifactId> <version>3.9.100-v20131218-1515</version> </dependency> <dependency> <groupId>org.eclipse.birt.runtime</groupId> <artifactId>org.eclipse.core.resources</artifactId> <version>3.8.101.v20130717-0806</version> </dependency> 
+6
source share

Eclipse JDT is now available in maven using a new approach for publishing artifacts. End users no longer need to work, posts are user-friendly (simple version numbers, standard maven metadata for dependencies, source artifacts, dependencies from third-party developers ...).

Just add this to your pom:

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

See the full example here .

+1
source share

Updated version found in maven repository

  <dependencies> <dependency> <groupId>org.eclipse.tycho</groupId> <artifactId>org.eclipse.jdt.core</artifactId> <version>3.12.0.v20160516-2131</version> </dependency> <dependency> <groupId>org.eclipse.core</groupId> <artifactId>runtime</artifactId> <version>LATEST</version> </dependency> <dependency> <groupId>org.eclipse.core</groupId> <artifactId>resources</artifactId> <version>LATEST</version> </dependency> </dependencies> 
0
source share

All Articles