简体   繁体   English

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

[英]Maven jarsigner plugin does not work during release

I need to sign the released jars and I want to do it with the maven jarsigner plugin. 我需要签署已发布的jar,我想用maven jarsigner插件来做。 So I added it like this: 所以我这样添加:

        <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>

I provide the missing parameters in command line. 我在命令行中提供了缺少的参数。

When I run mvn install everything works fine and the archive is got signed. 当我运行mvn install一切正常,存档已签名。 But when I run release:prepare release:perform the jarsigner plugin fails: `The parameters 'alias' for goal org.apache.maven.plugins:maven-jarsigner-plugin:1.2:sign are missing or invalid' 但是当我运行release:prepare release:perform jarsigner插件失败:`目标org.apache.maven.plugins的参数'别名':maven-jarsigner-plugin:1.2:符号丢失或无效'

When I run in debug mode, I see the following: 当我在调试模式下运行时,我看到以下内容:

For mvn install : 对于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 --

But when I run release:prepare release:perform , I see: 但是当我运行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 --

So except of archive property, other properties are ignored during the release. 因此除了archive属性之外,在发布期间将忽略其他属性。

Any ideas are highly appreciated. 任何想法都受到高度赞赏。

Found the answer. 找到了答案。

In short -D arguments are not passed from the command line to the release plugin. 简而言之, -D参数不会从命令行传递到发布插件。
-Darguments= should be used. -Darguments=应该使用。

For more details please read this blog post that helped me to resolve this issue. 有关详细信息,请阅读此博客文章 ,帮助我解决此问题。

Enter this command at the cmd prompt: 在cmd提示符下输入以下命令:

keytool -list -keystore [keystore location here]

Is the 'myalias' alias in that specific keystore? 在该特定密钥库中是'myalias'别名吗? If not you'll need to create one . 如果没有,你需要创建一个

The only other thing that I can see that could go wrong is if the password is incorrect for that keystore. 我能看到的另一件可能出错的事情是该密钥库的密码是否正确。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM