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
|
|
|
|
}
|
|
|
|
// 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'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(isWar) {
|
|
|
|
properties {
|
|
|
|
'm2eclipse.wtp.contextRoot' '/' + project.war.baseName
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(project.snapshotBuild) {
|
|
|
|
repositories {
|
|
|
|
repository {
|
|
|
|
id 'spring-snasphot'
|
|
|
|
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
|