I'm trying to get the Eclipse STS plugin to validate my spring bean config files, however I'm getting a class not found exception for every class that is outside of the current project (but is still in a dependent project obviously), There's an option to "Update Maven Dependencies" in the Spring Tools menu but that fails due to it not being a Maven project.
Is there a way to tell the plugin to look at the gradle dependencies ?
Thanks.
Try
apply plugin: 'eclipse-wtp'
Then try
gradle eclipseClean
gradle eclipse
on your project directory. It should erase any eclipse configuration you have on your project and regenerate everything (.classpath, war generation settings) in order to match your gradle dependencies. Beware that this is quite intrusive, as it wipes out your eclipse manual configuration (it is actually a gradle coup d'état to your eclipse configuration :P)
Thanks for the advice, ended up moving to Kepler instead of Juno which seemed to solve the issue anyway, so most likely was something to do with my plugins not working correctly.
Related
I have checked out a gradle project in eclipse but it is not able to recognise any annotation.Foe every annotation in each file it says
Configuration cannot be resolved to a
type
where configuration is annotation.
and all imports corresponding to annotation are also failing with following error:
The import org.springframework cannot be resolved
Entire project with all files is filled with error. But there is no such problem like this in Intellij for same project. Which setting am I missing for Eclipse ?
gradle build works fine although
From my experience, I did not see a checkout option in Eclipse for a Gradle project. I'm using Eclipse version 2019-06 (4.12.0). You need to check out the project in to your local file system and then do an import of the existing project as a Gradle Project.
Things to Note:
Make sure you have the Gradle buildship plugin installed in your Eclipse. (The plugin I use. Buildship: Eclipse Plug-ins for Gradle, provided as part of the Gradle Platform.)
Go to File --> Import. When a pop up box opens, scroll down to Gradle and select Existing Gradle project.
This Way Eclipse recognises the Gradle Project.
I am using VS Code to compile and debug my Spring Boot Java project with help of Gradle. I recently added Redis dependency to my project. The project compiles in Eclipse, but throws error in VS Code.
I'm not sure this answer becomes helpful to you or not but,
Normally VS code is not comes with default configurational setting of spring boot.
Spring boot project not able to run without dependencies.
So Because of your project not able to find relevant dependencies so it is generate this errors.
It solved using download plugin of vscode-spring-initializer and / or others.
If you need more detail then,
Try recognize your spring boot project in different IDE like IntelliJ or Eclipes. You see that there is some extra files are there like following,
External Libraries - which handle by maven kind of tool for load dependency.
.iml file in intellij : File which handle development module(contain plugins, module and other details).
This files are not existing there so that it generate issue.(That are different based on IDE)
If you have recently modified the pom.xml or build.gradle config file, you need right click on pom.xml or build.gradle file and then run the menu "Update project configuration" to force the language server to update the project configuration/classpath. Otherwise, the java language server cannot recognize the newly added dependency.
Some time ago, I created a project with multiple OSGi plugins. Today I reinstalled Eclipse for RCP and RAP Developers, imported the project, and discovered that some errors are occurring in the plugins. Specifically, the org.osgi.* path can't be referenced:
Does anybody know, why this reference errors are occurring and how to resolve them?
The project must be missing the required OSGi core dependencies on its classpath. There are two ways to resolve this:
Make sure the project is created as a plugin project, and that the MANIFEST.MF exists. There should be a project creation wizard that allows you to create the project as an Eclipse plugin.
If you use Maven in your project, the best way to manage your RCP projects is to use Tycho. It helps automatically resolving plugin dependencies and building your project (even from the command line) and is a much better solution for the long term.
Maybe you are missing the target platform setup. This is where plugin projects get their build time dependencies from.
I have a new project. Should I place apply plugin: 'idea' in build.gradle and run $ gradle idea? Or should I import the gradle project directly into IntelliJ IDEA 14.1? Which one will allow me to add dependencies to build.gradle and have IDEA automatically download & know about them?
With Intellij 14 you can just open the the build.gradle file using Intellij's File --> Open. this will import the gradle project, including all dependencies.
After you change something in the build.gradle file, you can click on "refresh all gradle projects" at the top of the gradle tool window.
You may also mark "use auto-import" under the Build Tools/Gradle tab in Settings. This will resolve all changes made to the gradle project automatically every time you refresh your project.
The idea plugin is the old method of importing a gradle project into Intellij.
With the newer versions of Intellij, it has become redundant.
From my experience using the idea plugin does not always work correctly in IntelliJ and actually IntelliJ documentation guidelines are to simply import build.gradle file.
Also, Peter Niederwieser who is a Principal Software Engineer at Gradleware answered a similar question ~2 years ago mentioning the following:
If you use Gradle's idea task to generate project files, this is normal, as there is no way to tell IDEA what the class path of the build script itself is. If you instead use IDEA's Gradle integration ("Import from Gradle model"), this problem doesn't exist.
Bottom line, your safer way to go would be importing gradle project directly from IntelliJ.
You can create a new Gradle Project in IntelliJ, and it will handle all of the dependencies and integrate well with Gradle. You can see here for more info and specifics.
When using a build manager like Gradle or Maven, my dependencies are being managed correctly, however the Eclipse IDE is unaware of the resolved dependencies so it will still show errors and I cannot build through Eclipse, I have to run a 'build' command through the build manager.
How do you get Eclipse to be aware of the resolved dependencies taken care of by a build manager and running the app through the IDE?
You can generate Eclipse metadata using eclipse plugin distribute with Gradle - http://www.gradle.org/docs/current/userguide/eclipse_plugin.html - this will set up the project with its classpath.
Or install Gradle plugin for Eclipse developed by Pivotal folks.
The question is vague. Using m2e or Gradle plugin for Eclipse developed by Pivotal can lead you to different errors. You should ask exact question, sharing error that you got here on stackoverflow.