Eclipse: How can I have gradle dependencies deployed to Tomcat

Refresh

April 2019

Views

302 time

1

I'm creating a web project using Gradle (buildship) in Eclipse (WTP). I've put the libraries I need as "implementation" dependencies in my build.gradle, however they are not copied to Tomcat when I try to run the project from within Eclipse. When I build the WAR file (with gradle war), however, all the jar files are there.

I can't find anywhere the solution for this. It's beeing awful to manually (and redundantly) copying every jar and its dependency to WEB-INF/libs just to be able to run the app from Eclipse).

2 answers

3

I've found a workaround here: https://github.com/eclipse/buildship/issues/496

It's adding this to build.gradle:

eclipse {
    wtp {
        component {
            libConfigurations += [configurations.runtimeClasspath]
        }
    }
}

With this everything gets properly deployed.

UPDATE!

Gradle 5.3 has just been released and includes a fix for this issue and the hack above is not needed anymore.

1

The only thing that worked for me was changing

dependencies {
    implementation group: 'org.projectlombok', name: 'lombok', version: '1.18.4'
}

too

dependencies {
    compile group: 'org.projectlombok', name: 'lombok', version: '1.18.4'
}