如何添加JDT作为Maven依赖关系? [英] How can I add JDT as a Maven dependency?

查看:389
本文介绍了如何添加JDT作为Maven依赖关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个取决于 JDT核心的项目。我正在使用Maven中心的条目,直到我意识到他们是几年过期。在戳了一点之后,我发现了 https://repo.eclipse.org 。我找到了我需要的存储库,并添加了它:

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:

无法解析类型 org.eclipse.core.runtime.IProgressMonitor
从所需的.class文件间接引用

The type org.eclipse.core.runtime.IProgressMonitor cannot be resolved. It is indirectly referenced from required .class files

我设法在其中一个Nexus存储库中找到类型,并添加它:

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>

现在我收到错误


无法解析类型 org.eclipse.core.runtime.Plugin
从所需的.class文件间接引用

The type org.eclipse.core.runtime.Plugin cannot be resolved. It is indirectly referenced from required .class files

我找不到任何Nexus仓库中的类。 org.eclipse.jdt.core.JavaCore 是引用 org.eclipse.core.runtime.Plugin 的类

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。我需要添加哪些依赖项以包含 org.eclipse.core.runtime.Plugin

2.是否有更好的方式在Maven中包含JDT作为依赖关系?

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

我发现 org在 http://grepcode.com 的帮助下,.eclipse.core.runtime.Plugin 。这一次,Maven Central中的最新依赖关系 (而不是Eclipse的Nexus回购):

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>

现在,当我尝试运行我的测试,我得到以下异常: p>

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

在这一点上我考虑下载完整的JAR并将其添加为系统依赖关系。有没有更好的方法来添加JDT作为Maven依赖关系?

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?

推荐答案

临时工作,直到找到更好的解决方案依赖关系在Maven中央):

A temporary work around until a better solution is found (all dependencies in Maven central):

<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>

这篇关于如何添加JDT作为Maven依赖关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆