Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update my gradle dependencies in eclipse

Tags:

eclipse

gradle

I have a simple gradle project in my eclipse. I update the build.gradle to include a few apache http jars...

dependencies {     compile group: 'commons-collections', name: 'commons-collections', version: '3.2'     compile 'org.apache.httpcomponents:httpclient:4.2.3'     compile "org.apache.httpcomponents:httpmime:4.2.3"     testCompile group: 'junit', name: 'junit', version: '4.+' } 

However in my code, where I reference some Apache HTTP stuff I get:

The import org.apache.http cannot be resolved    

Any tips on what I need to do to make Eclipse see the new dependencies in my build.gradle?

I tried doing a clean but that does not work. My gradle plugin is:

  Gradle IDE    3.3.0.201307040643-RELEASE  org.springsource.ide.eclipse.gradle.feature.feature.group   GoPivotal, Inc. 
like image 643
Breako Breako Avatar asked Jul 28 '13 11:07

Breako Breako


2 Answers

You have to select "Refresh Dependencies" in the "Gradle" context menu that appears when you right-click the project in the Package Explorer.

like image 151
Peter Niederwieser Avatar answered Sep 30 '22 17:09

Peter Niederwieser


Follow those steps to update Gradle project in Eclipse:

  1. First, please check you have include eclipse gradle plugin. apply plugin : 'eclipse'
  2. Then go to your project directory in Terminal. Type gradle clean and then gradle eclipse.
  3. Then go to project in eclipse and refresh the project (Go to Project Explorer, select root of the project and hit F5 to refresh, or right click and select refresh in context menu).

enter image description here

like image 38
Kasun Kariyawasam Avatar answered Sep 30 '22 16:09

Kasun Kariyawasam