maven编译找不到符号 sun.org.mozilla.javascript.internal

编程知识 行业动态 更新时间:2024-06-13 00:17:49


问题:

[ERROR] 位置: 类 cn.ffcs.dep.rule.script.javascript.JSAdapter 软件包 sun.mozilla.javascript.internal 不存在
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-p
lugin:3.1:compile (default-compile) on project sq-edi-component: Compilation failure
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)

Caused by: org.apache.maven.pluginpiler.CompilationFailureException: Compilation failure
        at org.apache.maven.pluginpiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:858)


解决:

 添加javac编译时的参数bootclasspath,oracle sun不鼓励开发人员直接使用sun.*里面的代码,主要的原因是sun.*里面的代码就是实现jvm的底层代码,是平台相关的,而且相关实现随着版本升级随时可能会被替换,代码的稳定性、一致性等等都存在问题. 参考下http://docs.oracle/javase/7/docs/technotes/tools/windows/javac.html javac的相关参数说明


Sometimes, you need to pass other compiler arguments that are not handled by the Compiler Plugin itself but is supported by the compilerId selected. For such arguments, the Compiler Plugin's compilerArguments will be used. The following example passes compiler arguments to the javac compiler:

<project>
  [...]
  <build>
    [...]
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.3.2</version>
        <configuration>
          <compilerArgument>-verbose -bootclasspath ${java.home}\lib\rt.jar</compilerArgument>
        </configuration>
      </plugin>
    </plugins>
    [...]
  </build>
  [...]
</project>

Or you can also use the Map version:

<project>
  [...]
  <build>
    [...]
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.3.2</version>
        <configuration>
          <compilerArguments>
            <verbose />
            <bootclasspath>${java.home}\lib\rt.jar</bootclasspath>
          </compilerArguments>
        </configuration>
      </plugin>
    </plugins>
    [...]
  </build>
  [...]
</project



更多推荐

maven编译找不到符号 sun.org.mozilla.javascript.internal

本文发布于:2023-03-25 20:22:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/0dfd08a8272c533efbb19629ba9b9c37.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:找不到   符号   sun   maven   javascript

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!