Eclipse build errors when using Gradle or Maven? - java

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.

Related

Eclipse does not recognize Gradle dependencies, despite "Update Dependencies" returning success

I'm using the Gradle STS plugin (version 3.7.3) for Eclipse (version 4.5.2), on Kubuntu 15.10. I use a bunch of dependencies, but Eclipse does not recognize any one of them, treating them as not found. At seemingly random intervals, I get this error once for each of my nested projects:
java.io.File cannot be cast to org.gradle.api.artifacts.Configuration
Could not fetch model of type 'StsEclipseProject' using Gradle distribution
'http://services.gradle.org/distributions/gradle-2.13-all.zip'.
And yet, when I do Right-click project > Gradle (STS) > Refresh All, I just get this:
BUILD SUCCESSFUL
Total time: 0.882 secs
That's it. How do I fix this?
Not really a solution to your problem, but you could trying removing STS and start using Eclipse BuildShip instead, which is the "official" support for Gradle in Eclipse IDE. BuildShip can be installed via the Eclipse Marketplace

Automatic library download in Eclipse with Gradle

I'm developing an java application. I'm using eclipse Luna and Gradle as my build-system. I can define dependencies in my build script and they get downloaded on a build. That's no problem... But how can I tell eclipse, that it should automatically download and add the dependency to my build path?
I wan't to use auto completion and so on, without manually downloading an jar and copy it to the project.
Is it possible?
Regards
Marc
You need the Eclipse Gradle tooling, which adds lots of Gradle-related functionality. Most importantly, it manages your Eclipse project build path to match the build.gradle dependencies.

Spring beans config files not finding classes from dependencies declared in gradle

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.

Problems integrating Maven with Eclipse Kepler

I am totally new to working with Maven in Eclipse. I am using the latest verion of Eclipse (Kepler). According other posts, as well as Eclipse's help page http://help.eclipse.org/kepler/index.jsp?topic=//org.eclipse.platform.doc.user/tasks/tasks-127.htm , I am supposed to try to install new software within Eclipse IDE.
However, when I try to Add Eclipse's recommended m2e release, Eclipse gives me an error:
Unable to read repository at http://download.eclipse.org/technology/m2e/releases.
download.eclipse[...]releases is not a valid repository location.
Essentially I run into the same problem no matter which approach I take outlined on the Eclipse help page. Is there some other/better way to integrate Maven with Eclipse? Are there steps I should have taken before this? All I have done so far is install Eclipse. How can I successfully get Maven running?
EDIT: Now I am using Java EE and still run into problems when making a Maven project. I get a "Could not resolve archetype error" could this be because I'm behind a proxy?
Most convenient option:
The reason you're getting that error is because that repo is deprecated, and it has been moved. Example of how the new repo looks:
http://download.eclipse.org/technology/m2e/releases/1.0/1.0.0.20110607-2117
Copy that in the Install New Software view, and you will see that it works.
Other options:
Install the Maven Integration from Eclipse Marketplace (Help -> Eclipse Marketplace)
Download the EE version of Kepler (comes with m2e)
Choose your own release (bottom of the page) and use the Install New Software view.
I had the same issue here and the above answer didnt work for me. Although Maven is installed I cane update my dependencies on my folder the way I used to be able to do on Juno. What I did was used the pom.xml from my current project and pasted it into the pom of my new project I created specifically in Eclipse using new project->Maven.
This was eclipse knows its a Maven project and allows my all the benefits of being one.
To install maven properly for eclipse you should set the correct repos as follow:
Help=>install=>
then work with
http://download.eclipse.org/releases/
example of eclipse version : mars or kepler ..

Do I need to install an ADT plugin if I want to use Maven?

Is it necessary to download and install ADT plugin into Eclipse, if I want to build all projects using maven?
You might be able to get your project to build by just relying on maven, but you'd miss out on debug tools, Android-specific editors, the simulator, the ADB shell...
For a mavenized android project, if you are talking about build project from commandline, for instance, check out some projects from GitHub and do a mvn clean install, you only need install and setup:
Android SDK
Maven
If you are talking about develop/build project inside IDE like Eclipse, besides Android SDK and Maven, you need the following Eclipse plugins (all available via Eclipse Marketplace), in order to create/import and work on mavenized android project inside Eclipse:
adt
m2e (Maven Integration for Eclipse)
m2e-android (Android Configurator for M2E)
Check out answer here and see screenshot of installed Eclipse plugin.
the ADT plugin is required as It holds the APIs though I am not familiar with maven It would probably be a good idea to install the android ADT to get these APIs. also included in the ADT is the system images and java files needed to build on to create an app.
as I said I am not familiar with maven but I would still recommend installing android ADT

Categories

Resources