GWT代码服务器在使用maven原型的新生成的项目中找不到模块 [英] GWT Code Server not finding a module in a newly generated project using a maven archetype

查看:496
本文介绍了GWT代码服务器在使用maven原型的新生成的项目中找不到模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经和GWT和eclipse一起工作了一段时间了,我想用maven和GWT插件(gwt-maven-plugin,请在此输入链接描述)。我尝试使用它从日食(Luna 4.4),但显然我没有做到正确,因为它是非常脆弱的一点,它打破了一个常规的,因为IDE覆盖了它的设置,当我改变一些小的pom.xml。所以我决定退后一步,消除eclipse的黑魔法,并从头开始,从命令行开始一个新项目。

I've worked with GWT and eclipse for a while now and I wanted to play a bit with maven and the GWT plugin (gwt-maven-plugin, enter link description here). I tried to use it out of eclipse (Luna 4.4), but obviously I didn't do it correctly, as it was extremely brittle to the point that it broke on a regular basis as the IDE overwrote it's settings when I changed something small in the pom.xml. So I decided to take a step back and eliminate the black magic that eclipse is and start a new project from scratch from the command line.

然而,我似乎不可能得到运行实际应用程序的挂起,因为当我执行代码服务器时,导航到页面,我看到以下消息:

However, I cannot seem to be getting the hang of running the actual application, because when I execute the code server, navigate to the page, I see the following message:

Can't find any GWT Modules on this page.

显然,代码服务器正在运行,但是模块文件似乎没有被托管。 AFAIK我经过几个小时的教育,看到自己(并找到 http: //blog.ltgt.net/how-does-gwts-super-dev-mode-work/ ),应该有一个第二个进程实际上托管代码并行代码服务器。使用maven做什么适当的方法?我应该打开一个第二个终端,并运行一个码头或其他代码服务器并行吗?如果是这样,有人可以给我一个提示如何最有效地执行?

Obviously, the code server is running, however the module files seem to not have been hosted. AFAIK I see after several hours of educating myself (and finding http://blog.ltgt.net/how-does-gwts-super-dev-mode-work/), there should be a second process actually hosting the code in parallel to the code server. What is the appropriate way of doing this with maven? Should I open a second terminal and run a jetty or something else in parallel to the code server? If so, could someone please give me a hint how I can do it most efficiently?

提前感谢

这是我如何创建项目:

mvn archetype:generate \
   -DarchetypeGroupId=org.codehaus.mojo \
   -DarchetypeArtifactId=gwt-maven-plugin \
   -DarchetypeVersion=2.7.0
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:2.2:generate (default-cli) > generate-sources @ standalone-pom >>>
[INFO]
[INFO] <<< maven-archetype-plugin:2.2:generate (default-cli) < generate-sources @ standalone-pom <<<
[INFO]
[INFO] --- maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom ---
[INFO] Generating project in Interactive mode
[INFO] Archetype repository missing. Using the one from [org.codehaus.mojo:gwt-maven-plugin:2.7.0] found in catalog remote
Define value for property 'groupId': : com.mytest
Define value for property 'artifactId': : gwtmvntest
Define value for property 'version':  1.0-SNAPSHOT: :
Define value for property 'package':  com.mytest: : com.mytest.gwtmvntest
Define value for property 'module': : GwtMvnTest
Confirm properties configuration:
groupId: com.mytest
artifactId: gwtmvntest
version: 1.0-SNAPSHOT
package: com.mytest.gwtmvntest
module: GwtMvnTest
 Y: :
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Archetype: gwt-maven-plugin:2.7.0
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: com.mytest
[INFO] Parameter: artifactId, Value: gwtmvntest
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: com.mytest.gwtmvntest
[INFO] Parameter: packageInPathFormat, Value: com/mytest/gwtmvntest
[INFO] Parameter: package, Value: com.mytest.gwtmvntest
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: module, Value: GwtMvnTest
[INFO] Parameter: groupId, Value: com.mytest
[INFO] Parameter: artifactId, Value: gwtmvntest
[INFO] project created from Archetype in dir: /private/tmp/mvn/gwtmvntest
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 08:12 min
[INFO] Finished at: 2015-01-14T12:59:17+01:00
[INFO] Final Memory: 15M/310M
[INFO] ------------------------------------------------------------------------

这是我如何编译项目:

mvn compile gwt:compile
[INFO]扫描项目...
[INFO]
[INFO] -------------------------------------------------- ----------------------
[INFO]构建GWT Maven原型1.0-SNAPSHOT
[INFO] ------- -------------------------------------------------- ---------------
[INFO]
[INFO] --- gwt-maven-plugin:2.7.0:generateAsync(default)@ gwtmvntest - -
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources(default-resources)@ gwtmvntest ---
[INFO]使用'UTF-8'编码来复制过滤的资源。
[INFO]复制2个资源
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile(default-compile)@ gwtmvntest ---
[INFO]检测到更改 - 重新编译模块!
[INFO]将6个源文件编译到/private/tmp/mvn/gwtmvntest/target/gwtmvntest-1.0-SNAPSHOT/WEB-INF/classes
[INFO]
[INFO] - - gwt-maven-plugin:2.7.0:compile(default-cli)@ gwtmvntest ---
[INFO]编译模块com.mytest.gwtmvntest.GwtMvnTest
[INFO]编译5个排列
[INFO]编译排序0 ...
[INFO]进程输出
[INFO]编译
[INFO]编译排列4 ...
[INFO]
[INFO]编译
[INFO]编译排列3 ...
[INFO]进程输出
[INFO]编译
[INFO]编译排列2 ..
[INFO]进程输出
[INFO]编译
[INFO]编译排列1 ...
[INFO]成功排列的编译
[INFO]编译成功 - 13.866s
[INFO]链接到/private/tmp/mvn/gwtmvntest/target/gwtmvntest-1.0-SNAPSHOT/GwtMvnT est
[INFO]链接成功
[INFO]链接成功 - 0.171s
[INFO] -------------------- -------------------------------------------------- -
[INFO] BUILD SUCCESS
[INFO] -------------------------------- ----------------------------------------
[INFO]总时间: 18.228 s
[INFO]完成于:2015-01-14T13:07:07 + 01:00
[INFO]最终内存:22M / 310M
[INFO] -------------------------------------------------- -----------------

这是我如何运行项目:

mvn gwt:run-codeserver
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building GWT Maven Archetype 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> gwt-maven-plugin:2.7.0:run-codeserver (default-cli) > process-classes @ gwtmvntest >>>
[INFO]
[INFO] --- gwt-maven-plugin:2.7.0:generateAsync (default) @ gwtmvntest ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ gwtmvntest ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ gwtmvntest ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] <<< gwt-maven-plugin:2.7.0:run-codeserver (default-cli) < process-classes @ gwtmvntest <<<
[INFO]
[INFO] --- gwt-maven-plugin:2.7.0:run-codeserver (default-cli) @ gwtmvntest ---
[INFO] Turning off precompile in incremental mode.
[INFO] Super Dev Mode starting up
[INFO]    workDir: /var/folders/nk/58gyq85x7l3_mzb5rc0gw42w0000gn/T/gwt-codeserver-5859907708379954718.tmp
[INFO]    Loading Java files in com.mytest.gwtmvntest.GwtMvnTest.
[INFO]    Module setup completed in 11742 ms
[ERROR] 2015-01-14 13:14:35.800:INFO:oejs.Server:jetty-8.y.z-SNAPSHOT
[ERROR] 2015-01-14 13:14:35.833:INFO:oejs.AbstractConnector:Started SelectChannelConnector@127.0.0.1:9876
[INFO]
[INFO] The code server is ready at http://localhost:9876/


推荐答案

使用GWT 2.7+要启动 mvn gwt:run ,它将使用封面下的SuperDevMode,重新编译加载(而不是使用书签)。

请注意, gwt:run 不会复制您的 src / main / webapp 或您的依赖关系,因此您可能会必须运行 mvn war:explosion (或 mvn package )作为先决条件(并且每次更改文件

With GWT 2.7+ all you need is to launch mvn gwt:run and it'll use SuperDevMode under the cover, with "recompile on load" (instead of using bookmarklets).
Note that gwt:run won't copy your src/main/webapp or your dependencies, so you'll likely have to run mvn war:exploded (or mvn package) as a prerequisite (and every time you change a file in src/main/webapp or you need to refresh your dependencies)

这就是说,除非你的项目真的是简单的说,你应该在f开始使用不同的Maven模块或客户端和服务器代码;这是因为Maven坚持认为您不能在同一个POM中管理GWT客户端类路径和服务器端类路径。

我发布原型以帮助设置所有内容: https://github.com/tbroyer/gwt-maven-archetypes (我不幸的是没有时间尚未更新到GWT 2.7)

或者使用Gradle ...

That being said, unless your project is really simple, you should start using distinct Maven modules early for client and server code; this is because Maven insists that you cannot manage a "GWT client-side classpath" and a "server-side classpath" in the same POM.
I published archetypes to help setting everything up: https://github.com/tbroyer/gwt-maven-archetypes (I unfortunately haven't had the time yet to update them to GWT 2.7)
Either that or use Gradle…

这篇关于GWT代码服务器在使用maven原型的新生成的项目中找不到模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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