GWT development mode in Eclipse



原文:http://wiki.magnolia-cms.com/display/DEV/GWT+development+mode+in+Eclipse

GWT development mode in Eclipse

转至元数据结尾
转至元数据起始
Your Rating:Thanks for voting!Please WaitPlease WaitResults:PatheticBadOKGoodOutstanding!2rates

Intro

When developing with Magnolia you might need to set up GWT dev mode in Eclipse, in particular if you need to work on the page editor module, which is basically responsible for injecting edit bars in a page for various components (areas, paragraphs, etc.) when in authoring mode. This module is entirely built with GWT and therefore we need to create a proper GWT dev launch configuration which enables us to debug our client code both locally and remotely (i.e. browser running on a machine other than the development one).

Local GWT dev mode

  • Open Run -> Debug Configurations... and create a new Java Application configuration. Browse to choose the magnolia-templating-editor project and GWTShell main class. In case the latter is not on your classpath, you should add the gwt-dev-x.y.z.jar to it by clicking on the Classpath tab.

  • Now click on the Arguments tab and add the following program arguments.
    ?
    -noserver -out src/main/resources/mgnl-resources/editor url http://localhost:8080/magnolia-empty-webapp/somepage.html
  • Also increase your Java memory by adding these parameters into the JVM arguments (these values can actually be adjusted depending on the available physical memory on your dev machine).
    ?
    -Xmx512m -Xms256m
  • Then add the magnolia-templating-editor project and sources respectively in the Classpath and Source tabs. Be aware that GWT development mode looks for modules (and therefore client-side source) using the JVM's classpath. Therefore, make sure to add your source directories first in your classpath. See also http://code.google.com/webtoolkit/doc/latest/DevGuideCompilingAndDebugging.html#How_do_I_use_my_own_server_in_development_mode_instead_of_GWT's

Notice

In case you get errors concerning Magnolia custom widgets classes not being found and therefore not added to the widgetset, you might need to explicitly add the validation API jar to the Classpath.

That's it. You can now launch your magnolia webapp in debug mode as usual and then start the newly created debug configuration. A GWT development mode window should show up, like in the picture below.

  • Click on Launch Default Browser to start your browser and go to the application. As you can see the gwt debug parameter gwt.codesvr=127.0.0.1:9997 was automatically added to the URL. If this is your first time using that browser with the development mode server, it will prompt you to install the Google Web Toolkit Developer Plugin. Follow the instructions in the browser to install.
    At first the app will take a while to start up as GWT will recompile your widgetset. Once done, you will be able to set breakpoints in GWT code and debug the client part of your web application as if it were plain Java server side code.

Remote GWT dev mode

If you need to debug client code running on a machine other than the one you're using for development (typical case, debugging your code on IE), then you need to set up your GWT configuration by only adding the -bindAddress parameter to it. For example

?
-noserver -bindAddress 192.168.10.64 -out src/main/resources/mgnl-resources/editor url http://localhost:8080/magnolia-empty-webapp/somepage.html

The argument to -bindAddress is your dev box IP. Now you should be able to start up your VirtualBox/Parallel instance or a real Windows box and connect to the server with a URL such as the following one. Once connected, you will be able to proceed testing and debugging as if the client code were running on your local dev machine.

?
http://192.168.10.64:8080/magnolia-empty-webapp/somepage.html?gwt.codesvr=192.168.10.64:9997

GWTShell options

?
GWTShell [-noserver] [-port port-number | "auto"] [-whitelist whitelist-string] [-blacklist blacklist-string] [-logdir directory] [-logLevel level] [-gen dir] [-bindAddress host-name-or-address] [-codeServerPort port-number | "auto"] [-out dir] [url]
 
where
  -noserver        Prevents the embedded web server from running
  -port            Specifies the TCP port for the embedded web server (defaults to 8888)
  -whitelist       Allows the user to browse URLs that match the specified regexes (comma or space separated)
  -blacklist       Prevents the user browsing URLs that match the specified regexes (comma or space separated)
  -logdir          Logs to a file in the given directory, as well as graphically
  -logLevel        The level of logging detail: ERROR, WARN, INFO, TRACE, DEBUG, SPAM, or ALL
  -gen             Debugging: causes normally-transient generated types to be saved in the specified directory
  -bindAddress     Specifies the bind address for the code server and web server (defaults to 127.0.0.1)
  -codeServerPort  Specifies the TCP port for the code server (defaults to 9997)
  -out             The directory to write output files into (defaults to current)
and
  url              Automatically launches the specified URL
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值