Java 如何让 GWT 超级开发模式与 IntelliJ 一起工作
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23841301/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to get GWT Super Dev Mode to work with IntelliJ
提问by Click Upvote
I had a lot of issues getting Super Dev mode to work with IntelliJ. This question, and my answer below, are to document how to do this, for anyone else who might come across this in future (and for my own reference):
我在让超级开发模式与 IntelliJ 一起工作时遇到了很多问题。这个问题,以及我在下面的回答,是为了记录如何做到这一点,以供将来可能遇到此问题的任何人(以及我自己的参考):
采纳答案by breandan
IntelliJ IDEA 14 EAPnow offers improved support for GWT Super Dev Mode. You will need to use the JetBrains IDE Pluginfor JavaScript debugging on Chrome, and install GWT 2.6.1. You can then enable Super Dev Mode support directly under "Run configurations" - for more information, check out our blog postand this webinarfor a quick demonstration.
IntelliJ IDEA 14 EAP现在提供对 GWT 超级开发模式的改进支持。您需要使用JetBrains IDE 插件在 Chrome 上进行 JavaScript 调试,并安装GWT 2.6.1。然后,您可以直接在“运行配置”下启用超级开发模式支持 - 有关更多信息,请查看我们的博客文章和此网络研讨会以进行快速演示。
回答by Click Upvote
1) Put the following lines in the module's .gwt.xml code:
1) 在模块的 .gwt.xml 代码中加入以下几行:
<!-- Super Dev Mode Config: -->
<add-linker name="xsiframe" />
<set-configuration-property name="devModeRedirectEnabled" value="true" />
<set-configuration-property name="gwt.superdevmode" value="on" />
<set-property name="compiler.useSourceMaps" value="true"/>
2) Make two GWT run configurations in IntelliJ, one with Super Dev mode turned on, and the other with super dev mode off.
2) 在 IntelliJ 中进行两个 GWT 运行配置,一个打开超级开发模式,另一个关闭超级开发模式。
First config (Code Server):
第一个配置(代码服务器):
Second config (Dev mode):
第二个配置(开发模式):
3) Run the CodeServer run config. It will give an output such as:
3) 运行 CodeServer 运行配置。它将给出如下输出:
The code server is ready.
Next, visit: http://localhost:9876/
Visit that URL. There will be a 'Dev mode on' button. Drag it to bookmarks bar. Then, click the name of the module on this page, browse its source code to locate the .nocache.js file.
访问那个网址。将有一个“开发模式开启”按钮。将其拖到书签栏。然后,单击此页面上的模块名称,浏览其源代码以找到 .nocache.js 文件。
4) Within the host page html, change the path to the existing nocache.js file to point to the nocache.js file whose link was copied in step 3. E.g:
4) 在主机页面 html 中,将现有 nocache.js 文件的路径更改为指向在步骤 3 中复制其链接的 nocache.js 文件。例如:
<script type="text/javascript" language="javascript" src="http://localhost:9876/Touch/Touch.nocache.js"></script>
5) Now run the 2nd run config. It will go to the gwt dev mode url, with ?gwt=
etc url arguments. Remove those url arguments, and refresh the page. You should now be able to see the host page. If the code server run config is already running, then GWT code might automatically run.
5) 现在运行第二个运行配置。它将转到 gwt 开发模式 url,带有?gwt=
等 url 参数。删除这些 url 参数,然后刷新页面。您现在应该能够看到主机页面。如果代码服务器运行配置已在运行,则 GWT 代码可能会自动运行。
6) When any changes are made to the project, simply click the 'Dev mode on' bookmarklet that was added earlier. It will give the name of the module, and a compile button. Click the Compile button, and it will recompile the module (happens fairly quickly), and refresh the page.
6) 对项目进行任何更改时,只需单击先前添加的“Dev mode on”书签即可。它将给出模块的名称和一个编译按钮。单击 Compile 按钮,它将重新编译模块(发生得相当快),并刷新页面。
7) The compile button can also be dragged to the bookmark bar, to skip the step of clicking the 'Dev mode on' bookmark.
7) 也可以将编译按钮拖到书签栏,跳过点击'Dev mode on'书签的步骤。
EDIT: This answer is not complete and has some issues. If someone would like to correct it, please edit it. If anyone reviewers see edits on this answer, please approve them.
编辑:这个答案不完整,有一些问题。如果有人想更正它,请编辑它。如果任何审阅者看到对此答案的编辑,请批准它们。
回答by telmo
@Click Upvote 's answer is not right. You don't have to replace the host html page is script tag's src attribute. Or you'll find out every GWT RPC request will send to port 9876(on which the code server runs) instead of the web server port(8080 for example).
@Click Upvote 的答案不正确。您不必替换主机 html 页面是脚本标记的 src 属性。或者您会发现每个 GWT RPC 请求都将发送到端口 9876(代码服务器在其上运行)而不是 Web 服务器端口(例如 8080)。
there is a post talking about this problem here.
有一个帖子在这里讨论这个问题。
by the way i'm using gwt 2.6.1 and Intellij 13.0.1
顺便说一下,我使用的是 gwt 2.6.1 和 Intellij 13.0.1