从Java8升级到Java11

JDK11升级

JAVA11升级

删除Java EE和CORBA模块

在JDK 11中,删除了Java EE和CORBA模块, 从jdk8等升级需要使用maven把相关依赖添加进来,删除的模块是:

java.xml.ws:用于XML Web服务的Java API(JAX-WS),用于Java平台的Web服务元数据以及用于Java的附件的SOAP(SAAJ)
java.xml.bind:用于XML绑定的Java体系结构(JAXB)
java.xml.ws.annotation:Java SE定义的JSR-250 Common Annotations的子集,用于支持Web服务
java.corba:CORBA
java.transaction:Java SE定义的Java Transaction API的子集,用于支持CORBA对象事务服务
java.activation:JavaBeans Activation Framework
java.se.ee:上面六个模块的聚合器模块
jdk.xml.ws:JAX-WS的工具
jdk.xml.bind:JAXB的工具

替代ws和jaxb的maven依赖

<!--JAXB依赖包-->
    <dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
        <version>2.3.1</version>
    </dependency>
    <!--java的jws服务依赖包-->
    <dependency>
        <groupId>javax.xml.ws</groupId>
        <artifactId>jaxws-api</artifactId>
        <version>2.3.1</version>
    </dependency>
    <dependency>
        <groupId>javax.jws</groupId>
        <artifactId>javax.jws-api</artifactId>
        <version>1.1</version>
    </dependency>
    <!--activation依赖,spring mvc使用了此依赖的内容-->
    <dependency>
        <groupId>com.sun.activation</groupId>
        <artifactId>javax.activation</artifactId>
        <version>1.2.0</version>
    </dependency>

其他依赖升级

另外可能有一些jar包不兼容jdk11,也需要做一些升级

Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: error at ::0 can't find referenced pointcut dataSource
Caused by: java.lang.IllegalArgumentException: error at ::0 can't find referenced pointcut msaServiceClient
都是一些切面相关的错误信息
aspectjweaver需要升级: 1.8.10--->1.8.13
<dependency>
    <groupId>org.aspectj</groupId>
    <artifactId>aspectjweaver</artifactId>
    <version>${aspectj.version}</version>
</dependency>

Maven打包报错

打包jar包的时候可能报错:

<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
<maven-assembly-plugin.version>3.1.1</maven-assembly-plugin.version>

Maven使用profile

使用profile,可以控制在jdk11和jdk8的时候自动使用不同的版本打包

<profiles>
    <profile>
        <id>jdk8</id>
        <activation>
            <jdk>[8,11]</jdk>
        </activation>
    </profile>
    <profile>
        <id>jdk11</id>
        <activation>
            <jdk>11</jdk>
            <property>
                <name>!jdk8</name>
            </property>
        </activation>
        <properties>
            <java.version>11</java.version>
        </properties>
    </profile>
</profiles>

JDK11环境强制使用jdk8打包

mvn clean package -Dmaven.test.skip=true -Djdk8

非法反射引用

暂时忽略:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils$1 (file:/E:/softs/maven/MVN_REPO/org/springframework/spring-core/4.3.24.RELEASE/spring-core-4.3.24.RELEASE.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of org.springframework.cglib.core.ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

评论

  1. Joseph
    3年前
    2021-9-02 15:07:50

    删除的模块中,标蓝色的行是表示什么呀?

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇