I'm trying to create a project that depends on JDT core. I was using the entries in Maven central until I realized they were several years out of date. After poking around a little, 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 an error:
The type
org.eclipse.core.runtime.IProgressMonitor
cannot be resolved. It is indirectly referenced from 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'm getting the error
The type
org.eclipse.core.runtime.Plugin
cannot be resolved. It is indirectly referenced from required .class files
And I cannot find the class in any of the Nexus repositories. org.eclipse.jdt.core.JavaCore
is the class referencing org.eclipse.core.runtime.Plugin
.
1. Which dependency do I need to add to include org.eclipse.core.runtime.Plugin
?
2. Is there a better way to include JDT as a dependency in Maven?
/e1
I found org.eclipse.core.runtime.Plugin
with the help of http://grepcode.com. This time, the up-to-date dependency is in Maven Central (and not in Eclipse's 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 all over the place:
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'm considering downloading the complete JAR and adding it as a system dependency. Is there any better way to add JDT as a Maven dependency?
ASTParser
. – GlossotomyASTParser
class is not part of the compiler adapter. The only supported way to use it would be through running JDT inside of the Eclipse platform. So, you'd need to create an eclipse plugin that depends on jdt core. – Redfaced