plugins:maven-jar-plugin:2.3.1:sign: java.lang.ExceptionInInitializerError: null

Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.3.1:sign (default) on project hudson-remoting: Execution default of goal org.apache.maven.plugins:maven-jar-plugin:2.3.1:sign failed: An API incompatibility was encountered while executing org.apache.maven.plugins:maven-jar-plugin:2.3.1:sign: java.lang.ExceptionInInitializerError: null
-----------------------------------------------------
realm =    plugin>org.apache.maven.plugins:maven-jar-plugin:2.3.1
strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
urls[0] = file:/Users/janksenhu/.m2/repository/org/apache/maven/plugins/maven-jar-plugin/2.3.1/maven-jar-plugin-2.3.1.jar
urls[1] = file:/Users/janksenhu/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar
urls[2] = file:/Users/janksenhu/.m2/repository/org/apache/maven/maven-archiver/2.4.1/maven-archiver-2.4.1.jar
urls[3] = file:/Users/janksenhu/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.13/plexus-interpolation-1.13.jar
urls[4] = file:/Users/janksenhu/.m2/repository/org/codehaus/plexus/plexus-archiver/1.0/plexus-archiver-1.0.jar
urls[5] = file:/Users/janksenhu/.m2/repository/org/codehaus/plexus/plexus-io/1.0/plexus-io-1.0.jar
urls[6] = file:/Users/janksenhu/.m2/repository/commons-lang/commons-lang/2.1/commons-lang-2.1.jar
urls[7] = file:/Users/janksenhu/.m2/repository/org/codehaus/plexus/plexus-utils/2.0.5/plexus-utils-2.0.5.jar
Number of foreign imports: 1
import: Entry[import  from realm ClassRealm[project>org.jvnet.hudson.main:hudson-remoting:2.2.2.0, parent: ClassRealm[maven.api, parent: null]]]

-----------------------------------------------------
: For input string: "13-a"
-> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException
 

该问题出现的根因是:java老项目以前都是在Java 1.7平台上编译的,大概4,5年前正常,最近进行jdk升级到13之后,编译就报错了,采用命令: mvn install -X 可以排查到详细的信息

主要解决问题的思路

1、pom.xml里面配置的 maven-compiler-plugin 升级到最新版本:3.8.1,里面配置的jdk版本升级到13

<source>13</source>

<target>13</target>

2、maven-pmd-plugin插件,targetJdk升级到13

3、maven-jar-plugin插件apache不维护了,切换到maven-jarsigner-plugin

<groupId>org.apache.maven.plugins</groupId>

        <artifactId>maven-jarsigner-plugin</artifactId>

        <configuration>

            <archiveDirectory>${project.basedir}/target</archiveDirectory>                  

        </configuration>

        <executions>

          <execution>

            <id>sign</id>

            <goals>

              <goal>sign</goal>

            </goals>

            <configuration>

              <!-- during the development, debug profile defined in ../pom.xml will cause the jars to be signed by a self-certified dummy public 

                key. For release, you should define the real values in ~/.m2/settings.xml -->

              <alias>${hudson.sign.alias}</alias>

              <storepass>${hudson.sign.storepass}</storepass>

              <keystore>${hudson.sign.keystore}</keystore>

            </configuration>

          </execution>

        </executions>

      </plugin>

4、plexus-utils 升级到3.3.0版本

5、在Java老版本一下写法合理,“_”在java 9之后当作关键字了,不能做不参数变量了需要修改

public void setNoCertificateCheck(boolean _) throws NoSuchAlgorithmException, KeyManagementException

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值