Standardize Build
The build now uses spring build conventions to simplify the build Fixes gh-4284
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
apply plugin: 'org.springframework.boot'
|
||||
|
||||
sonarqube {
|
||||
skipProject = true
|
||||
}
|
||||
|
||||
configurations.all {
|
||||
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
|
||||
if (details.requested.group == 'org.springframework') {
|
||||
details.useVersion springVersion
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
apply plugin: 'checkstyle'
|
||||
|
||||
checkstyle {
|
||||
configFile = rootProject.file('etc/checkstyle/checkstyle.xml')
|
||||
configProperties.configDir = configFile.parentFile
|
||||
toolVersion = '6.16.1'
|
||||
}
|
||||
task checkstyle {
|
||||
dependsOn project.tasks.findAll { task -> task.name.matches('checkstyle\\w+') }
|
||||
}
|
||||
|
||||
check.dependsOn tasks.checkstyle
|
||||
@@ -0,0 +1,12 @@
|
||||
cglib\:cglib-nodep=3.2.5
|
||||
opensymphony\:sitemesh=2.4.2
|
||||
org.gebish\:geb-spock=0.10.0
|
||||
org.jasig.cas\:cas-server-webapp=4.0.0
|
||||
org.mockito\:mockito-core=1.10.19
|
||||
org.powermock\:powermock-api-mockito=1.6.2
|
||||
org.powermock\:powermock-api-support=1.6.2
|
||||
org.powermock\:powermock-core=1.6.2
|
||||
org.powermock\:powermock-module-junit4-common=1.6.2
|
||||
org.powermock\:powermock-module-junit4=1.6.2
|
||||
org.powermock\:powermock-reflect=1.6.2
|
||||
org.python\:jython=2.5.0
|
||||
@@ -1,98 +0,0 @@
|
||||
import org.gradle.plugins.ide.eclipse.model.SourceFolder
|
||||
|
||||
apply plugin: 'eclipse-wtp'
|
||||
apply plugin: 'propdeps-idea'
|
||||
apply plugin: 'propdeps-eclipse'
|
||||
|
||||
eclipse.classpath.downloadSources = true
|
||||
|
||||
|
||||
eclipse.project.buildCommand "net.sf.eclipsecs.core.CheckstyleBuilder"
|
||||
eclipse.project.natures "net.sf.eclipsecs.core.CheckstyleNature"
|
||||
|
||||
// Include project specific settings
|
||||
task eclipseCheckstyle(type: Copy) {
|
||||
from rootProject.files(
|
||||
"etc/eclipse/.checkstyle")
|
||||
into project.projectDir
|
||||
expand(configDir: rootProject.file('etc/checkstyle').absolutePath)
|
||||
}
|
||||
task eclipseSettings(type: Copy) {
|
||||
from rootProject.files(
|
||||
"etc/eclipse/org.eclipse.jdt.ui.prefs",
|
||||
"etc/eclipse/org.eclipse.wst.common.project.facet.core.xml")
|
||||
into project.file('.settings/')
|
||||
outputs.upToDateWhen { false }
|
||||
}
|
||||
|
||||
task eclipseWstComponent(type: Copy) {
|
||||
from rootProject.files(
|
||||
"etc/eclipse/org.eclipse.wst.common.component")
|
||||
into project.file('.settings/')
|
||||
expand(deployname: project.name)
|
||||
outputs.upToDateWhen { false }
|
||||
}
|
||||
|
||||
task eclipseJdtPrepare(type: Copy) {
|
||||
from rootProject.file("etc/eclipse/org.eclipse.jdt.core.prefs")
|
||||
into project.file(".settings/")
|
||||
outputs.upToDateWhen { false }
|
||||
}
|
||||
|
||||
task cleanEclipseJdtUi(type: Delete) {
|
||||
delete project.file(".settings/org.eclipse.jdt.core.prefs")
|
||||
delete project.file(".settings/org.eclipse.jdt.ui.prefs")
|
||||
delete project.file(".settings/org.eclipse.wst.common.component")
|
||||
delete project.file(".settings/org.eclipse.wst.common.project.facet.core.xml")
|
||||
}
|
||||
|
||||
tasks["eclipseJdt"].dependsOn(eclipseJdtPrepare)
|
||||
tasks["cleanEclipse"].dependsOn(cleanEclipseJdtUi)
|
||||
tasks["eclipse"].dependsOn(eclipseCheckstyle, eclipseSettings, eclipseWstComponent)
|
||||
|
||||
task eclipseConfiguration(dependsOn: [eclipseCheckstyle, eclipseSettings, eclipseWstComponent]) {
|
||||
}
|
||||
|
||||
eclipse {
|
||||
classpath {
|
||||
plusConfigurations += [ configurations.integrationTestCompile ]
|
||||
}
|
||||
}
|
||||
|
||||
// http://forums.gradle.org/gradle/topics/eclipse_wtp_deploys_testcode_to_server_example_provided
|
||||
eclipse.classpath {
|
||||
defaultOutputDir = file('bin/main')
|
||||
file.whenMerged { cp ->
|
||||
cp.entries.findAll { it instanceof SourceFolder && (it.path.contains("test") || it.path.contains("Test")) }*.output = "bin/test"
|
||||
}
|
||||
}
|
||||
|
||||
// GRADLE-1116
|
||||
project.eclipse.classpath.file.whenMerged { classpath ->
|
||||
classpath.entries.removeAll { entry -> entry.path.endsWith('/build/resources/test') }
|
||||
classpath.entries.removeAll { entry -> entry.path.endsWith('/build/classes/test') }
|
||||
classpath.entries.removeAll { entry -> entry.path.endsWith('/build/resources/main') }
|
||||
classpath.entries.removeAll { entry -> entry.path.endsWith('/build/classes/main') }
|
||||
}
|
||||
|
||||
// GRADLE-1422
|
||||
project.eclipseClasspath.doFirst {
|
||||
// delay adding whenMerged till the entryAttributes are added (must be the last whenMerged)
|
||||
project.eclipse.classpath.file.whenMerged { classpath ->
|
||||
def includeDeps = project.configurations.getByName('runtime').collect {f -> f.absolutePath } as Set
|
||||
classpath.entries.each { cp ->
|
||||
if(cp instanceof org.gradle.plugins.ide.eclipse.model.Library) {
|
||||
def include = includeDeps.contains(cp.path)
|
||||
def attr = 'org.eclipse.jst.component.dependency'
|
||||
if(!include) {
|
||||
cp.entryAttributes.remove(attr)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
project.idea.module {
|
||||
scopes.TEST.plus += [project.configurations.integrationTestRuntime]
|
||||
testSourceDirs += sourceSets.integrationTest.resources.srcDirs
|
||||
}
|
||||
@@ -1,244 +0,0 @@
|
||||
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'groovy'
|
||||
apply plugin: 'javadocHotfix'
|
||||
apply plugin: 'propdeps'
|
||||
apply plugin: 'propdeps-maven'
|
||||
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
|
||||
ext.apacheDsVersion = '1.5.5'
|
||||
ext.aspectjVersion = '1.8.4'
|
||||
ext.casClientVersion = '3.4.1'
|
||||
ext.cglibVersion = '3.2.5'
|
||||
ext.commonsCodecVersion = '1.10'
|
||||
ext.commonsCollectionsVersion = '3.2.2'
|
||||
ext.commonsLoggingVersion = '1.2'
|
||||
ext.ehcacheVersion = '2.9.0'
|
||||
ext.gebVersion = '0.10.0'
|
||||
ext.groovyVersion = '2.4.4'
|
||||
ext.hsqlVersion = '2.3.2'
|
||||
ext.hibernateVersion = '5.0.11.Final'
|
||||
ext.hibernateValidatorVersion = '5.2.4.Final'
|
||||
ext.jacksonDatabindVersion = '2.8.4'
|
||||
ext.javaPersistenceVersion = '2.1.1'
|
||||
ext.jettyVersion = '6.1.26'
|
||||
ext.jstlVersion = '1.2.1'
|
||||
ext.junitVersion = '4.12'
|
||||
ext.logbackVersion = '1.1.2'
|
||||
ext.powerMockVersion = '1.6.5'
|
||||
ext.seleniumVersion = '2.44.0'
|
||||
ext.servletApiVersion = '3.1.0'
|
||||
ext.slf4jVersion = '1.7.7'
|
||||
ext.spockVersion = '0.7-groovy-2.0'
|
||||
ext.springDataCommonsVersion = '1.12.2.RELEASE'
|
||||
ext.springDataJpaVersion = '1.10.2.RELEASE'
|
||||
ext.springDataRedisVersion = '1.7.2.RELEASE'
|
||||
ext.springSessionVersion = '1.2.1.RELEASE'
|
||||
ext.springBootVersion = '1.5.0.BUILD-SNAPSHOT'
|
||||
ext.thymeleafVersion = '3.0.2.RELEASE'
|
||||
ext.jsonassertVersion = '1.3.0'
|
||||
ext.validationApiVersion = '1.1.0.Final'
|
||||
|
||||
|
||||
ext.spockDependencies = [
|
||||
dependencies.create("org.spockframework:spock-spring:$spockVersion") {
|
||||
exclude group: 'junit', module: 'junit-dep'
|
||||
},
|
||||
dependencies.create("org.spockframework:spock-core:$spockVersion") {
|
||||
exclude group: 'junit', module: 'junit-dep'
|
||||
}
|
||||
]
|
||||
|
||||
ext.gebDependencies = spockDependencies + [
|
||||
"org.seleniumhq.selenium:selenium-htmlunit-driver:$seleniumVersion",
|
||||
"org.gebish:geb-spock:$gebVersion",
|
||||
'commons-httpclient:commons-httpclient:3.1',
|
||||
"org.codehaus.groovy:groovy:$groovyVersion",
|
||||
"org.codehaus.groovy:groovy-all:$groovyVersion"
|
||||
]
|
||||
|
||||
ext.powerMockDependencies = [
|
||||
"org.powermock:powermock-core:$powerMockVersion",
|
||||
"org.powermock:powermock-api-support:$powerMockVersion",
|
||||
"org.powermock:powermock-module-junit4-common:$powerMockVersion",
|
||||
"org.powermock:powermock-module-junit4:$powerMockVersion",
|
||||
dependencies.create("org.powermock:powermock-api-mockito:$powerMockVersion") {
|
||||
exclude group: 'org.mockito', module: 'mockito-all'
|
||||
},
|
||||
"org.powermock:powermock-reflect:$powerMockVersion"
|
||||
]
|
||||
|
||||
ext.springCoreDependency = [
|
||||
dependencies.create("org.springframework:spring-core:$springVersion") {
|
||||
exclude(group: 'commons-logging', module: 'commons-logging')
|
||||
}
|
||||
]
|
||||
|
||||
ext.jstlDependencies = [
|
||||
"javax.servlet.jsp.jstl:javax.servlet.jsp.jstl-api:$jstlVersion",
|
||||
"org.apache.taglibs:taglibs-standard-jstlel:1.2.1"
|
||||
]
|
||||
|
||||
ext.apachedsDependencies = [
|
||||
"org.apache.directory.server:apacheds-core:$apacheDsVersion",
|
||||
"org.apache.directory.server:apacheds-core-entry:$apacheDsVersion",
|
||||
"org.apache.directory.server:apacheds-protocol-shared:$apacheDsVersion",
|
||||
"org.apache.directory.server:apacheds-protocol-ldap:$apacheDsVersion",
|
||||
"org.apache.directory.server:apacheds-server-jndi:$apacheDsVersion",
|
||||
'org.apache.directory.shared:shared-ldap:0.9.15'
|
||||
]
|
||||
|
||||
// Integration test setup
|
||||
configurations {
|
||||
integrationTestCompile {
|
||||
extendsFrom testCompile, optional, provided
|
||||
}
|
||||
integrationTestRuntime {
|
||||
extendsFrom integrationTestCompile, testRuntime
|
||||
}
|
||||
springSnapshotTestRuntime.extendsFrom testRuntime
|
||||
}
|
||||
|
||||
configurations.springSnapshotTestRuntime {
|
||||
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
|
||||
if (details.requested.group == 'org.springframework') {
|
||||
details.useVersion 'latest.integration'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
integrationTest {
|
||||
java.srcDir file('src/integration-test/java')
|
||||
groovy.srcDirs file('src/integration-test/groovy')
|
||||
resources.srcDir file('src/integration-test/resources')
|
||||
compileClasspath = sourceSets.main.output + sourceSets.test.output + configurations.integrationTestCompile
|
||||
runtimeClasspath = output + compileClasspath + configurations.integrationTestRuntime
|
||||
}
|
||||
}
|
||||
|
||||
task integrationTest(type: Test, dependsOn: jar) {
|
||||
testClassesDir = sourceSets.integrationTest.output.classesDir
|
||||
logging.captureStandardOutput(LogLevel.INFO)
|
||||
classpath = sourceSets.integrationTest.runtimeClasspath
|
||||
maxParallelForks = 1
|
||||
reports {
|
||||
html.destination = project.file("$project.buildDir/reports/integration-tests/")
|
||||
junitXml.destination = project.file("$project.buildDir/integration-test-results/")
|
||||
}
|
||||
}
|
||||
|
||||
project.conf2ScopeMappings.addMapping(MavenPlugin.TEST_COMPILE_PRIORITY + 1, project.configurations.getByName("integrationTestCompile"), Conf2ScopeMappingContainer.TEST)
|
||||
project.conf2ScopeMappings.addMapping(MavenPlugin.TEST_COMPILE_PRIORITY + 2, project.configurations.getByName("integrationTestRuntime"), Conf2ScopeMappingContainer.TEST)
|
||||
check.dependsOn integrationTest
|
||||
|
||||
task springSnapshotTest(type: Test) {
|
||||
jvmArgs = ['-ea', '-Xmx500m', '-XX:MaxPermSize=128M']
|
||||
classpath = sourceSets.test.output + sourceSets.main.output + configurations.springSnapshotTestRuntime
|
||||
reports {
|
||||
html.destination = project.file("$buildDir/spring-snapshot-test-results/")
|
||||
junitXml.destination = project.file("$buildDir/reports/spring-snapshot-tests/")
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
optional "commons-logging:commons-logging:$commonsLoggingVersion"
|
||||
|
||||
testCompile "junit:junit:$junitVersion",
|
||||
'org.mockito:mockito-core:1.10.19',
|
||||
"org.springframework:spring-test:$springVersion",
|
||||
'org.assertj:assertj-core:3.6.2'
|
||||
|
||||
// Use slf4j/logback for logging
|
||||
testRuntime "org.slf4j:jcl-over-slf4j:$slf4jVersion",
|
||||
"ch.qos.logback:logback-classic:$logbackVersion"
|
||||
}
|
||||
|
||||
[configurations.runtime, configurations.default, configurations.testCompile]*.exclude(module: 'commons-logging')
|
||||
|
||||
configurations.all {
|
||||
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
|
||||
if (details.requested.group == 'org.slf4j') {
|
||||
details.useVersion slf4jVersion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
||||
|
||||
project.tasks.matching { it instanceof Test && it.name != 'integrationTest' }.all {
|
||||
jvmArgs = ['-ea', '-Xmx500m', '-XX:MaxPermSize=512m']
|
||||
maxParallelForks = guessMaxForks()
|
||||
logging.captureStandardOutput(LogLevel.INFO)
|
||||
}
|
||||
|
||||
def guessMaxForks() {
|
||||
int processors = Runtime.runtime.availableProcessors()
|
||||
return Math.max(2, (int) (processors / 2))
|
||||
}
|
||||
|
||||
jar {
|
||||
manifest.attributes["Created-By"] = 'Spring Security Team'
|
||||
manifest.attributes["Implementation-Title"] = project.name
|
||||
manifest.attributes["Implementation-Version"] = project.version
|
||||
manifest.attributes["Premain-Class"] =
|
||||
manifest.attributes["Agent-Class"] =
|
||||
manifest.attributes["Can-Redefine-Classes"] = "true"
|
||||
manifest.attributes["Can-Retransform-Classes"] = "true"
|
||||
manifest.attributes["Can-Set-Native-Method-Prefix"] = "false"
|
||||
}
|
||||
|
||||
javadoc {
|
||||
title = "Spring Security $version API"
|
||||
source = sourceSets.main.allJava
|
||||
logging.captureStandardError LogLevel.INFO
|
||||
logging.captureStandardOutput LogLevel.INFO
|
||||
options {
|
||||
memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
|
||||
author = true
|
||||
header = project.name
|
||||
outputLevel = org.gradle.external.javadoc.JavadocOutputLevel.QUIET
|
||||
links = [
|
||||
"http://static.springsource.org/spring/docs/3.2.x/javadoc-api/",
|
||||
"http://static.springsource.org/spring-ldap/docs/1.3.x/apidocs/",
|
||||
"http://download.oracle.com/javase/6/docs/api/"
|
||||
]
|
||||
groups = [
|
||||
'Spring Security Core':[
|
||||
'org.springframework.security.core*',
|
||||
'org.springframework.security.authentication*',
|
||||
'org.springframework.security.access*',
|
||||
'org.springframework.security.remoting*',
|
||||
'org.springframework.security.provisioning*',
|
||||
'org.springframework.security.util*'],
|
||||
'Spring Security Web':['org.springframework.security.web*'],
|
||||
'Spring Security LDAP':['org.springframework.security.ldap*'],
|
||||
'Spring Security Crypto':['org.springframework.security.crypto*'],
|
||||
'Spring Security OpenID':['org.springframework.security.openid*'],
|
||||
'Spring Security CAS':['org.springframework.security.cas*'],
|
||||
'Spring Security ACL':['org.springframework.security.acls*'],
|
||||
'Spring Security Config':['org.springframework.security.config*'],
|
||||
'Spring Security Taglibs':['org.springframework.security.taglibs*'],
|
||||
'Spring Security Test':['org.springframework.security.test*'],
|
||||
]
|
||||
addStringOption('-quiet')
|
||||
}
|
||||
}
|
||||
|
||||
if (JavaVersion.current().isJava8Compatible()) {
|
||||
tasks.withType(Javadoc) {
|
||||
// Turn off doclint in JDK 8 Javadoc (too strict on checks)
|
||||
options.addStringOption('Xdoclint:none', '-quiet')
|
||||
}
|
||||
}
|
||||
|
||||
task javadocJar(type: Jar) {
|
||||
classifier = 'javadoc'
|
||||
from javadoc
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives javadocJar
|
||||
}
|
||||
@@ -1,152 +0,0 @@
|
||||
apply plugin: 'maven'
|
||||
|
||||
// Create a source jar for uploading
|
||||
task sourceJar(type: Jar) {
|
||||
classifier = 'sources'
|
||||
from sourceSets.main.java.srcDirs
|
||||
include '**/*.java', '**/*.aj'
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives sourceJar
|
||||
}
|
||||
|
||||
// Configuration for SpringSource s3 maven deployer
|
||||
configurations {
|
||||
deployerJars
|
||||
}
|
||||
dependencies {
|
||||
deployerJars "org.springframework.build.aws:org.springframework.build.aws.maven:3.0.0.RELEASE"
|
||||
}
|
||||
|
||||
install {
|
||||
repositories.mavenInstaller {
|
||||
customizePom(pom, project)
|
||||
}
|
||||
}
|
||||
|
||||
def customizePom(pom, gradleProject) {
|
||||
pom.whenConfigured { p ->
|
||||
p.dependencies.findAll{ it.scope == "optional" }.each {
|
||||
it.scope = "compile"
|
||||
it.optional = true
|
||||
}
|
||||
p.dependencies.findAll{ it.groupId == "org.springframework" }.each {
|
||||
it.version = null
|
||||
}
|
||||
// sort to make pom dependencies order consistent to ease comparison of older poms
|
||||
p.dependencies = p.dependencies.sort { dep ->
|
||||
"$dep.scope:$dep.optional:$dep.groupId:$dep.artifactId"
|
||||
}
|
||||
}
|
||||
def isWar = project.hasProperty('war')
|
||||
pom.project {
|
||||
name = gradleProject.name
|
||||
if(isWar) {
|
||||
packaging = "war"
|
||||
}
|
||||
description = gradleProject.name
|
||||
url = 'http://spring.io/spring-security'
|
||||
organization {
|
||||
name = 'spring.io'
|
||||
url = 'http://spring.io/'
|
||||
}
|
||||
licenses {
|
||||
license {
|
||||
name 'The Apache Software License, Version 2.0'
|
||||
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
|
||||
distribution 'repo'
|
||||
}
|
||||
}
|
||||
scm {
|
||||
url = 'https://github.com/spring-projects/spring-security'
|
||||
connection = 'scm:git:git://github.com/spring-projects/spring-security'
|
||||
developerConnection = 'scm:git:git://github.com/spring-projects/spring-security'
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
id = 'rwinch'
|
||||
name = 'Rob Winch'
|
||||
email = 'rwinch@pivotal.io'
|
||||
}
|
||||
developer {
|
||||
id = 'jgrandja'
|
||||
name = 'Joe Grandja'
|
||||
email = 'jgrandja@pivotal.io'
|
||||
}
|
||||
}
|
||||
|
||||
if(!gradleProject.name.endsWith('-bom')) {
|
||||
dependencyManagement {
|
||||
dependencies {
|
||||
dependency {
|
||||
groupId 'org.springframework'
|
||||
artifactId 'spring-framework-bom'
|
||||
version project.springVersion
|
||||
type 'pom'
|
||||
scope 'import'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(isWar) {
|
||||
properties {
|
||||
'm2eclipse.wtp.contextRoot' '/' + project.war.baseName
|
||||
}
|
||||
}
|
||||
if(project.snapshotBuild) {
|
||||
repositories {
|
||||
repository {
|
||||
id 'spring-snapshot'
|
||||
url 'https://repo.spring.io/snapshot'
|
||||
}
|
||||
}
|
||||
} else if(!project.releaseBuild) {
|
||||
repositories {
|
||||
repository {
|
||||
id 'spring-milestone'
|
||||
url 'https://repo.spring.io/milestone'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// http://forums.gradle.org/gradle/topics/after_upgrade_gradle_to_2_0_version_the_maven_pom_not_support_build_property
|
||||
pom.withXml {
|
||||
def plugins = asNode().appendNode('build').appendNode('plugins')
|
||||
plugins
|
||||
.appendNode('plugin')
|
||||
.appendNode('artifactId','maven-compiler-plugin').parent()
|
||||
.appendNode('configuration')
|
||||
.appendNode('source','1.8').parent()
|
||||
.appendNode('target','1.8')
|
||||
if(isWar) {
|
||||
plugins
|
||||
.appendNode('plugin')
|
||||
.appendNode('artifactId','maven-war-plugin').parent()
|
||||
.appendNode('version','2.3').parent()
|
||||
.appendNode('configuration')
|
||||
.appendNode('failOnMissingWebXml','false')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task generatePom {
|
||||
group = 'Build'
|
||||
description = 'Generates a Maven pom.xml'
|
||||
|
||||
ext.generatedPomFileName = "pom.xml"
|
||||
onlyIf { install.enabled }
|
||||
|
||||
inputs.files(fileTree(project.rootProject.rootDir).include("**/*.gradle").files)
|
||||
inputs.files(new File(project.rootProject.rootDir, Project.GRADLE_PROPERTIES))
|
||||
outputs.files(generatedPomFileName)
|
||||
|
||||
doLast() {
|
||||
def p = pom {}
|
||||
customizePom(p, project)
|
||||
p.writeTo(generatedPomFileName)
|
||||
}
|
||||
}
|
||||
|
||||
build.dependsOn generatePom
|
||||
@@ -1,22 +0,0 @@
|
||||
task checkDependencies << {
|
||||
verifyNoDependenciesMatchingVersion(".*-SNAPSHOT")
|
||||
if(releaseBuild) {
|
||||
verifyNoDependenciesMatchingVersion(".*M.*")
|
||||
verifyNoDependenciesMatchingVersion(".*RC.*")
|
||||
}
|
||||
}
|
||||
|
||||
if(!snapshotBuild) {
|
||||
tasks.findByPath('check')?.dependsOn checkDependencies
|
||||
}
|
||||
|
||||
def verifyNoDependenciesMatchingVersion(def pattern) {
|
||||
def dependencies = configurations.all*.allDependencies*.findAll { d ->
|
||||
def ignored = 'io.spring.platform:platform-versions'
|
||||
def groupAndName = "$d.group:$d.name".toString()
|
||||
ignored != groupAndName && d.version?.matches(pattern)
|
||||
}.flatten().toSet().join("\n ")
|
||||
if(dependencies) {
|
||||
throw new GradleException("${project.name} cannot have dependencies with a version that matches $pattern when its version is ${project.version}. Got\n $dependencies")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
org.mockito\:mockito-core=1.10.19
|
||||
@@ -1,65 +0,0 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
maven { url "https://repo.spring.io/plugins-release" }
|
||||
}
|
||||
dependencies {
|
||||
classpath("com.bmuschko:gradle-tomcat-plugin:2.2.4")
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'com.bmuschko.tomcat'
|
||||
|
||||
dependencies {
|
||||
def tomcatVersion = '7.0.54'
|
||||
tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}",
|
||||
"org.apache.tomcat.embed:tomcat-embed-logging-juli:${tomcatVersion}",
|
||||
"org.apache.tomcat.embed:tomcat-embed-websocket:${tomcatVersion}",
|
||||
"org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}"
|
||||
}
|
||||
|
||||
task integrationTomcatRun(type: com.bmuschko.gradle.tomcat.tasks.TomcatRun) {
|
||||
onlyIf { !sourceSets.integrationTest.allSource.empty }
|
||||
daemon = true
|
||||
tomcatClasspath = tomcatRun.tomcatClasspath
|
||||
webAppClasspath = tomcatRun.webAppClasspath
|
||||
webAppSourceDirectory = tomcatRun.webAppSourceDirectory
|
||||
doFirst {
|
||||
def mainOutputDir = project.sourceSets.main.output.classesDir
|
||||
if(mainOutputDir) {
|
||||
classesDirectory = mainOutputDir
|
||||
}
|
||||
contextPath = tomcatRun.contextPath
|
||||
// delay reserving ports to ensure they are still available
|
||||
def ports = reservePorts(3)
|
||||
httpPort = ports[0]
|
||||
ajpPort = ports[1]
|
||||
stopPort = ports[2]
|
||||
}
|
||||
}
|
||||
|
||||
task integrationTomcatStop(type: com.bmuschko.gradle.tomcat.tasks.TomcatStop) {
|
||||
onlyIf { !sourceSets.integrationTest.allSource.empty }
|
||||
doFirst {
|
||||
stopPort = integrationTomcatRun.stopPort
|
||||
}
|
||||
}
|
||||
|
||||
integrationTest {
|
||||
dependsOn integrationTomcatRun
|
||||
doFirst {
|
||||
def host = 'localhost:' + integrationTomcatRun.httpPort
|
||||
systemProperties['geb.build.baseUrl'] = 'http://'+host+'/' + integrationTomcatRun.contextPath + '/'
|
||||
systemProperties['geb.build.reportsDir'] = 'build/geb-reports'
|
||||
}
|
||||
finalizedBy integrationTomcatStop
|
||||
}
|
||||
|
||||
def reservePorts(int count) {
|
||||
def sockets = []
|
||||
for(int i in 1..count) {
|
||||
sockets << new ServerSocket(0)
|
||||
}
|
||||
def result = sockets*.localPort
|
||||
sockets*.close()
|
||||
result
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
apply plugin: 'war'
|
||||
apply from: TOMCAT_GRADLE
|
||||
|
||||
war {
|
||||
baseName = "sample"
|
||||
}
|
||||
|
||||
sonarqube {
|
||||
skipProject = true
|
||||
}
|
||||
Reference in New Issue
Block a user