Can I get gradle to update my existing Eclipse project?

I am new to Gradle, so please excuse me if this question seems naive or simple.

My eclipse project exists and works well, and I want to add Logback for my logging. It's easy enough to get the dependencies installed in the build.gradle file ...

dependencies {
    groovy group: 'org.codehaus.groovy', name: 'groovy', version: '1.8.3'

    // Logback dependencies    
    compile 'org.slf4j:slf4j-api:1.6.4'
    compile 'ch.qos.logback:logback-core:1.0.3'
    compile 'ch.qos.logback:logback-classic:1.0.3'
}

... and this allows my build to succeed, but how can I get it to update the Related Libraries section of my eclipse project? In other words, can I get gradle to update eclipse.classpath by adding the appropriate entries for any new libraries that have been contributed through the gradle dependencies?

As of now, I have to find out where in ~ / .gradle dependencies become JAR files, and manually create reference libraries to point to them. SK. There must be a way to automate this.

+3
source share
1 answer

I think you are looking for the Gradle Eclipse Plugin .

Just add apply plugin: 'eclipse'to the beginning of yours build.gradleand then try to run gradle eclipse. This will create all eclipse configuration files based on gradle configuration.

If you just need to create .classpath, you can do this by running gradle eclipseClasspath.

+10
source

All Articles