For the record: yes, that helped. Thanks! Regards, Joern.
On 03.11.2010, at 16:37, Leonard Axelsson <[email protected]> wrote: > Response below... > > > > In reply to huxi: > >> Ok, tried it out. >> >> Now it's not crashing anymore but isn't producing the desired output anyway: >> >> Uploading: >> de/huxhorn/gradle/de.huxhorn.gradle.pgp-plugin/0.0.2/de.huxhorn.gradle.pgp-plugin-0.0.2.jar >> to repository remote at >> file:/Users/jhuxhorn/local-gradle-repository/release/ >> Uploading: >> de/huxhorn/gradle/de.huxhorn.gradle.pgp-plugin/0.0.2/de.huxhorn.gradle.pgp-plugin-0.0.2-source.jar >> to repository remote at >> file:/Users/jhuxhorn/local-gradle-repository/release/ >> Uploading: >> de/huxhorn/gradle/de.huxhorn.gradle.pgp-plugin/0.0.2/de.huxhorn.gradle.pgp-plugin-0.0.2.asc >> to repository remote at >> file:/Users/jhuxhorn/local-gradle-repository/release/ >> Uploading: >> de/huxhorn/gradle/de.huxhorn.gradle.pgp-plugin/0.0.2/de.huxhorn.gradle.pgp-plugin-0.0.2-javadoc.jar >> to repository remote at >> file:/Users/jhuxhorn/local-gradle-repository/release/ >> Uploading: >> de/huxhorn/gradle/de.huxhorn.gradle.pgp-plugin/0.0.2/de.huxhorn.gradle.pgp-plugin-0.0.2.asc >> to repository remote at >> file:/Users/jhuxhorn/local-gradle-repository/release/ >> Uploading: >> de/huxhorn/gradle/de.huxhorn.gradle.pgp-plugin/0.0.2/de.huxhorn.gradle.pgp-plugin-0.0.2.asc >> to repository remote at >> file:/Users/jhuxhorn/local-gradle-repository/release/ >> >> 15:56:04.812 [DEBUG] [org.gradle.api.Task] Added artifact: >> DefaultPublishArtifact >> de.huxhorn.gradle.pgp-plugin-0.0.2-javadoc.jar:asc:asc:null >> 15:56:04.947 [DEBUG] [org.gradle.api.Task] Added artifact: >> DefaultPublishArtifact >> de.huxhorn.gradle.pgp-plugin-0.0.2-source.jar:asc:asc:null >> 15:56:05.052 [DEBUG] [org.gradle.api.Task] Added artifact: >> DefaultPublishArtifact de.huxhorn.gradle.pgp-plugin-0.0.2.jar:asc:asc:null >> 15:56:05.052 [INFO] [org.gradle.api.Task] Created signature files >> '[/Users/jhuxhorn/Documents/Projects/huxi/huxi-gradle-plugins/pgp-gradle-plugin/build/libs/de.huxhorn.gradle.pgp-plugin-0.0.2-javadoc.jar.asc, >> >> /Users/jhuxhorn/Documents/Projects/huxi/huxi-gradle-plugins/pgp-gradle-plugin/build/libs/de.huxhorn.gradle.pgp-plugin-0.0.2-source.jar.asc, >> >> /Users/jhuxhorn/Documents/Projects/huxi/huxi-gradle-plugins/pgp-gradle-plugin/build/libs/de.huxhorn.gradle.pgp-plugin-0.0.2.jar.asc]'... >> >> This means that the name of the artifact is somehow overwritten. I create >> the DefaultPublishArtifact with name argument of >> 'de.huxhorn.gradle.pgp-plugin-0.0.2.jar' or >> 'de.huxhorn.gradle.pgp-plugin-0.0.2-source.jar', i.e. the original filename >> of the file the is signed. > > The DefaultPublishArtifact uses the metadata you provide to create a new > file, it will as far as I can tell not use any parts of the filename from the > old file. This means that you probably will have to parse the relevant > meta-data from the old filenames yourself. > > Example: adding the file containing the signature for the pom to the archives > configuration > > configurations.archives.addArtifact(new > DefaultPublishArtifact("com.xlson.groovycsv", 'Artifact Signature', > 'pom.asc', null, new Date(), new File(buildDir, 'pomForSigning.xml.asc'))) > > The metadata specified and the contents of the file will be used to create a > new file. > > Created name: groovycsv-0.2-20101103.pom.asc > > Now this will be different for you, but the principle holds true. I used some > regexp to parse the relevant filename information from the signed files and > then add it back as metadata. > > Example: > > libsDir.eachFileMatch(~/.*\.asc$/) { ascFile -> > def findClassifierPattern = > /$project.name-$version(?:-(.+))?\.jar\.asc/ > > assert ascFile.name ==~ findClassifierPattern > (ascFile.name =~ findClassifierPattern).find { fullName, classifier -> > configurations.archives.addArtifact(new > DefaultPublishArtifact("com.xlson.groovycsv", 'Artifact Signature', > 'jar.asc', classifier, new Date(), ascFile)) > } > > } > > > Hope this helps! > > Kindly, > /Leonard > >> >> I create the artifact like this: >> File file = originalFileWithDataThatWasSigned >> File f = fileContainingTheSignature >> def extension=f.name >> extension = extension.substring(extension.lastIndexOf('.')+1) >> DefaultPublishArtifact artifact = new DefaultPublishArtifact(file.name, >> extension, extension, null, new Date(), f, this) >> >> Did I misunderstand anything? DefaultPublishArtifact (or deployer) seems to >> perform some magic transformation on the filename and all manually added >> files end up as >> de/huxhorn/gradle/de.huxhorn.gradle.pgp-plugin/0.0.2/de.huxhorn.gradle.pgp-plugin-0.0.2.asc >> They are missing the original .jar and also got the already contained >> classifier removed. >> >> Cheers, >> Joern. >> >> On 03.11.2010, at 08:53, Adam Murdoch wrote: >> >>> >>> On 01/11/2010, at 10:14 AM, Joern Huxhorn wrote: >>> >>>> Hi again. >>>> >>>> I tried to use DefaultPluginArtifact to add additional files to the set of >>>> files that will be uploaded during uploadArchives. >>>> >>>> Without giving a classifier this results in >>>> org.gradle.api.GradleException: Could not publish configurations >>>> [configuration ':pgp-gradle-plugin:archives']. >>>> org.gradle.api.InvalidUserDataException: A pom can't have multiple main >>>> artifacts. Already assigned artifact: >>>> de.huxhorn.gradle#pgp-gradle-plugin;0.0.2!de.huxhorn.gradle.pgp-plugin.jar >>>> Artifact trying to assign: >>>> de.huxhorn.gradle#pgp-gradle-plugin;0.0.2!de.huxhorn.gradle.pgp-plugin-0.0.2-javadoc.jar.asc >>> >>> I've fixed this now in the master branch. Could you try this out with a new >>> snapshot of Gradle? >>> >>> >>> -- >>> Adam Murdoch >>> Gradle Developer >>> http://www.gradle.org >>> CTO, Gradle Inc. - Gradle Training, Support, Consulting >>> http://www.gradle.biz >>
