Maven jarsigner插件在发布期间不起作用

时间:2012-05-22 08:40:53

标签: java maven maven-3 maven-release-plugin jarsigner

我需要签署已发布的jar,我想用maven jarsigner插件来做。所以我这样添加:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jarsigner-plugin</artifactId>
            <version>1.2</version>
            <configuration>
                <archive>target/${myarchive}.jar</archive>
                <keystore>${key.location}</keystore>
                <storepass>${keypass}</storepass>
                <alias>${key.alias}</alias>
                <verbose>true</verbose>
            </configuration>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>sign</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

我在命令行中提供了缺少的参数。

当我运行mvn install时,一切正常,档案已签名。但是当我运行release:prepare release:perform jarsigner插件失败时:`目标org.apache.maven.plugins的参数'别名':maven-jarsigner-plugin:1.2:符号丢失或无效'

当我在调试模式下运行时,我看到以下内容:

mvn install

[DEBUG] Configuring mojo org.apache.maven.plugins:maven-jarsigner-plugin:1.2:sign from plugin realm ClassRealm[plugin>org.apache.m
aven.plugins:maven-jarsigner-plugin:1.2, parent: sun.misc.Launcher$AppClassLoader@6d6f0472]
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-jarsigner-plugin:1.2:sign' with basic configurator -->
[DEBUG]   (f) alias = myalias
[DEBUG]   (f) archive = myarchive
[DEBUG]   (f) arguments = []
[DEBUG]   (f) keystore = mykeystore
[DEBUG]   (f) processAttachedArtifacts = true
[DEBUG]   (f) processMainArtifact = true
[DEBUG]   (f) project = MavenProject: com.playtech.chat:ums_supportchatapplet:12.4-SNAPSHOT @ *********\pom.xml
[DEBUG]   (f) removeExistingSignatures = false
[DEBUG]   (f) skip = false
[DEBUG]   (f) storepass = changeit
[DEBUG]   (f) verbose = true
[DEBUG] -- end configuration --

但是当我运行release:prepare release:perform时,我看到了:

Configuring mojo org.apache.maven.plugins:maven-jarsigner-plugin:1.2:sign from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-jarsigner-plugin:1.2, parent: sun.misc.Launcher$AppClassLoader@553f5d07]
[INFO] [DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-jarsigner-plugin:1.2:sign' with basic configurator -->
[INFO] [DEBUG]   (f) archive = myarchive
[INFO] [DEBUG]   (f) arguments = []
[INFO] [DEBUG]   (f) processAttachedArtifacts = true
[INFO] [DEBUG]   (f) processMainArtifact = true
[INFO] [DEBUG]   (f) project = MavenProject: com.playtech.chat:ums_supportchatapplet:12.4.0.1 @ *****\pom.xml
[INFO] [DEBUG]   (f) removeExistingSignatures = false
[INFO] [DEBUG]   (f) skip = false
[INFO] [DEBUG]   (f) verbose = true
[INFO] [DEBUG] -- end configuration --

archive属性外,其他属性在发布期间将被忽略。

任何想法都受到高度赞赏。

2 个答案:

答案 0 :(得分:5)

找到答案。

简而言之,-D个参数不会从命令行传递给发布插件 应该使用-Darguments=

有关详细信息,请阅读帮助我解决此问题的blog post

答案 1 :(得分:0)

在cmd提示符下输入此命令:

keytool -list -keystore [keystore location here]

该特定密钥库中的'myalias'别名?如果不是,您需要create one

我能看到的另一件可能出错的事情是该密钥库的密码是否错误。