Hi,
Has anyone here successfully used Gradle to do maven deploys to Sonatypes maven
repo? This is my first external maven deploy so I guess I should have just gone
the easy path and used maven but I'd rather use Gradle if it's possible. They
have a set of fairly strict rules when it comes to what information needs to be
available and I can't seem to be able to add it all. Reqs:
https://docs.sonatype.org/display/Repository/Sonatype%20OSS%20Maven%20Repository%20Usage%20Guide#SonatypeOSSMavenRepositoryUsageGuide-6.CentralSyncRequirement
My main problem right now is that I can figure out how to add the packaging and
developers information to the pom. I've tried adding packaging to the builder
but nothing happens. The rest of the information seems to be added correctly.
This is my configuration:
apply plugin: 'groovy'
apply plugin: 'maven'
repositories {
mavenCentral()
mavenRepo urls: "http://m2repo.spockframework.org/snapshots"
}
dependencies {
groovy group: 'org.codehaus.groovy', name: 'groovy-all', version: '1.7.3'
compile 'net.sf.opencsv:opencsv:2.1'
testCompile "org.spockframework:spock-core:0.4-groovy-1.7"
testCompile "cglib:cglib-nodep:2.2"
testCompile "org.objenesis:objenesis:1.2"
}
version = '0.2-SNAPSHOT'
group = 'com.xlson.groovycsv'
packaging = 'jar'
sourceSets {
main {
groovy {
srcDir 'src'
}
}
test {
groovy {
srcDir 'test'
}
}
}
task groovydocJar(type: Jar, dependsOn: groovydoc) {
classifier = 'javadoc'
from 'build/docs/groovydoc'
}
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
artifacts {
archives groovydocJar
archives sourcesJar
}
configure(install.repositories.mavenInstaller) {
pom.project {
name 'GroovyCSV'
packaging 'jar' // not working
description 'Library for parsing csv in Groovy'
url 'http://github.com/xlson/groovycsv'
inceptionYear '2010'
scm {
url 'http://github.com/xlson/groovycsv'
connection 'http://github.com/xlson/groovycsv'
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
}
}
task downloadDeps << {
def libDir = file('lib')
ant.delete(dir: libDir)
copy {
from configurations.testRuntime
into libDir
}
}
The build is for this project: http://github.com/xlson/groovycsv
Kind regards,
/Leo
Blog: http://xlson.com/
Twitter: http://twitter.com/xlson