如何使用Eclipse中的Buildship刷新项目依赖关系? [英] How do I refresh project dependencies using Buildship in Eclipse?

查看:2353
本文介绍了如何使用Eclipse中的Buildship刷新项目依赖关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Eclipse火星最近被发布,我觉得很想尝试。它通过


请参阅下面的更新 但有时您可能会发现,当您的项目导入时,它没有获得您通常可以在项目属性中看到的新项目和外部依赖关系类路径条目 - > Java构建路径 - >图书馆
如果确实缺少,请将以下内容添加到项目的 .classpath 文件中,并且所有的毕业生都应该开始工作: / p>

 < classpathentry exported =truekind =conpath =org.eclipse.buildship.core.gradleclasspathcontainer/ > 




更新在buildment 1.0.16 / p>

如果缺少



如果将现有Eclipse Java项目转换为Gradle,则Gradle类路径容器将被还原,Gradle类路径容器失踪。现在,当项目是Java项目时,它总是被添加。



Eclipse Mars was recently released and I felt like trying it out. It listed tighter integration with Gradle as one of its features via Buildship.

With Luna I was using Gradle Integration for Eclipse (4.4) and I found this a lot easier to work with for what I was trying to do; I could add a Gradle "nature" to an existing project without needing to remove the project and re-import it as I did with Buildship, and it automatically put all dependencies that I declared in build.gradle within the project's classpath.

With Buildship, I didn't see any option to configure an existing project as a Gradle project and I couldn't find a way to make it include the dependencies I specified in the build script within the project's classpath.

I tried installing the original plugin (GIfE 4.4) for Eclipse Mars and after restarting Eclipse it automatically did all that for me again. What I'm wondering is if there's a way to do this all through Buildship alone because right now, although it all works, it's quite a funny setup. My project's dropdown menu looks like this:

Apart from looking a bit odd it is actually quite a nice setup, since it combines the automatic dependency management of GIfE with the ability to run Gradle tasks directly from Eclipse that Buildship provides.

解决方案

Updating the dependencies that eclipse sees should then be as simple as:

right click on project -> gradle -> refresh all

Update in buildship 1.0.16

Currently you need to jump through the delete-and-import hoop the first time you use an existing gradle project with buildship. You can now use the Add Gradle Nature option:

 right click on project -> configure -> Add Gradle Nature

"Refresh Gradle Project" is now also shown when right-clicking on any .gradle file as well as in the context menu of the Gradle editor. source

See update below However sometimes you may find that when your project was imported, it didn't get the new Project and External Dependencies classpath entry which you would normally be able to see in your Project Properties -> Java Build Path -> Libraries If this is indeed missing, add the following to your project's .classpath file and all the gradle goodness should start working:

<classpathentry exported="true" kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>

Update in buildship 1.0.16

Gradle classpath container is restored if missing

When converting an existing Eclipse Java project to Gradle, the Gradle classpath container was missing. It is now always added when a project is a Java project.

这篇关于如何使用Eclipse中的Buildship刷新项目依赖关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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