Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/gwt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
GWT2.8 beta1-尝试使用jsinterop从javascript调用java方法_Gwt_Gwt Maven Plugin_Gwt 2.8 - Fatal编程技术网

GWT2.8 beta1-尝试使用jsinterop从javascript调用java方法

GWT2.8 beta1-尝试使用jsinterop从javascript调用java方法,gwt,gwt-maven-plugin,gwt-2.8,Gwt,Gwt Maven Plugin,Gwt 2.8,我正在尝试使用最新的JsInterop从javascript调用gwt方法- 下面是我的html的头部部分 <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <!-- --> <!-- Consider i

我正在尝试使用最新的JsInterop从javascript调用gwt方法- 下面是我的html的头部部分

<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">

<!--                                                               -->
<!-- Consider inlining CSS to reduce the number of requested files -->
<!--                                                               -->
<link type="text/css" rel="stylesheet" href="Home.css">

<!--                                           -->
<!-- Any title is fine                         -->
<!--                                           -->
<title>Web Application Starter Project</title>

<!--                                           -->
<!-- This script loads your compiled module.   -->
<!-- If you add any GWT meta tags, they must   -->
<!-- be added before this line.                -->
<!--                                           -->
<script type="text/javascript" language="javascript"    src="Home/Home.nocache.js"></script>

</head>
在浏览器中,将调用body onload=myFunction(),并始终显示第一个警报

但是单击按钮someValue会显示myFunction的第一个警报,但是预期的host.Employee()总是显示未定义的警报

Home.html:47 Uncaught ReferenceError: host is not defined
你能告诉我这里出了什么问题吗

我正在为2.8.0-beta1构建gwt maven插件

更新-这是我的pom内容 4.0.0

  <parent>
    <artifactId>bi-parent-client</artifactId>
    <groupId>com.pa.bi</groupId>
    <version>0.0.1-SNAPSHOT</version>
  </parent>
  <groupId>com.pa.bi</groupId>
  <artifactId>bi-gwt-host</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>Maven Archetype for GWT</name>
<properties>
<!-- Convenience property to set the GWT version -->
<gwtVersion>2.8.0-beta1</gwtVersion>

<!-- GWT needs at least java 1.7 -->
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencyManagement>
<dependencies>
  <dependency>
    <groupId>com.google.gwt</groupId>
    <artifactId>gwt</artifactId>
    <version>${gwtVersion}</version>
    <type>pom</type>
    <scope>import</scope>
  </dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
  <groupId>com.google.gwt</groupId>
  <artifactId>gwt-servlet</artifactId>
  <scope>runtime</scope>
</dependency>
<dependency>
  <groupId>com.google.gwt</groupId>
  <artifactId>gwt-user</artifactId>
  <scope>provided</scope>
</dependency>
<dependency>
  <groupId>com.google.gwt</groupId>
  <artifactId>gwt-dev</artifactId>
  <scope>provided</scope>
</dependency>
<dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>4.11</version>
  <scope>test</scope>
</dependency>
</dependencies>

<build>
<!-- Output classes directly into the webapp, so that IDEs and "mvn process- classes" update them in DevMode -->
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>

<plugins>

  <!-- Mojo's Maven Plugin for GWT -->
  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>gwt-maven-plugin</artifactId>
    <version>2.8.0-beta1</version>
    <executions>
      <execution>
        <goals>
          <goal>compile</goal>
          <goal>test</goal>
          <goal>generateAsync</goal>
        </goals>
      </execution>
    </executions>
    <!-- Plugin configuration. There are many available options, see 
      gwt-maven-plugin documentation at codehaus.org -->
    <configuration>
      <runTarget>Home.html</runTarget>
      <modules>
        <module>com.pa.bi.gwt.host.Home</module>
      </modules>
      <copyWebapp>true</copyWebapp>
    </configuration>
  </plugin>
</plugins>
</build>
</project>

这通常意味着我需要继承一个模块,我在github上的gwt项目中寻找了一个这样的模块,但到目前为止运气不佳

这是GWT 2.8.0-beta1中使用SDM的
-generateJsInteropExports
时的一个已知问题;已修复但尚未发布:


尝试使用GWT 2.8.0-SNAPSHOT。

将立即试用。此外,没有一个可用的示例实际显示了这样做的简单示例。我不喜欢使用vaadin的东西和封装所有内部的库。我在哪里可以得到快照?我不认为他们在maven Central上严格地说,Central只托管发行版。GWT快照位于Sonatype OSSRH(有时被认为是“中央快照”)上,但位于一个特殊的存储库中:
https://oss.sonatype.org/content/repositories/google-snapshots/
我将上述回购协议添加到我当地的jfrog人工制品厂,我可以通过浏览看到那里的罐子。但由于某些原因,我的eclipse和.m2文件夹没有收到它。对于meI来说有点奇怪,他忘记将artifactory中配置的新repo添加到公开的虚拟repo,即远程repo。。现在jsinterop的工作方式就像一个符咒:)
Home.html:47 Uncaught ReferenceError: host is not defined
  <parent>
    <artifactId>bi-parent-client</artifactId>
    <groupId>com.pa.bi</groupId>
    <version>0.0.1-SNAPSHOT</version>
  </parent>
  <groupId>com.pa.bi</groupId>
  <artifactId>bi-gwt-host</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>Maven Archetype for GWT</name>
<properties>
<!-- Convenience property to set the GWT version -->
<gwtVersion>2.8.0-beta1</gwtVersion>

<!-- GWT needs at least java 1.7 -->
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencyManagement>
<dependencies>
  <dependency>
    <groupId>com.google.gwt</groupId>
    <artifactId>gwt</artifactId>
    <version>${gwtVersion}</version>
    <type>pom</type>
    <scope>import</scope>
  </dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
  <groupId>com.google.gwt</groupId>
  <artifactId>gwt-servlet</artifactId>
  <scope>runtime</scope>
</dependency>
<dependency>
  <groupId>com.google.gwt</groupId>
  <artifactId>gwt-user</artifactId>
  <scope>provided</scope>
</dependency>
<dependency>
  <groupId>com.google.gwt</groupId>
  <artifactId>gwt-dev</artifactId>
  <scope>provided</scope>
</dependency>
<dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>4.11</version>
  <scope>test</scope>
</dependency>
</dependencies>

<build>
<!-- Output classes directly into the webapp, so that IDEs and "mvn process- classes" update them in DevMode -->
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>

<plugins>

  <!-- Mojo's Maven Plugin for GWT -->
  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>gwt-maven-plugin</artifactId>
    <version>2.8.0-beta1</version>
    <executions>
      <execution>
        <goals>
          <goal>compile</goal>
          <goal>test</goal>
          <goal>generateAsync</goal>
        </goals>
      </execution>
    </executions>
    <!-- Plugin configuration. There are many available options, see 
      gwt-maven-plugin documentation at codehaus.org -->
    <configuration>
      <runTarget>Home.html</runTarget>
      <modules>
        <module>com.pa.bi.gwt.host.Home</module>
      </modules>
      <copyWebapp>true</copyWebapp>
    </configuration>
  </plugin>
</plugins>
</build>
</project>
<add-linker name="xsiframe" />
<set-configuration-property name="devModeRedirectEnabled"
    value="true" />
<generateJsInteropExports>true</generateJsInteropExports>
[ERROR] Unable to find 'JS_RC.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?