preslavrachev / maven-play-plugin

Automatically exported from code.google.com/p/maven-play-plugin
0 stars 0 forks source link

Error maven gpg plugin : cannot obtain passphrase #147

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi Grzegorz,

I tried to Mavenize a module (of my own, for my company)

My module's pom.xml has for parent the play-module-default-parent v1.0.0-beta7
And I copied the compile-app and dist profiles in my pom.xml file

I'm able to package on my PC. And also on my Jenkins CI server.
However I can't perform a release. The error is :

[INFO] [gpg:sign {execution: sign-artifacts}]
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Cannot obtain passphrase in batch mode

I think it's because the sonatype-oss-release module has been activated.

Here is what I launch in Jenkins (dry run release) :

Executing Maven:  -B -f /.../workspace/play-module-.../trunk/pom.xml 
-DdevelopmentVersion=1.4.2-SNAPSHOT -DreleaseVersion=1.4.1 -Dresume=false 
release:prepare -DdryRun=true -Dgoals=clean verify -P hudson,compile-app,dist -e

And here it what it is launched few lines after :

[INFO] ------------------------------------------------------------------------
[INFO] Building Play! framework module : XXXXXX
[INFO]    task-segment: [release:prepare] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [release:prepare {execution: default-cli}]
... (skip lines) ...
[INFO] Executing: /bin/sh -c cd /.../workspace/play-module-.../trunk && 
/.../maven_2.2.1/bin/mvn clean verify --no-plugin-updates --batch-mode 
-Psonatype-oss-release -P compile-app,dist,default,sonar,default,sonar

Could you help me to find what I did wrong ?
How to avoid to activate the sonatype-oss-release profile ?
I will try to remove the parent pom, and I will copy its content into my 
project pom. But I'm not confident that is the best way to mavenize my own 
private module.

Thanks for your help

Original issue reported on code.google.com by sebastie...@adeo.com on 3 Dec 2014 at 3:56

GoogleCodeExporter commented 9 years ago
Hi Sebastien

I've never released Play! module, I've always mavenized released versions :)

I will look at this problem.

Original comment by gslowiko...@gmail.com on 3 Dec 2014 at 4:46

GoogleCodeExporter commented 9 years ago
Your problem should not be related to play module. It looks more general. Have 
you successfully released other artifacts on the same machine before?

BTW, there are two possible ways of creating a module. You did it as pom or jar 
artifact with assemblies attached. There is better way IMO. Create it as 
regular "play" project. There are several differences between both methods. The 
most important is that you cannot use "play" packaging for a module containing 
"src" sources which must be compiled into separate jar file during module build 
(like in case of "play-testrunner" module).

Original comment by gslowiko...@gmail.com on 4 Dec 2014 at 7:49

GoogleCodeExporter commented 9 years ago
<< Have you successfully released other artifacts on the same machine before? >>

Yes, with the same environment (machine + Jenkins + job config)

Finally I found a workaround. Here is my pom.
It's based on 
https://code.google.com/p/maven-play-plugin/source/browse/tools/scripts/poms/mod
ules/deadbolt/1.5.4/pom-build-dist.xml
+ override maven release plugin config.

---------------
<?xml version="1.0" encoding="UTF-8"?>
<project ...>
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>com.google.code.maven-play-plugin</groupId>
        <artifactId>play-module-default-parent</artifactId>
        <version>1.0.0-beta7</version>
    </parent>

    <groupId>com.mycompany.play.modules.mymodule</groupId>
    <artifactId>play-module-mymodule</artifactId>
    <version>1.4.2-SNAPSHOT</version>
    <packaging>pom</packaging>

    <name>...</name>

    <scm>...</scm>

    <properties>
        <play.version>1.2.7</play.version>
        <play.module.frameworkVersions>1.2</play.module.frameworkVersions>
        <play.manifest.section>Play-module</play.manifest.section>
        <play.manifest.specification.title>${artifactId}</play.manifest.specification.title>
    </properties>

    <distributionManagement>...</distributionManagement>

    <repositories>
        <!-- as in https://code.google.com/p/maven-play-plugin/source/browse/tools/scripts/poms/modules/deadbolt/1.5.4/pom-build-dist.xml -->
        ...
    </repositories>

    <dependencies>
        <dependency>
            <groupId>com.google.code.maven-play-plugin.org.playframework</groupId>
            <artifactId>play</artifactId>
            <version>${play.version}</version>
            <scope>provided</scope>
        </dependency>
        <!-- mymodule dependencies -->
        ...
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <!-- force to avoid activation of profile "sonatype-oss-release" -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <configuration>
                    <arguments>-Pno-sonatype-oss-release</arguments>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <!-- as in https://code.google.com/p/maven-play-plugin/source/browse/tools/scripts/poms/modules/deadbolt/1.5.4/pom-build-dist.xml ("compile-app" and "dist" profiles) -->
        ...
    </profiles>
</project>
---------------

This sounds a little bit ugly for me, but I'm not a Maven expert and don't know 
how to do it better.
Maybe I should change something on my project, the Jenkins server or my job 
config to fix the GPG error. I don't know.

Original comment by sebastie...@adeo.com on 4 Dec 2014 at 9:19

GoogleCodeExporter commented 9 years ago
Yes, this looks way too verbose.

When I asked about previous releases on the same machine, I meant artifacts 
using 'org.sonatype.oss:oss-parent'. You can check, if releasing as simple as 
possible 'jar' artifact with 'org.sonatype.oss:oss-parent' parent will succeed.

I have some more hints for you.

1. You don't have to use 'play-module-default-parent' as parent (and 
'org.sonatype.oss:oss-parent' grand parent). How to do it? 
'play-module-default-parent''s content has to be copied to your module's 
'pom.xml'. You can skip, whet you don't need when copying.

Check this test project 
https://maven-play-plugin.googlecode.com/svn/trunk/test-projects/multimodule/pom
-with-assembly-as-module-dependency
'dep-module' module is exactly what you are creating now and it does not use 
play-module-default-parent' as parent.

Here is another test project 
https://maven-play-plugin.googlecode.com/svn/trunk/test-projects/multimodule/jar
-with-assembly-as-module-dependency containing module with jar (like 
play-testrunner).

2. You can try to write your module as regular 'play' application. Maybe you 
will prefer this way of creating a module (your module does not contain a jar 
file, so this method is possible).

See 
https://maven-play-plugin.googlecode.com/svn/trunk/test-projects/multimodule/pla
y-module-dependency

Original comment by gslowiko...@gmail.com on 4 Dec 2014 at 9:52

GoogleCodeExporter commented 9 years ago
Can we close this issue?

Original comment by gslowiko...@gmail.com on 21 Jan 2015 at 10:04

GoogleCodeExporter commented 9 years ago
Yes you can.
Thanks again for your help.

Original comment by sebastie...@adeo.com on 27 Jan 2015 at 8:27

GoogleCodeExporter commented 9 years ago
Actually this was not a bug, so closing as 'WontFix'.

Original comment by gslowiko...@gmail.com on 27 Jan 2015 at 12:41