Add a Maven dependency to a Eclipse Plugin project

孤者浪人 提交于 2019-12-21 23:27:59

问题


just a simple question: I need to add a Maven dependency to a Eclipse Plugin project. The project has not a POM file, so I converted it to a Maven one. Now I have plugin.xml file and pom.xml file. POM contains the dependency I need to satisfy, but it's ignored; I mean, I can't resolve an import in source code referring to that import.

Can you help me? ty

I read about Tycho plugin, but online configurations don't work.


回答1:


If I'm reading this correctly, you've just started by adding a Maven dependency to your project, but don't have the dependency available for Eclipse to validate your code against.

You will need to start a Maven build after you add a brand new dependency so that Maven can add that to your local cached repository. Once the Maven build is done, Eclipse should recognize your imports properly.




回答2:


You may want to check whether the dependency you are looking for is available in the Eclipse Orbit.

The Orbit project is basically a repository of libraries to make them available for Eclipse Plug-in Development. What is especially nice in the Orbit libraries is that they also provide the sources. Thus, it is possible to view the implementation and get proper JavaDoc and so on.

Example

One can find the com.google.gson library using the update site

https://download.eclipse.org/tools/orbit/downloads/drops/R20190602212107/repository

Thereby, the part R20190602212107 refers to the Orbit build name that you find on the downloads page of the project.



来源:https://stackoverflow.com/questions/13805312/add-a-maven-dependency-to-a-eclipse-plugin-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!