I took a very quick at your plugin and it seems promising. Maybe we can help 
eachother get the last bits working when we've figured out how to upload the 
asc files.

I've had some problems trying to add the asc files the artifacts as I mentioned 
in my last mail and will focus on that first but when that clears up I'll 
probably replace my solution with your plugin.


Mvh,
/Leo

QBRANCH: CODE
http://code.qbranch.se<http://code.qbranch.se/>

On 28 okt 2010, at 17.50, Joern Huxhorn wrote:

You might also be interested in the pgp-gradle-plugin at 
http://github.com/huxi/huxi-gradle-plugins
It's using bouncycastle to create the pgp-signatures so it's pure java.

Unfortunately, it's not finished yet. It creates the signature files but they 
aren't added to the artifact set, yet. I essentially have the same problem as 
you since the signatures are all that is still missing before I'd be able to 
deploy to the Sonatype OSS Repository.

Adam gave me some tips on IRC about how to fix this but I haven't had time to 
implement them.
He said that artifacts can be added to a configuration like this:
configurations.someConfig.addArtifact(new DefaultPublishArtifact(...))

Source is here: 
http://github.com/gradle/gradle/blob/master/subprojects/gradle-core/src/main/groovy/org/gradle/api/internal/artifacts/publish/DefaultPublishArtifact.java

Cheers,
Joern.


On 28.10.2010, at 16:50, Leonard Axelsson wrote:

Thanks for the help!

The xml modifications seems to be working for me. One thing though, CsvParser 
has a method called parseText that takes a String, so no need to down to the 
bytes and back.

Now I'm trying to publish the final 0.2 version and it seems the Sonatype repo 
requires all jar-files to be GPG signed. I figured out how to sign the files 
form gradle by calling out to gpg but I'm unsure how I should go about adding 
the signature files (groovycsv-0.2.jar.asc ...) to the upload. I've been 
reading the documentation trying to figure out how to add files to artifacts 
(is that what I should do?) but can only find examples of adding jar- and 
zip-files.

Any hints would be appreciated.

Kindly,
/Leo

----------------------------------
Leonard Axelsson

Blog: http://xlson.com/
Twitter: xlson


On 8 okt 2010, at 02.35, Adam Murdoch wrote:


On 07/10/2010, at 7:08 AM, Rene Groeschke wrote:

Hi Leonard,
I had a short look at your project on github and on the build.gradle file.

Am 06.10.10 15:15, schrieb Leonard Axelsson:
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.

I've retested the build with "Sonatype Nexus™ Professional Edition,
Version: 1.8.0" and the following uploadArchives configuration:

------------------
uploadArchives {
repositories.mavenDeployer {
configuration = configurations.archives
repository(url: "http://localhost:8081/nexus/content/repositories/test";) {
authentication(userName: "admin", password: "admin123")
}
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'
}
}

developers {
developer {
id 'donald'
name 'donald duck'
email 'don...@duck.org<mailto:'don...@duck.org>'
url 'http://www.donaldduck.org'
organization 'acme'
organizationUrl 'http://acme.org'
roles{
role 'architect'
}
timezone '-6'
}
}
}
}
}
------------------
I've detected two problems with the setup above:

1. It seems that gradle (or Ivy?) has a problem with the packaging
information. The model during the build is updated correctly, but it
seems that the info is never written into the pom.xml.

2. Using the defined developer informations above, the resulting pom
snippet is:

-----
<developers>
<developer>
<id>donald</id>
<name>donald duck</name>
<email>don...@duck.org</email>
<url>http://duck.org</url>
<organization>org.apache.maven.model.organizat...@4532b038</organization>
<organizationUrl>http://acme.org</organizationUrl>
<roles>
<role>architect</role>
</roles>
<timezone>-6</timezone>
</developer>
</developers>
-----

As you can see the organization isn't displayed correctly. It seems the
builder used to create that pom mixes up the organization model of
project with the plain string "organization" property of developer.

Maybe Adam or Hans know a workaround to get your upload running!?

It looks like both those issues are problems in the maven code that Gradle uses 
to do the pom generation. Gradle passes the correct packaging to the maven 
code. When the packaging is 'jar', the maven code ignores the packaging as it 
generates the pom. For the organisation, there seems to be a problem in the 
maven polygot configuration code, so that the organisation is set to the string 
value of project.organization instead of 'acme'

Here's what I ended up with, with some workaround for both those problems:

configure(install.repositories.mavenInstaller) {
    pom.project {
        name 'GroovyCSV'
//        packaging 'jar'
        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'
            }
        }

        developers {
            developer {
                id 'donald'
                name 'donald duck'
                email 'don...@duck.org<mailto:'don...@duck.org>'
                url 'http://www.donaldduck.org'
                organization = 'acme' // <-- note we use assignment here
                organizationUrl 'http://acme.org'
                roles {
                    role 'architect'
                }
                timezone '-6'
            }
        }
    }

    // Mess with the generated xml to add the packaging back in
    // This could probably be cleaner, if I knew the Groovy xml classes better
    pom.withXml { XmlProvider xmlProvider ->
        def xml = xmlProvider.asString()
        def pomXml = new XmlParser().parse(new 
ByteArrayInputStream(xml.toString().bytes))

        pomXml.version[0] + { packaging('jar') }

        def newXml = new StringWriter()
        def printer = new XmlNodePrinter(new PrintWriter(newXml))
        printer.preserveWhitespace = true
        printer.print(pomXml)
        xml.setLength(0)
        xml.append(newXml.toString())
    }
}

If you want, you could raise some JIRA issues for these problems.


--
Adam Murdoch
Gradle Developer
http://www.gradle.org<http://www.gradle.org/>
CTO, Gradle Inc. - Gradle Training, Support, Consulting
http://www.gradle.biz<http://www.gradle.biz/>




Reply via email to