Web archives and Gradle "providedCompile"

I have a Gradle project that creates a WAR file that deploys under Wildfly.  Some of the dependencies are marked as "providedCompile" meaning the application server has them and they do not need to be packaged into the WAR file.

    providedCompile 'org.jboss.spec:jboss-javaee-6.0:3.0.1.Final'
    providedCompile 'org.jboss.resteasy:resteasy-jaxrs:2.3.1.GA'
    providedCompile 'org.codehaus.jackson:jackson-jaxrs:1.9.2'

When I build through Gradle outside of IntelliJ, the WAR file is created correctly and does not include the provided compile libraries.  It deploys on Wildfly correctly.

In IntelliJ, I create a project by opening the build.gradle.  The "external libraries" contain the provided compile libraries, which is correct so that I have access to them when writing code.  I then create an artifact for deployment.  That artifact should NOT contain the provided libraries, but by default it does.  The application will not deploy correctly because the duplicated libraries.

I can manually remove the extra libraries, but every time I refresh the Gradle project they come back.

I found an old closed that looks like the same problem:


However it is marked as fixed in 13.0.X and I am running 13.1.4.  

Am I doing something wrong or is this still a problem?  Does anyone know a workaround?


Comment actions Permalink

Any insight on this?  The more I read about IntelliJ gradle integration, the worse I realize it is.  This article is a year old, and while some things have improved, it still seems like a second-class citizen to Maven in Intellj.


I really like Gradle alot and it works perfectly on the command-line, but I'm starting to think I should just go back to Maven.  Is anyone else having similar issues?

Comment actions Permalink

which Gradle version do you use? if it's < 1.12 try to upgrade Gradle, see details at IDEA-126118

Comment actions Permalink

I updated to Gradle 2.1 and it fixed the problem.  Thanks.


Please sign in to leave a comment.