zoukankan      html  css  js  c++  java
  • java9模块不可见问题

    问题描述

    jdk.internal.reflect包不可见

    问题原因

    java9模块化之后,java.base只把jdk.internal.reflect暴露给了少数几个内部包而没有向当前模块暴露。

    解决方法

    alt+enter IDEA会自动提示解决方案,它的解决方案只针对.idea/compiler.xml。即便直接运行程序不报错,在执行mvn compile时也会报错,说jdk.internal.reflect不可见。

    <component name="JavacSettings">
      <option name="ADDITIONAL_OPTIONS_OVERRIDE">
        <module name="hanlp" options="--add-exports=java.base/jdk.internal.reflect=ALL-UNNAMED,hanlp" />
      </option>
    </component>
    

    需要进一步更改compiler插件的命令行参数

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
            <source>12</source>
            <target>12</target>
            <encoding>utf-8</encoding>
            <showDeprecation>true</showDeprecation>
            <showWarnings>true</showWarnings>
            <compilerArgument>
                --add-exports=java.base/jdk.internal.reflect=ALL-UNNAMED,hanlp
            </compilerArgument>
        </configuration>
    </plugin>
    
  • 相关阅读:
    修改图片大小 分辨率
    Tools
    写log
    4Sum
    3Sum Closest
    避免调试时加载符号
    SDN期末作业——负载均衡
    SDN第五次上机作业
    个人作业——软件工程实践总结作业
    SDN第四次作业
  • 原文地址:https://www.cnblogs.com/weiyinfu/p/11108091.html
Copyright © 2011-2022 走看看