Maven中/ Java8生成编译错误:找不到符号JSObject.getWindow [英] Compilation error in Maven/Java8 build: Cannot find symbol JSObject.getWindow

查看:2305
本文介绍了Maven中/ Java8生成编译错误:找不到符号JSObject.getWindow的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经喜欢这里同样的问题<一href=\"http://stackoverflow.com/questions/13953920/not-able-to-resolve-jsobject-in-a-java-applet-project\">Not能够在Java小程序的项目来解决JSObject:

I've the same issue like here Not able to resolve JSObject in a java applet project :


  • JS​​Object从jfxrt.jar(JavaFX的)所采取的jdk内从代替plugin.jar,所以没有JSObject.getWindow方法和编译失败。

这里的问题是我已经构建与Java 8和Maven,所以我不能从构建路径中删除jfxrt.jar,似乎JDK和Maven依赖的顺序不能改变。

Problem here is that I've a build with java 8 and maven so I can't remove jfxrt.jar from the build path and it seems that the order of JDK and maven dependencies can't be changed.

那么,有没有办法以某种方式排除JavaFX的还是那里JSObject.getWindow从托管网站调用JavaScript的方法吗?

So is there a way to exclude JavaFX somehow or is there an alternative to JSObject.getWindow to call some JavaScript from the hosting website?

推荐答案

终于找到了解决方案(主要来自<一个href=\"http://apache-geronimo.328035.n3.nabble.com/Maven-compiler-endorsed-libraries-tp693448p702566.html\" rel=\"nofollow\">http://apache-geronimo.328035.n3.nabble.com/Maven-compiler-endorsed-libraries-tp693448p702566.html):

Finally found a solution (mainly taken from http://apache-geronimo.328035.n3.nabble.com/Maven-compiler-endorsed-libraries-tp693448p702566.html):


  • Java编译器有一个选项endorseddirs覆盖自举类

  • 如果您将plugin.jar内其中一个文件夹它覆盖JSObject从JavaFX的

  • 在你的Maven劲歌你必须告诉编译器插件搜索的文件夹,你可以使用依赖插件的依赖/文物复制到该文件夹​​

编译器插件:

<plugin>
 <artifactId>maven-compiler-plugin</artifactId>
 <configuration>
  <compilerArguments>
   <endorseddirs>${project.build.directory}/endorsed</endorseddirs>
  </compilerArguments>
 </configuration>
</plugin>

(如果你有plugin.jar作为Maven的依赖关系:)

(If you have the plugin.jar as a maven dependency:)

<plugin>
  <artifactId>maven-dependency-plugin</artifactId>
  <executions>
   <execution>
    <id>copy-endorsed-dependencies</id>
    <phase>generate-sources</phase>
    <goals>
     <goal>copy-dependencies</goal>
    </goals>
    <configuration>
     <includeArtifactIds>plugin</includeArtifactIds>
     <outputDirectory>${project.build.directory}/endorsed</outputDirectory>
    </configuration>
   </execution>
    ...
 </plugin>

这篇关于Maven中/ Java8生成编译错误:找不到符号JSObject.getWindow的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆