Skip to content
This repository was archived by the owner on Sep 1, 2022. It is now read-only.

Commit d2b01b1

Browse files
authoredDec 4, 2017
Merge pull request #964 from cwardgar/servletDep
Don't include servlet-api JARs in WARs that we build
2 parents 72df76d + afbb1ba commit d2b01b1

File tree

10 files changed

+38
-31
lines changed

10 files changed

+38
-31
lines changed
 

‎build.gradle

-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ buildscript {
6161
classpath libraries["gretty"]
6262
classpath libraries["shadow"]
6363
classpath libraries["coveralls-gradle-plugin"]
64-
classpath libraries["gradle-extra-configurations-plugin"]
6564

6665
classpath libraries["guava"] // For various utility methods used in the build scripts.
6766
}

‎buildSrc/src/main/groovy/edu/ucar/build/PublishingUtil.groovy

+1-3
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,7 @@ abstract class PublishingUtil {
129129
}
130130

131131
assert pomDependencyNodes*.name()*.localPart.toUnique() == ['dependency']
132-
133-
// The compile-scoped dependencies of the project. The provided-scoped dependencies are
134-
// already being handled by gradle-extra-configurations-plugin: https://goo.gl/xzRuLu
132+
135133
DependencySet projCompileDeps = projCompileConfig.dependencies
136134

137135
List<Node> depNodesToFix = pomDependencyNodes.findAll { Node pomDependencyNode ->

‎dap4/d4servletshared/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ dependencies {
55
compile project(':netcdf4')
66
compile project(':cdm')
77

8-
provided libraries["javax.servlet-api"]
8+
compileOnly libraries["javax.servlet-api"]
99
compile libraries["slf4j-api"]
1010
compile libraries["spring-web"]
1111
compile libraries["spring-context"]

‎dap4/d4ts/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ apply plugin: 'war'
33
dependencies {
44
compile project(':dap4:d4core')
55
compile project(':dap4:d4servletshared')
6-
provided libraries["javax.servlet-api"]
6+
compileOnly libraries["javax.servlet-api"]
77
}

‎dap4/d4tswar/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ dependencies {
77
compile project(':dap4:d4ts')
88
compile project(':cdm')
99
compile project(':netcdf4')
10-
11-
provided libraries["javax.servlet-api"]
10+
11+
compileOnly libraries["javax.servlet-api"]
1212
compile libraries["slf4j-api"]
1313
runtime libraries["log4j-slf4j-impl"]
1414
runtime libraries["log4j-core"]

‎gradle/dependencies.gradle

+18-17
Original file line numberDiff line numberDiff line change
@@ -17,40 +17,43 @@ allprojects { // Doesn't apply any plugins: safe to run closure on all projects
1717
// which is a group repository that contains all other repositories. However, I prefer to list all source
1818
// repos explicitly so that we know where all artifacts ultimately come from.
1919

20-
// Hosted repositories.
20+
// Hosted releases repositories.
2121
maven {
2222
// For "threddsIso", "ncwms", "visad" and "jj2000".
2323
url "https://artifacts.unidata.ucar.edu/repository/unidata-releases/"
2424
}
25-
maven {
26-
// For "threddsIso" and "ncwms" snapshots.
27-
url "https://artifacts.unidata.ucar.edu/repository/unidata-snapshots/"
28-
}
2925
maven {
3026
// For "bounce" and several dependencies needed by "ncwms".
3127
// Contains artifacts that are not available in any other Maven repository on the net.
3228
// We should be concerned that we're relying on any such artifacts. TODO: Remove our dependence on these.
3329
url "https://artifacts.unidata.ucar.edu/repository/unidata-3rdparty/"
3430
}
3531

36-
// Proxied repositories. In the event that the remote repos go away, we still have copies of the artifacts.
32+
// Third-party repositories.
3733
maven {
3834
// For "geotk-referencing", which is needed by "ncwms". Repositories are not inherited from a dependency,
3935
// so we must duplicate ncwms's needed repos here. See https://stackoverflow.com/a/19908009/3874643.
40-
// Proxies 'http://maven.geotoolkit.org/'.
41-
url "https://artifacts.unidata.ucar.edu/repository/unidata-geotoolkit/"
36+
url "http://maven.geotoolkit.org/"
37+
}
38+
maven {
39+
url "https://dl.bintray.com/cwardgar/maven/" // For 'com.cwardgar.gretty-fork:gretty'.
4240
}
4341
maven {
44-
// For "gretty". Proxies 'https://dl.bintray.com/cwardgar/maven/'.
45-
url "https://artifacts.unidata.ucar.edu/repository/unidata-cwardgar/"
42+
url "http://maven.asascience.com/maven/ncsos-releases/" // For "ncsos".
4643
}
4744
maven {
48-
// For "ncsos". Proxies 'http://maven.asascience.com/maven/ncsos-releases/'.
49-
url "https://artifacts.unidata.ucar.edu/repository/unidata-ncsos/"
45+
url "http://52north.org/maven/repo/releases/" // For "52n-oxf-xmlbeans".
5046
}
47+
48+
// Hosted snapshots repository. We want this to be last so that we can minimize warnings such as:
49+
// Failed to get resource: HEAD. [HTTP HTTP/1.1 400 Repository version policy:
50+
// SNAPSHOT does not allow version: 1.4:
51+
// https://artifacts.unidata.ucar.edu/repository/unidata-snapshots/org/khelekore/prtree/1.4/prtree-1.4.pom]
52+
// The warning is harmless, and is even an expected part of artifact resolution, but it's spammy as hell,
53+
// especially when you're running something like "./gradlew dependencies".
5154
maven {
52-
// For "52n-oxf-xmlbeans". Proxies 'http://52north.org/maven/repo/releases/'.
53-
url "https://artifacts.unidata.ucar.edu/repository/unidata-52north/"
55+
// For "threddsIso" and "ncwms" snapshots.
56+
url "https://artifacts.unidata.ucar.edu/repository/unidata-snapshots/"
5457
}
5558
}
5659
}
@@ -66,14 +69,12 @@ ext {
6669

6770
////////////////////////////////////////// Plugins //////////////////////////////////////////
6871

69-
libraries["gretty"] = "com.cwardgar.gretty-fork:gretty:1.0.3"
72+
libraries["gretty"] = "com.cwardgar.gretty-fork:gretty:2.0.1"
7073

7174
libraries["shadow"] = "com.github.jengelman.gradle.plugins:shadow:1.2.3"
7275

7376
libraries["coveralls-gradle-plugin"] = "org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.3.1"
7477

75-
libraries["gradle-extra-configurations-plugin"] = "com.netflix.nebula:gradle-extra-configurations-plugin:2.2.1"
76-
7778
////////////////////////////////////////// Spring //////////////////////////////////////////
7879

7980
versions["spring"] = "4.3.13.RELEASE"

‎gradle/java.gradle

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import org.gradle.api.internal.java.JavaLibrary
33

44
configure(javaProjects) {
55
apply plugin: 'java'
6-
apply plugin: 'provided-base' // Gives us the "provided" configuration.
76

87
sourceCompatibility = JavaVersion.VERSION_1_7
98
targetCompatibility = JavaVersion.VERSION_1_7

‎opendap/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ dependencies {
99
compile project(':cdm')
1010
compile project(':httpservices')
1111

12-
provided libraries["javax.servlet-api"]
12+
compileOnly libraries["javax.servlet-api"]
1313
compile libraries["jdom2"]
1414
compile libraries["httpclient"]
1515
compile libraries["httpcore"]

‎opendap/dtswar/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ apply plugin: 'war'
66
dependencies {
77
compile project(':cdm')
88
compile project(':opendap')
9-
10-
provided libraries["javax.servlet-api"]
9+
10+
compileOnly libraries["javax.servlet-api"]
1111
runtime libraries["taglibs-standard-impl"]
1212

1313
compile libraries["slf4j-api"]

‎tds/build.gradle

+12-2
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,13 @@ dependencies {
4343
compile libraries["ncwms"]
4444
compile libraries["oro"]
4545

46-
providedCompile libraries["javax.servlet-api"]
46+
compileOnly libraries["javax.servlet-api"]
4747
runtime libraries["taglibs-standard-impl"]
4848
compile libraries["validation-api"]
4949
runtime libraries["hibernate-validator"]
5050
runtime libraries["jaxen"]
51-
51+
52+
testCompile libraries["javax.servlet-api"] // Needed during test runtime as well, so testCompileOnly is no good.
5253
testCompile libraries["spring-test"]
5354
testCompile libraries["hamcrest-core"]
5455
testCompile libraries["httpunit"]
@@ -93,6 +94,15 @@ processTestResources {
9394
}
9495

9596
war {
97+
// Assert that no servlet-api JAR is slated for inclusion in the WAR.
98+
doFirst {
99+
File servletApiJar = classpath.find { it.name.contains("servlet-api") }
100+
if (servletApiJar) {
101+
// This will fail the build.
102+
throw new GradleException("Found a servlet-api JAR in the WAR classpath: ${servletApiJar.name}")
103+
}
104+
}
105+
96106
// Replace '$projectVersion' and '$buildTimestamp' placeholders with the correct values.
97107
// Currently, we only use those placeholders in tds.properties and README.txt.
98108
def properties = [:]

0 commit comments

Comments
 (0)
This repository has been archived.