You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Lewis John Mcgibbney <le...@gmail.com> on 2013/01/28 06:49:20 UTC

Problem with GPG plugin

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.

Any ideas? Thanks in advnace

Lewis



-- 
*Lewis*

Re: Problem with GPG plugin

Posted by Ansgar Konermann <an...@googlemail.com>.
Run mvn in interactive (i. e. non-batch mode).

No idea how mvn ant tasks can be configured to use interactive mode though.
rtfm.

A.
Am 28.01.2013 06:49 schrieb "Lewis John Mcgibbney" <
lewis.mcgibbney@gmail.com>:

> 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.
>
> Any ideas? Thanks in advnace
>
> Lewis
>
>
>
> --
> *Lewis*
>