123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- 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
|