jarsigner没有使用JDK 1.7

时间:2016-10-13 12:32:35

标签: java maven ssl jdk1.7 maven-jarsigner-plugin

我们正在为我们的项目使用JDK 1.7,它在上周工作正常,但现在它失败了以下错误,

jarsigner:无法签署jar:javax.net.ssl.SSLHandshakeException:握手期间远程主机关闭连接

我开始知道这个问题是由于用于与时间戳服务器通信的协议,但我不知道如何通过pom.xml将参数传递给jdk以强制它使用TLSv1.2

我的Pom.xml文件

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <parent>
        <groupId>com.project.dews.common</groupId>
        <artifactId>CommonPom</artifactId>
        <version>2.2-SNAPSHOT</version>
        <relativePath>..</relativePath>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>UserNameApplet</artifactId>
    <version>2.2-SNAPSHOT</version>
    <packaging>jar</packaging>
    <name>User Name Applet</name>
    <build>
    <plugins>
        <plugin>
            <artifactId>maven-jar-plugin</artifactId>
            <configuration>
                <archive>
                    <addMavenDescriptor>false</addMavenDescriptor>
                    <manifestEntries>
                        <Trusted-Library>true</Trusted-Library>
                        <Permissions>all-permissions</Permissions>
                        <Codebase>*</Codebase>
                        <Caller-Allowable-Codebase>*</Caller-Allowable-Codebase>
                    </manifestEntries>
                </archive>
            </configuration>
        </plugin>
        <plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jarsigner-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>sign</goal>
                        <!--<goal>verify</goal>-->
                    </goals>
                    <phase>package</phase>
                    <configuration>
                        <keystore>src/main/keystore/keystore.ks</keystore>
                        <alias>85034585a-17b9-4a50-53e79d3a86345</alias>
                        <storepass>password</storepass>
                        <keypass>password</keypass>
                        <arguments>
                            <argument>-tsa</argument>
                            <argument>https://timestamp.geotrust.com/tsa</argument>
                        </arguments>
                        <!--<verbose>true</verbose>-->
                        <!--<certs>true</certs>-->
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
</project>

构建错误

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jarsigner-plugin:1.4:sign (default) on project UserNameApplet: Failed executing 'cmd.exe /X /C ""C:\JAVA 7\jdk1.7.0_71\jre\..\bin\jarsigner.exe" -keystore src/main/keystore/keystore.ks -storepass ***** -tsa https://timestamp.geotrust.com/tsa -keypass ***** C:\2.X_Dev_Code_SVN\Project\Common\Applet\target\UserNameApplet-2.1-SNAPSHOT.jar 85034585a-17b9-4a50-53e79d3a86345"' - exitcode 1 -> 
        [INFO] jarsigner: unable to sign jar:    javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake

我尝试从java控制面板禁用TLSv1.0和TLSv1.1,并使用jdk.tls.disabledAlgorithms = SSLv2Hello,SSLv3,TLSv1,TLSv1.1禁用它 来自java.security,但我在这两种情况下都失败了,而且对我来说,我只需要从pom.xml中解决问题。

非常感谢任何解决此问题的建议。

0 个答案:

没有答案