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

Don't include servlet-api JARs in WARs that we build #964

Merged
merged 2 commits into from
Dec 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ buildscript {
classpath libraries["gretty"]
classpath libraries["shadow"]
classpath libraries["coveralls-gradle-plugin"]
classpath libraries["gradle-extra-configurations-plugin"]

classpath libraries["guava"] // For various utility methods used in the build scripts.
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,7 @@ abstract class PublishingUtil {
}

assert pomDependencyNodes*.name()*.localPart.toUnique() == ['dependency']

// The compile-scoped dependencies of the project. The provided-scoped dependencies are
// already being handled by gradle-extra-configurations-plugin: https://goo.gl/xzRuLu

DependencySet projCompileDeps = projCompileConfig.dependencies

List<Node> depNodesToFix = pomDependencyNodes.findAll { Node pomDependencyNode ->
Expand Down
2 changes: 1 addition & 1 deletion dap4/d4servletshared/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ dependencies {
compile project(':netcdf4')
compile project(':cdm')

provided libraries["javax.servlet-api"]
compileOnly libraries["javax.servlet-api"]
compile libraries["slf4j-api"]
compile libraries["spring-web"]
compile libraries["spring-context"]
Expand Down
2 changes: 1 addition & 1 deletion dap4/d4ts/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ apply plugin: 'war'
dependencies {
compile project(':dap4:d4core')
compile project(':dap4:d4servletshared')
provided libraries["javax.servlet-api"]
compileOnly libraries["javax.servlet-api"]
}
4 changes: 2 additions & 2 deletions dap4/d4tswar/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ dependencies {
compile project(':dap4:d4ts')
compile project(':cdm')
compile project(':netcdf4')

provided libraries["javax.servlet-api"]
compileOnly libraries["javax.servlet-api"]
compile libraries["slf4j-api"]
runtime libraries["log4j-slf4j-impl"]
runtime libraries["log4j-core"]
Expand Down
35 changes: 18 additions & 17 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,40 +17,43 @@ allprojects { // Doesn't apply any plugins: safe to run closure on all projects
// which is a group repository that contains all other repositories. However, I prefer to list all source
// repos explicitly so that we know where all artifacts ultimately come from.

// Hosted repositories.
// Hosted releases repositories.
maven {
// For "threddsIso", "ncwms", "visad" and "jj2000".
url "https://artifacts.unidata.ucar.edu/repository/unidata-releases/"
}
maven {
// For "threddsIso" and "ncwms" snapshots.
url "https://artifacts.unidata.ucar.edu/repository/unidata-snapshots/"
}
maven {
// For "bounce" and several dependencies needed by "ncwms".
// Contains artifacts that are not available in any other Maven repository on the net.
// We should be concerned that we're relying on any such artifacts. TODO: Remove our dependence on these.
url "https://artifacts.unidata.ucar.edu/repository/unidata-3rdparty/"
}

// Proxied repositories. In the event that the remote repos go away, we still have copies of the artifacts.
// Third-party repositories.
maven {
// For "geotk-referencing", which is needed by "ncwms". Repositories are not inherited from a dependency,
// so we must duplicate ncwms's needed repos here. See https://stackoverflow.com/a/19908009/3874643.
// Proxies 'http://maven.geotoolkit.org/'.
url "https://artifacts.unidata.ucar.edu/repository/unidata-geotoolkit/"
url "http://maven.geotoolkit.org/"
}
maven {
url "https://dl.bintray.com/cwardgar/maven/" // For 'com.cwardgar.gretty-fork:gretty'.
}
maven {
// For "gretty". Proxies 'https://dl.bintray.com/cwardgar/maven/'.
url "https://artifacts.unidata.ucar.edu/repository/unidata-cwardgar/"
url "http://maven.asascience.com/maven/ncsos-releases/" // For "ncsos".
}
maven {
// For "ncsos". Proxies 'http://maven.asascience.com/maven/ncsos-releases/'.
url "https://artifacts.unidata.ucar.edu/repository/unidata-ncsos/"
url "http://52north.org/maven/repo/releases/" // For "52n-oxf-xmlbeans".
}

// Hosted snapshots repository. We want this to be last so that we can minimize warnings such as:
// Failed to get resource: HEAD. [HTTP HTTP/1.1 400 Repository version policy:
// SNAPSHOT does not allow version: 1.4:
// https://artifacts.unidata.ucar.edu/repository/unidata-snapshots/org/khelekore/prtree/1.4/prtree-1.4.pom]
// The warning is harmless, and is even an expected part of artifact resolution, but it's spammy as hell,
// especially when you're running something like "./gradlew dependencies".
maven {
// For "52n-oxf-xmlbeans". Proxies 'http://52north.org/maven/repo/releases/'.
url "https://artifacts.unidata.ucar.edu/repository/unidata-52north/"
// For "threddsIso" and "ncwms" snapshots.
url "https://artifacts.unidata.ucar.edu/repository/unidata-snapshots/"
}
}
}
Expand All @@ -66,14 +69,12 @@ ext {

////////////////////////////////////////// Plugins //////////////////////////////////////////

libraries["gretty"] = "com.cwardgar.gretty-fork:gretty:1.0.3"
libraries["gretty"] = "com.cwardgar.gretty-fork:gretty:2.0.1"

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

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

libraries["gradle-extra-configurations-plugin"] = "com.netflix.nebula:gradle-extra-configurations-plugin:2.2.1"

////////////////////////////////////////// Spring //////////////////////////////////////////

versions["spring"] = "4.3.13.RELEASE"
Expand Down
1 change: 0 additions & 1 deletion gradle/java.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import org.gradle.api.internal.java.JavaLibrary

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

sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
Expand Down
2 changes: 1 addition & 1 deletion opendap/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies {
compile project(':cdm')
compile project(':httpservices')

provided libraries["javax.servlet-api"]
compileOnly libraries["javax.servlet-api"]
compile libraries["jdom2"]
compile libraries["httpclient"]
compile libraries["httpcore"]
Expand Down
4 changes: 2 additions & 2 deletions opendap/dtswar/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ apply plugin: 'war'
dependencies {
compile project(':cdm')
compile project(':opendap')

provided libraries["javax.servlet-api"]
compileOnly libraries["javax.servlet-api"]
runtime libraries["taglibs-standard-impl"]

compile libraries["slf4j-api"]
Expand Down
14 changes: 12 additions & 2 deletions tds/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@ dependencies {
compile libraries["ncwms"]
compile libraries["oro"]

providedCompile libraries["javax.servlet-api"]
compileOnly libraries["javax.servlet-api"]
runtime libraries["taglibs-standard-impl"]
compile libraries["validation-api"]
runtime libraries["hibernate-validator"]
runtime libraries["jaxen"]


testCompile libraries["javax.servlet-api"] // Needed during test runtime as well, so testCompileOnly is no good.
testCompile libraries["spring-test"]
testCompile libraries["hamcrest-core"]
testCompile libraries["httpunit"]
Expand Down Expand Up @@ -93,6 +94,15 @@ processTestResources {
}

war {
// Assert that no servlet-api JAR is slated for inclusion in the WAR.
doFirst {
File servletApiJar = classpath.find { it.name.contains("servlet-api") }
if (servletApiJar) {
// This will fail the build.
throw new GradleException("Found a servlet-api JAR in the WAR classpath: ${servletApiJar.name}")
}
}

// Replace '$projectVersion' and '$buildTimestamp' placeholders with the correct values.
// Currently, we only use those placeholders in tds.properties and README.txt.
def properties = [:]
Expand Down