Hello Martin, there is already an ant task in this codebase [1]:
Antoine [1] http://svn.apache.org/repos/asf/commons/sandbox/openpgp/trunk/src/main/java/org/apache/commons/openpgp/ant/OpenPgpSignerTask.java On Jan 31, 2013, at 3:49 PM, Martin Gainty wrote: > > Antoine > > can we take the Mojo source and re-factor to ANT taskdef class? > package org.apache.maven.plugin.gpg; /* * Licensed to the Apache Software > Foundation (ASF) under one * or more contributor license agreements. See the > NOTICE file * distributed with this work for additional information * > regarding copyright ownership. The ASF licenses this file * to you under the > Apache License, Version 2.0 (the * "License"); you may not use this file > except in compliance * with the License. You may obtain a copy of the > License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless > required by applicable law or agreed to in writing, * software distributed > under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR > CONDITIONS OF ANY * KIND, either express or implied. See the License for the > * specific language governing permissions and limitations * under the > License. */ > > import java.io.File;import java.io.IOException;import > java.util.ArrayList;import java.util.Iterator;import java.util.List;import > org.apache.maven.artifact.Artifact;import > org.apache.maven.plugin.MojoExecutionException;import > org.apache.maven.plugin.MojoFailureException;import > org.apache.maven.project.MavenProject;import > org.apache.maven.project.MavenProjectHelper;import > org.codehaus.plexus.util.FileUtils;import > org.codehaus.plexus.util.SelectorUtils; > > > > > http://maven.apache.org/plugins/maven-gpg-plugin/project-info.html > > Martin Gainty > ______________________________________________ > Jogi és Bizalmassági kinyilatkoztatás/Verzicht und > Vertraulichkeitanmerkung/Note de déni et de confidentialité > Ez az > üzenet bizalmas. Ha nem ön az akinek szánva volt, akkor kérjük, hogy > jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának > készítése nem megengedett. Ez az üzenet csak ismeret cserét szolgál és > semmiféle jogi alkalmazhatósága sincs. Mivel az electronikus üzenetek > könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet > ezen üzenet tartalma miatt. > > Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger > sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung > oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich > dem Austausch von Informationen und entfaltet keine rechtliche > Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen > wir keine Haftung fuer den Inhalt uebernehmen. > Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le > destinataire prévu, nous te demandons avec bonté que pour satisfaire informez > l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci > est interdite. Ce message sert à l'information seulement et n'aura pas > n'importe quel effet légalement obligatoire. Étant donné que les email > peuvent facilement être sujets à la manipulation, nous ne pouvons accepter > aucune responsabilité pour le contenu fourni. > >> Date: Wed, 30 Jan 2013 19:08:33 -0800 >> Subject: Re: Problem with GPG plugin from Ant task >> From: lewis.mcgibb...@gmail.com >> To: user@ant.apache.org >> >> Hi Antoine, >> Thank you very much for your suggestion. I need to be honest with you >> though and say that we ended up changing the entire build to Maven to fix >> the problem and now everything works fine. It was sapping hours of my time >> looking for an answer so we made the decision to shift :0( >> Thank you for the feedback, hopefully now that this thread exists others >> can benefit. >> Best >> Lewis >> >> On Wed, Jan 30, 2013 at 6:22 PM, Antoine Levy Lambert <anto...@gmx.de>wrote: >> >>> Hello Lewis, >>> >>> there is a project in the commons sandbox at Apache with which you can PGP >>> sign artifacts in an Ant build >>> >>> The source code is there [1] >>> >>> There is an example of usage of this here [2] >>> >>> We use that when producing releases of Ant. >>> >>> Maybe this can help you ? >>> >>> Regards, >>> >>> Antoine >>> >>> [1] http://svn.apache.org/repos/asf/commons/sandbox/openpgp/trunk/ >>> [2] http://svn.apache.org/repos/asf/ant/core/trunk/release/signit.xml >>> >>> >>> >>> On Jan 29, 2013, at 6:47 PM, Lewis John Mcgibbney wrote: >>> >>>> Hi, >>>> Having looked high and low for a resolution, I've been unable to find >>> one. >>>> I'm in the process of pushing a release on a small project which uses ant >>>> tasks + maven for the build lifecycle. >>>> I am attempting to deploy to sonatype staging repository with the >>> following >>>> configuration >>>> >>>> ... >>>> <!-- defined maven snapshots and staging repository id and url --> >>>> <property name="maven-snapshots-repository-id" >>>> value="sonatype-nexus-snapshots" /> >>>> <property name="maven-snapshots-repository-url" >>>> value="https://oss.sonatype.org/content/repositories/snapshots/ >>> "; >>>> /> >>>> <property name="maven-staging-repository-id" >>>> value="sonatype-nexus-staging" /> >>>> <property name="maven-staging-repository-url" >>>> value=" >>>> https://oss.sonatype.org/service/local/staging/deploy/maven2/"; >>>> /> >>>> ... >>>> <target name="stage" depends="dist" >>>> description="--> deploy release version to Maven staging >>>> repository" >>>> xmlns:artifact="urn:maven-artifact-ant"> >>>> <!-- sign and deploy the main artifact --> >>>> <artifact:mvn> >>>> <arg >>>> >>>> >>> value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" >>>> /> >>>> <arg value="-Durl=${maven-staging-repository-url}" /> >>>> <arg value="-DrepositoryId=${maven-staging-repository-id}" /> >>>> <arg value="-DpomFile=pom.xml" /> >>>> <arg value="-Dfile=${maven-jar}" /> >>>> <arg value="-Pgpg" /> >>>> </artifact:mvn> >>>> >>>> <!-- sign and deploy the sources artifact --> >>>> <artifact:mvn> >>>> <arg >>>> >>>> >>> value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" >>>> /> >>>> <arg value="-Durl=${maven-staging-repository-url}" /> >>>> <arg value="-DrepositoryId=${maven-staging-repository-id}" /> >>>> <arg value="-DpomFile=pom.xml" /> >>>> <arg value="-Dfile=${maven-sources-jar}" /> >>>> <arg value="-Dclassifier=sources" /> >>>> <arg value="-Pgpg" /> >>>> </artifact:mvn> >>>> >>>> <!-- sign and deploy the javadoc artifact --> >>>> <artifact:mvn> >>>> <arg >>>> >>>> >>> value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" >>>> /> >>>> <arg value="-Durl=${maven-staging-repository-url}" /> >>>> <arg value="-DrepositoryId=${maven-staging-repository-id}" /> >>>> <arg value="-DpomFile=pom.xml" /> >>>> <arg value="-Dfile=${maven-javadoc-jar}" /> >>>> <arg value="-Dclassifier=javadoc" /> >>>> <arg value="-Pgpg" /> >>>> </artifact:mvn> >>>> </target> >>>> >>>> However when I run the stage target, I get the following >>>> >>>> [artifact:mvn] [INFO] task-segment: >>>> [org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file] >>>> (aggregator-style) >>>> [artifact:mvn] [INFO] >>>> ------------------------------------------------------------------------ >>>> [artifact:mvn] [INFO] [gpg:sign-and-deploy-file] >>>> [artifact:mvn] [INFO] >>>> ------------------------------------------------------------------------ >>>> [artifact:mvn] [ERROR] BUILD FAILURE >>>> [artifact:mvn] [INFO] >>>> ------------------------------------------------------------------------ >>>> [artifact:mvn] [INFO] Cannot obtain passphrase in batch mode >>>> [artifact:mvn] [INFO] >>>> ------------------------------------------------------------------------ >>>> [artifact:mvn] [INFO] For more information, run Maven with the -e switch >>>> [artifact:mvn] [INFO] >>>> ------------------------------------------------------------------------ >>>> [artifact:mvn] [INFO] Total time: 2 seconds >>>> [artifact:mvn] [INFO] Finished at: Sun Jan 27 21:37:35 PST 2013 >>>> [artifact:mvn] [INFO] Final Memory: 16M/40M >>>> [artifact:mvn] [INFO] >>>> ------------------------------------------------------------------------ >>>> [artifact:mvn] Java Result: 1 >>>> >>>> There is very little on the dreaded "Cannot obtain passphrase in batch >>>> mode". >>>> Even when I use overrides on the command line e.g. ant stage >>>> -Dpassphrase=${passphrase}, I still get the above. >>>> >>>> Does anyone have a suggestion on how I can run Maven (from an Ant >>>> task) to operate in interactive (non-batch) mode? >>>> >>>> Any ideas? Thanks very much in advance >>>> >>>> Lewis >>>> >>>> >>>> >>>> -- >>>> *Lewis* >>> >>> >> >> >> -- >> *Lewis* >