Coming Up for Air

Gradle, 'provided' scope, and Java EE 7

Maven has a dependency scope, provided, that indicates that the dependency should not be in the archive. Gradle does not provide such a scope out of the box, but it’s easy enough to add. The following Gradle build demonstrates a very bare-bones Java EE 7 web application setup:

build.gradle

    
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
apply plugin: 'war'

repositories {
    mavenCentral()
    mavenLocal()
}

configurations {
    provided
}
sourceSets {
    main { compileClasspath += configurations.provided }
}

dependencies {
    provided 'javax:javaee-api:7.0'
}
tags: Gradle Java EE

Quotes

Sample quote

Quote source