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*

Reply via email to