2010-03-28 18:54:41 -04:00
|
|
|
apply plugin: 'maven'
|
2010-03-03 10:40:57 -05:00
|
|
|
|
|
|
|
// Create a source jar for uploading
|
|
|
|
task sourceJar(type: Jar) {
|
2015-03-23 12:14:26 -04:00
|
|
|
classifier = 'sources'
|
|
|
|
from sourceSets.main.java.srcDirs
|
|
|
|
include '**/*.java', '**/*.aj'
|
2010-03-03 10:40:57 -05:00
|
|
|
}
|
|
|
|
|
2010-08-02 22:01:53 -04:00
|
|
|
artifacts {
|
2015-03-23 12:14:26 -04:00
|
|
|
archives sourceJar
|
2010-08-02 22:01:53 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Configuration for SpringSource s3 maven deployer
|
2010-03-03 10:40:57 -05:00
|
|
|
configurations {
|
2015-03-23 12:14:26 -04:00
|
|
|
deployerJars
|
2010-03-03 10:40:57 -05:00
|
|
|
}
|
2010-08-02 22:01:53 -04:00
|
|
|
dependencies {
|
2015-03-23 12:14:26 -04:00
|
|
|
deployerJars "org.springframework.build.aws:org.springframework.build.aws.maven:3.0.0.RELEASE"
|
2010-03-03 10:40:57 -05:00
|
|
|
}
|
|
|
|
|
2011-04-28 08:45:01 -04:00
|
|
|
install {
|
2015-03-23 12:14:26 -04:00
|
|
|
repositories.mavenInstaller {
|
|
|
|
customizePom(pom, project)
|
|
|
|
}
|
2010-03-07 18:53:33 -05:00
|
|
|
}
|
2010-03-07 16:58:25 -05:00
|
|
|
|
2012-08-09 23:44:01 -04:00
|
|
|
def customizePom(pom, gradleProject) {
|
2015-03-23 12:14:26 -04:00
|
|
|
pom.whenConfigured { p ->
|
|
|
|
p.dependencies.findAll{ it.scope == "optional" }.each {
|
|
|
|
it.scope = "compile"
|
|
|
|
it.optional = true
|
|
|
|
}
|
2015-04-20 16:53:26 -04:00
|
|
|
p.dependencies.findAll{ it.groupId == "org.springframework" }.each {
|
|
|
|
it.version = null
|
|
|
|
}
|
2015-03-23 12:14:26 -04:00
|
|
|
// 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@gopivotal.com'
|
|
|
|
}
|
|
|
|
}
|
2015-04-20 18:06:01 -04:00
|
|
|
|
|
|
|
if(!gradleProject.name.endsWith('-bom')) {
|
|
|
|
dependencyManagement {
|
|
|
|
dependencies {
|
|
|
|
dependency {
|
|
|
|
groupId 'org.springframework'
|
|
|
|
artifactId 'spring-framework-bom'
|
|
|
|
version project.springVersion
|
|
|
|
type 'pom'
|
|
|
|
scope 'import'
|
|
|
|
}
|
2015-04-20 16:53:26 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-03-23 12:14:26 -04:00
|
|
|
if(isWar) {
|
|
|
|
properties {
|
|
|
|
'm2eclipse.wtp.contextRoot' '/' + project.war.baseName
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(project.snapshotBuild) {
|
|
|
|
repositories {
|
|
|
|
repository {
|
2015-09-25 16:29:04 -04:00
|
|
|
id 'spring-snapshot'
|
2015-03-23 12:14:26 -04:00
|
|
|
url 'https://repo.spring.io/snapshot'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if(!project.releaseBuild) {
|
|
|
|
repositories {
|
|
|
|
repository {
|
|
|
|
id 'spring-milestone'
|
|
|
|
url 'https://repo.spring.io/milestone'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-12-08 14:18:45 -05:00
|
|
|
|
2015-03-23 12:14:26 -04:00
|
|
|
// 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.7').parent()
|
|
|
|
.appendNode('target','1.7')
|
|
|
|
if(isWar) {
|
|
|
|
plugins
|
|
|
|
.appendNode('plugin')
|
|
|
|
.appendNode('artifactId','maven-war-plugin').parent()
|
|
|
|
.appendNode('version','2.3').parent()
|
|
|
|
.appendNode('configuration')
|
|
|
|
.appendNode('failOnMissingWebXml','false')
|
|
|
|
}
|
|
|
|
}
|
2012-11-01 12:22:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
task generatePom {
|
2015-03-23 12:14:26 -04:00
|
|
|
group = 'Build'
|
|
|
|
description = 'Generates a Maven pom.xml'
|
2012-11-01 12:22:41 -04:00
|
|
|
|
2015-03-23 12:14:26 -04:00
|
|
|
ext.generatedPomFileName = "pom.xml"
|
|
|
|
onlyIf { install.enabled }
|
2012-11-01 12:22:41 -04:00
|
|
|
|
2015-03-23 12:14:26 -04:00
|
|
|
inputs.files(fileTree(project.rootProject.rootDir).include("**/*.gradle").files)
|
|
|
|
inputs.files(new File(project.rootProject.rootDir, Project.GRADLE_PROPERTIES))
|
|
|
|
outputs.files(generatedPomFileName)
|
2012-11-01 12:22:41 -04:00
|
|
|
|
2015-03-23 12:14:26 -04:00
|
|
|
doLast() {
|
|
|
|
def p = pom {}
|
|
|
|
customizePom(p, project)
|
|
|
|
p.writeTo(generatedPomFileName)
|
|
|
|
}
|
2013-07-15 23:13:15 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
build.dependsOn generatePom
|