Created a Gradle project in Eclipse but Refresh Dependencies is missing - eclipse

I just created a new Gradle project in Eclipse. As I understand it, the first thing to do now is to right click the project → Gradle → Refresh Dependencies - but I don't see that option. The only option I have is Refresh Gradle project.
What am I missing? I have the Buildship Gradle Integration 3.0 installed. Do I need something else?
My goal is to add a dependency. I think I have seen that, if I can perform this Refresh Dependencies command, I should be able to browse repositories in a GUI?
I have read several tutorials, e.g., https://www.vogella.com/tutorials/EclipseGradle/article.html but it doesn't seem to relate to my problem.
Using Eclipse 2020-09.

Related

Is it possible for Gradle projects in buildship to resolve dependencies to other Gradle projects in the same workspace?

Copied from Is it possible for Gradle projects in Eclipse/STS to resolve dependencies to other Gradle projects in the same workspace?
A Gradle project in my workspace (call it Downstream) needs to depend on another Gradle project (call it Upstream). Outside of Eclipse, of course Upstream would need to be build and installed before Downstream (so that Gradle can resolve it). In Eclipse, since both projects are in the workspace together, I'd like to have Gradle look in the workspace first and make the dependency between the projects, not from the repo.
I'm nto using Eclipse/STS, but the shine new Eclipse-Buildship gradle integration. does anybody know how to do that essential feature?
At the moment Buildship only supports importing one multiproject build and not multiple seperated gradle projects. This is planned to change but requires also some work in the Gradle Tooling API where we want to have the concept of a workspace modelled correctly. The gradle team started to specify this functionality in their design documents at
https://github.com/gradle/gradle/blob/master/design-docs/ide-integration.md#story---expose-workspace-concept-for-eclipse

Is it possible for Gradle projects in Eclipse/STS to resolve dependencies to other Gradle projects in the same workspace?

A Gradle project in my workspace (call it Downstream) needs to depend on another Gradle project (call it Upstream). Outside of Eclipse, of course Upstream would need to be build and installed before Downstream (so that Gradle can resolve it). In Eclipse, since both projects are in the workspace together, I'd like to have Gradle look in the workspace first and make the dependency between the projects, not from the repo.
m2e (Maven integration for Eclipse) does this (the option is called Resolve dependencies from Workspace). Gradle Eclipse plugin has an option called Remap Jars to maven projects but that seems to do this for pom-driven m2e projects, not other Gradle projects.
Is there any way to get Gradle to resolve dependencies to the local workspace (when they're present) instead of the repo?
It turns out this is was an outstanding feature request for Gradle IDE. It has been delivered for the 3.6.3 release of Gradle IDE.
You do have to enable it, though:
The feature has to be enabled in the Gradle preferences page. Access
via "Window >> Preferences >> Gradle".
If you are not seeing the "remap jars to Gradle projects" there then
maybe double check that version of the Gradle plugins is indeed 3.6.3.
Maybe something went wrong during the upgrade and you are still using
an older version.
Source
As far as I know these is no such functionality in current STS plugin. Given that there is the re-mapping support to replace dependencies with reference to m2e project I think it should be possible to add it.
Modifying the generated classpath using XML hooks in EclipseClasspath model descrideb in http://www.gradle.org/docs/current/dsl/org.gradle.plugins.ide.eclipse.model.EclipseClasspath.html will probably not help because this is done in Gradle process where you do not have information about existing Eclipse projects from your current workspace.

Is there a Gradle plugin for Eclipse Luna?

I'm trying to integrate Eclipse Luna with Gradle.
Eclipse Integration Gradle GitHub page includes instructions for Installing Gradle Tooling from update site.
I followed the instructions for the release (stable) version.
After I selected all the components (as shown below) I proceeded with installation.
It didn't go as expected and brought me to the Install Remediation Page (below) that showed that only Gradle IDE component could be installed. ( Click here for larger image).
At this point I'm not sure what caused the problem and what to do about.
The plugin you are using is wrong. There is an update for Luna here.
You can alternatively install the plugin directly within eclipse with this integration link.
Gradleware now offers direct support for the Eclipse IDE. See http://www.vogella.com/tutorials/EclipseGradle/article.html for an introduction.
In addition to plugin memtioned by #Campiador. You must have supported project nature in your eclipse's .project file in order for your project to show up in "Gradle Tasks" view.
See following example:
Add one or more natures in build.gradle file:
eclipse.project {
natures 'org.springsource.ide.eclipse.gradle.core.nature', 'org.eclipse.jdt.core.javanature'
}
After this change, just run gradle eclipse command from your shell/command prompt. Newly generated .project will have proper natures in it. Just refresh your project in eclipse and now you will see your project in Gradle Tasks view.

Missing Maven Dependencies Folder in Spring Tool Suite

I'm currently attempting to configure a Maven project in Spring Tool Suite for use with Tatool. I was watching this tutorial video and my project is identical to his after it is created except for the fact that it is missing a Maven Dependencies folder and I am also unable to "create" new dependencies (although I can add them). What gives?
Apologies in advance for the elementary nature of this question, but I'm new at this.
I am guessing that either:
Your project is not a maven project. Right click on project -> Configure -> Convert to maven project
You do not have m2e installed. Open STS dashboard, click extensions at bottom and install m2e
Nevermind, resolved it. The tutorial was using an old version of STS which had a "create" button in addition to the "add" button under the dependencies tab of the POM. All I had to do was add a dependency and the folder showed up.

Eclipse not recognizing project as Gradle Project

I want to build a project with gradle. I have included build.gradle in my project.
But eclipse is not recognizing it as gradle project and I can't build it. Can anybody give a solution for this.
I just had this problem in Spring Tool Suite.
Here's what I did.
Right-click on project for context menu.
Go to "Configure"
near the bottom of menu (for me)
Select sub-menu option of
"Convert to Gradle project".
Refresh project.
The imported project's build.gradle then appeared in the drop-down options of the Gradle view.
If you are using the Buildship Eclipse plugin for Gradle integration, you can try to add the following snippet into your build.gradle file:
eclipse {
project.natures 'org.eclipse.buildship.core.gradleprojectnature'
.....
}
Then run "gradle eclipse" to re-generate Eclipse project files and refresh your project in Eclipse.
In Eclipse Neon you:
Right-click on your project --> Configure --> Add Gradle Nature.
Your project will automatically refresh and you will see all the dependencies being downloaded by Gradle.
Eclipse doesn't have native support for Gradle. There's an eclipse plugin available from SpringSource in order to support Gradle in Eclipse, but the easiest way is to generate the eclipse project from gradle, following the documentation.
I had a similar problem, to get eclipse to recognize the Gradle project I added the Gradle nature and then I had to click on Gradle->Refresh All then the Gradle icon appeared and all dependencies were resolved.
Clicking on Enable Dependency Management before refreshing resulted in "This operation is not enabled" and all the Gradle menu options getting greyed out.