1

我一直在努力构建 Maven 3.0.5,尝试部署到 Sonatype 存储库,在 Windows XP 系统中使用 maven 发布插件和 maven gpg 插件。我的问题与这个SO question完全相同,但是那里提供的解决方案都不适合我。

我的 pom.xml 的相关片段是:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-release-plugin</artifactId>
    <version>2.4.1</version>
    <configuration>
        <arguments>-Dgpg.passphrase=${gpg.passphrase}</arguments>
        <!-- see http://jira.codehaus.org/browse/MGPG-9 -->
        <mavenExecutorId>forked-path</mavenExecutorId>
    </configuration>
</plugin>


<profiles>
   <profile>
        <id>release-sign-artifacts</id>
        <activation>
            <property>
                <name>performRelease</name>
                <value>true</value>
            </property>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-gpg-plugin</artifactId>
                    <configuration>
                        <passphrase>${gpg.passphrase}</passphrase>
                    </configuration>
                    <executions>
                        <execution>
                            <id>sign-artifacts</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>sign</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>  

<scm>
    <connection>scm:git:https://github.com/pentasoft/s3-static-uploader.git</connection>
    <developerConnection>scm:git:https://github.com/pentasoft/s3-static-uploader.git</developerConnection>
    <url>https://github.com/pentasoft/s3-static-uploader</url>
    <tag>s3-static-uploader-1.0</tag>
</scm>

我的构建的输出如下:

---
[INFO] BUILD SUCCESS
[INFO] ---------------------------------------------------------------------
---
[INFO] Total time: 29.737s
[INFO] Finished at: Fri Jul 05 15:58:20 CEST 2013
[INFO] Final Memory: 16M/40M
[INFO] ---------------------------------------------------------------------
---
[INFO] Checking in modified POMs...
[INFO] Executing: cmd.exe /X /C "git add -- pom.xml s3-static-uploader-plugin\po
m.xml s3-static-uploader-example1\pom.xml"
[INFO] Working directory: c:\Inetpub\wwwroot\Pentasoft.git\s3-static-uploader
[INFO] Executing: cmd.exe /X /C "git status"
[INFO] Working directory: c:\Inetpub\wwwroot\Pentasoft.git\s3-static-uploader
[INFO] Executing: cmd.exe /X /C "git commit --verbose -F C:\DOCUME~1\jgg\CONFIG~
1\Temp\maven-scm-870876840.commit pom.xml s3-static-uploader-plugin\pom.xml s3-s
tatic-uploader-example1\pom.xml"
[INFO] Working directory: c:\Inetpub\wwwroot\Pentasoft.git\s3-static-uploader
[INFO] Executing: cmd.exe /X /C "git symbolic-ref HEAD"
[INFO] Working directory: c:\Inetpub\wwwroot\Pentasoft.git\s3-static-uploader
[INFO] Executing: cmd.exe /X /C "git push https://github.com/pentasoft/s3-static
-uploader.git master:master"
[INFO] Working directory: c:\Inetpub\wwwroot\Pentasoft.git\s3-static-uploader

构建挂在这里。

我已经尝试了之前引用的 SO 问题中提供的所有解决方案,并且所有解决方案都产生了相同的结果。

4

1 回答 1

2

经过长时间的斗争,主要有两个问题。第一个与 pom.xml 文件的 scm 部分中指定的 url 有关。我的模式是 https 并且 github 提示我输入用户,但屏幕上没有显示该提示的输出。所以第一步是将 url 模式更改为以下内容:

<scm>
    <connection>scm:git:git@github.com:pentasoft/s3-static-uploader.git</connection>
    <developerConnection>scm:git:git@github.com:pentasoft/s3-static-uploader.git</developerConnection>
    <url>https://github.com/pentasoft/s3-static-uploader</url>
</scm>

其中 https 模式已被 ssh 模式替换。

修复此问题后,还有第二个关于 ssh 访问 Github 的问题。启动构建时,Github 回答如下:

The authenticity of host 'github.com (207.97.227.239)' can't be established. 
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48. 
Are you sure you want to continue connecting (yes/no)?

与上一个问题一样,这些提示没有显示,感觉是构建再次挂起。为了解决这个问题,我发出了命令ssh -T git@github.com(参见这个 Github指南),我对这个问题的回答是肯定的,以避免将来出现这个提示。

毕竟,构建不再挂起(按照@AWhitford 在先前引用的SO 问题中的说明进行操作)。

如果使用非 Windows 机器,这一切可能会更容易......

于 2013-07-12T15:02:35.710 回答