mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-02-24 16:05:15 +00:00
This can be used to generate the pom.xml for adding the Spring Security snapshot jars as a Maven Dependency to another project. For example, if mywebapp requires the Spring Security 3.1.4.CI-SNAPSHOT jars one could generate the pom.xml files and then use that to convert the project into a valid Maven project within the IDE. Then the SNAPSHOT dependendies could be added to mywebapp. This prevents the need to install the SNAPSHOT dependencies in the local Maven repository.
114 lines
3.6 KiB
Groovy
114 lines
3.6 KiB
Groovy
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
|
|
archives javadocJar
|
|
}
|
|
|
|
// Configuration for SpringSource s3 maven deployer
|
|
configurations {
|
|
deployerJars
|
|
}
|
|
dependencies {
|
|
deployerJars "org.springframework.build.aws:org.springframework.build.aws.maven:3.0.0.RELEASE"
|
|
}
|
|
|
|
// Remove the archive configuration from the runtime configuration, so that anything added to archives
|
|
// (such as the source jar) is no longer included in the runtime classpath
|
|
configurations.default.extendsFrom = [configurations.runtime] as Set
|
|
// Add the main jar into the default configuration
|
|
artifacts { 'default' jar }
|
|
|
|
install {
|
|
customizePom(repositories.mavenInstaller.pom, project)
|
|
}
|
|
|
|
def customizePom(pom, gradleProject) {
|
|
def optionalDeps = ['ehcache', 'log4j', 'apacheds-core', 'jsp-api', 'jsr250-api', 'ldapsdk', 'aspectjrt', 'aspectjweaver']
|
|
|
|
pom.scopeMappings.addMapping(10, configurations.provided, 'provided')
|
|
pom.whenConfigured { p ->
|
|
// Remove test scope dependencies from published poms
|
|
p.dependencies = p.dependencies.findAll {it.scope != 'test'}
|
|
|
|
// Flag optional deps
|
|
p.dependencies.findAll { dep ->
|
|
optionalDeps.contains(dep.artifactId) ||
|
|
dep.groupId.startsWith('org.apache.directory') ||
|
|
dep.groupId.startsWith('org.slf4j')
|
|
}*.optional = true
|
|
|
|
// Hack for specific case of config module
|
|
if (p.artifactId == 'spring-security-config') {
|
|
p.dependencies.find { dep -> dep.artifactId == 'spring-security-web'}.optional = true
|
|
p.dependencies.find { dep -> dep.artifactId == 'spring-web'}.optional = true
|
|
}
|
|
|
|
if (p.artifactId == 'spring-security-core') {
|
|
p.dependencies.find { dep -> dep.artifactId == 'spring-jdbc'}.optional = true
|
|
p.dependencies.find { dep -> dep.artifactId == 'spring-tx'}.optional = true
|
|
p.dependencies.removeAll { dep -> dep.artifactId == 'spring-security-crypto' }
|
|
}
|
|
}
|
|
|
|
pom.project {
|
|
name = gradleProject.name
|
|
description = gradleProject.name
|
|
url = 'http://springsource.org/spring-security'
|
|
organization {
|
|
name = 'SpringSource'
|
|
url = 'http://springsource.org/'
|
|
}
|
|
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/SpringSource/spring-security'
|
|
connection = 'scm:git:git://github.com/SpringSource/spring-security'
|
|
developerConnection = 'scm:git:git://github.com/SpringSource/spring-security'
|
|
}
|
|
developers {
|
|
developer {
|
|
id = 'rwinch'
|
|
name = 'Rob Winch'
|
|
email = 'rwinch@vmware.com'
|
|
}
|
|
}
|
|
dependencies {
|
|
dependency {
|
|
artifactId = groupId = 'commons-logging'
|
|
scope = 'compile'
|
|
optional = 'true'
|
|
version = '1.1.1'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
task generatePom {
|
|
group = 'Build'
|
|
description = 'Generates the Maven pom.xml'
|
|
|
|
ext.generatedPomFileName = 'pom.xml'
|
|
|
|
inputs.files('**/*.gradle')
|
|
outputs.files(generatedPomFileName)
|
|
|
|
doLast() {
|
|
def p = pom {}
|
|
customizePom(p, project)
|
|
p.writeTo(generatedPomFileName)
|
|
}
|
|
|
|
} |