Google Eclipse Plugin: Browser Plugin vs. Development Mode - java

I understand that Google's plugin for Eclipse tries to emphasize the "code-test-debug" cycle and make it as quick as possible, and that it comes with a medley of tools for doing just this.
What I don't understand is the need for a "developer" browser plugin for running your app inside Eclipse and testing locally on localhost. Why can't the plugin just start an embedded webserver and host it from there? Why does the browser require this plugin in the first place?
Tangential to that is the question of how it relates to development mode in general. Is Eclipse running in some kind of "special configuration" when in development mode that lets it talk with this browser plugin under the hood? If so, why is this necessary? Thanks in advance!

I believe you mixed two separate things here: GWT and GAE. GAE does not require browser plugin to run local dev server, while GWT requires browser plugin to run local dev mode (and even this is going away with 2.5 super devmode).
The confusion comes from the fact that Google bundles this two separate technologies into one plugin bundle, the GPE.
To avoid this just uncheck GWT when creating new GAE app.
Edit:
GWT dev plugin is only needed during dev mode. In this mode GWT Java source is not translated to javascript, but actually running in JVM as Java. This is needed to support debugging: https://developers.google.com/web-toolkit/doc/latest/DevGuideCompilingAndDebugging#DevGuideDevMode
Edit 2:
If you do not like the browser plugin, then you can use production mode on your local server. The downside to this is that compile-run will be greatly extended, since devmode compiles in-place: you can simply change GWT code and see changes by simply reloading browser window.

Related

What does the support of JRebel for an app (non-IDE) mean?

I have an Eclipse plugin that works as a light host and it is possible to run applications on it. I am trying to improve the development process and thought about using JRebel.
According to what I am reading in the FAQ, the JVM runs happily with JRebel jar as a plugin and any class declared for JRebel is reloaded at change, while the appropriate application jar is running.
So, I "simply" launch the Eclipse or IntelliJ with JRebel plugin for IDE, launch the host in it with JRebel plugin for JVM, install applications in host, launching their jars again with JRebel plugin for JVM, and I happily see the lines of code connected with running jars and classes reloaded at change.
But... Reading JRebel https://zeroturnaround.com/software/jrebel/download/ , along the bottom of the page I can see servers and other applications supported by JRebel.
I understand the need of support for IDEs, for JRebel must connect the lines of the source code, as I see them in IDE with the byte code, running in JVM. OK.
But what does it mean - server or other app supported by JRebel? If any jar can be run in JVM using JRebel jar as a plugin, as they explain in FAQ, where is the need for some special support? In other words, in what sense an application can be unsupported? In yet other words, our plugin and applications are not supported?
The core of JRebel enables classes to be reloaded so you see results as if you restarted the application. This includes accessing class info via reflection and other JDK tools that operate on class metadata.
As this hints, the main problem with only doing class reloading is that almost everything is caching intermediate results and computing some information only at the start of the application. Assuming a class or framework configuration file does not change at runtime is usually a good one.
For this reason, JRebel must provide additional integration to preserve the illusion of class reloading as most applications these days depend on a large number of libraries, application servers and frameworks. For example, a spring application would scan for components and do wiring of beans only on startup. A simple class reload isn't enough and the additional integration must therefore re-scan and re-wire beans if needed.
However there are also a lot of libraries that don't need additional support. The term supported means that a specific server or framework has the required integration and has integration tests running daily. If any library or framework is not listed, it means it's untested or requires no additional integration.
As a side note, JRebel works on compiled class files so an IDE doesn't need support aside from the debugger. Anyone can develop java with vim and use JRebel just fine for example.

How to debugging code in gwt super dev mode

I am using gwt 2.6.0 to develop web application. Using super dev mode to run my application in development mode.
I could not understand how to use break point in super dev mode so that i can debug my code step by step (line by line).
This is JavaScript, so you use JS dev tools. And it has source maps (make sure to turn it on in your dev tool if not already), so you can actually see, set breakpoints in, and debug step by step in your Java code.
Some IDEs have integrations too, IntelliJ IDEA Ultimate can connect to Chrome or Firefox and supports source maps so you can debug right from the IDE. In Eclipse, you'd need the SDBG plugin, and it only supports Chrome remote debugging protocol.
The one thing you'll likely miss is variable inspection (watch, etc.).

How to quickly and efficiently test project on Tomcat local server after making changes

I'm trying to build a Dynamic Web Application in Eclipse and I'm having trouble when I test my changes.
Sometimes when I make changes, I relaunch the Tomcat server and behold, my project looks exactly the same as last time. I then clean and rebuild the project a few times as well as clean the server, and finally my changes are visible.
This is time consuming and doesn't feel correct.
Is there a proper, quicker, more efficient way to launch a clean copy of your project on the local server?
I have used the Eclipse Tomcat plugin for years with no issues and more recently the Spring Tools Suite with plugin for their customized Tomcat. As you say having your project Build Automatically and having the Server configuration, via the plugin, set to Publish Changes Automatically goes some way towards alleviating the pain of Java web development.
For non Java files (JSP, CSS, JSF, JS etc.) you should see the changes instantly. For Java files, the plugin will reload the application to reflect the changed classes. While this works okay for small applications, for large applications the reload time can become significant. There can also be issues with permgen after multiple reloads and you can lose your session and be booted back to some previous screen and have to step back through the various screens to see your changes.
The ultimate solution then is to use a tool called JRebel which will swap you updated classes into the running VM without the requirement to reload the whole application as well as publishing non java files, reloading application config files (log4J, Spring) managing JPA entities and a lot more.
http://zeroturnaround.com/software/jrebel/
It's a commercial product and while not exactly cheap, in my experience worth every penny. I've been using it for years and couldn't live without it. Your productivity will increase x-fold especially when working on larger applications. No connection, just a satisfied customer.
For a free alternative see:
http://www.hotswapagent.org
In my experience, the tomcat plugin in eclipse has been flaky like this from the beginning. I suggest that you not use it - its just not worth the trouble.
There are at least two alternatives.
First, you could just install tomcat locally, build your war file, and deploy it manually.
A better alternative IMHO is to set up a maven build for your project, and then install the maven tomcat plugin, which just works. I've never seen it get flaky.
Something similar is probably available for gradle, if you want to use that instead of maven.
I've discovered that selecting Build Automatically, under the Projects menu item, changes in the code are automatically recompiled and added to the currently running Tomcat server instance.
Now it's going great! Much faster!

GAE Development - Development Environment Setup (HotSwap)

I'm quite new to develop on GAE. Need just sort out few questions about setting up development.
I'm currently using Eclipse 3.7.x, Google Suite Plugin 2.5.2 r37
Related links I found:
http://code.google.com/p/googleappengine/issues/detail?id=1787
GAE - Development server in Eclipse doesn't update?
http://code.google.com/p/gae-wtp-plugin/
I came from standard LAMP development environment. Changes are propagated immediately to development server (usually localhost) and I can control deployment of application to production server through DCVS/SVN and attached handlers updating remote codebase.
I'd expect Google Plugin allowing us to do the same. Necessary functions I (probably) need:
On-Save handler to recompile and update development code
Production like development environment (for testing in almost-real conditions)
Deployment to production environment
The last one is simply using DCVS/SVN to tag code and save the trunk branch, and using Google > Deploy to App Engine option to push it to remote server.
But how can I solve the first two requirements? Do I really need them, or is it only my hangover from web development, and development process in GAE works differently?
If the first one is solvable through GAE WTP Plugin, can you please more elaborate on how to setup development with this plugin, as I was not able to achieve anything more, than server, which has to be restarted in the same manner as Google Plugin default GAE development server
does.
You can update development code pretty quickly with the yellow reload button. For me, with about 100 server classes, this takes 2-5 seconds.
The development environment is reasonably good - you can simulate HRD and stuff like that. Of course, it's not actually a distributed cloud environment - we do most testing on local servers, and then have a whole test app on the cloud for a last round of simulation. Of course, some things change when 1000 people are accessing it at once, but I don't know how to get around that.
You can find the reload button on the Development View pane:

Java web development environment to minimize build-deploy-test cycle time?

What Java web development environment is the best for absolutely minimizing the build-deploy-test cycle time?
Web development environment: JBOSS, Tomcat, Jetty? Deploy WAR exploded? Copy WAR or use symbolic links? There are factors here I don't know about.
Build-deploy-test cycle? The amount of time it takes to test a change in the browser after making a change to the source code or other resources (including Java source, HTML, JSP, JS, images, etc.).
I am looking to speed up my development by reducing the amount of time I spend watching Ant builds and J2EE containers start. I want the Ruby on Rails experience --- or as close as I can get.
I'd prefer a solution that is web framework agnostic, however if a particular framework is particularly advantageous, then I'd like to hear about it.
Assume all the standard tools are in use: Hibernate, Spring, JMS, etc. If stubbing/mocking support infrastructure is required to make this work, I'm OK with that. In fact, I'm OK with having a development environment that is very different from our production environment if it saves me enough time.
You should probably take a look at Javarebel:
http://www.zeroturnaround.com/javarebel/
and this thread here:
How to improve productivity when developing Java EE based web applications
JBOSS uses Tomcat for its servlet/JSP engine, so that's a wash.
Tomcat does support hot deploy.
Jetty's pretty small and starts quickly, but it doesn't support hot deploy.
Eclipse is merely an IDE. It needs a servlet/JSP engine of some kind. If it's like IntelliJ, you can use any Java EE app server or servlet/JSP engine you'd like.
IntelliJ is pretty darned fast, and you don't have to stop and start the server every time you rebuild. It works off the exploded WAR, so things happen fast.
Building (used to be compiling) is a a sign of our times. We need quick validation of our thoughts and our actions. Whenever I find myself building to many times it is usually a sign that I'm not focused. That I don't have a plan. For me this is the time to stop and think. Do a list of things that need to be done (this is web framework agnostic) do them all and test them all after one build.
Jboss Seam together with the Jboss Developer Studio is good for hot deploying everything aside from EJBs (SLSB, SFSB and Entities need redeploy).
Have you considered Grails?
Deployment is as fast as it can get with Google App-Engine + GWT (optional) + Eclipse Plugin.
Never seen anything faster.
Maven 2 and eclipse. mvn eclipse:eclipse <- pure awesomeness. Also, WTP within eclipse works great (and maven generates working WTP projects).
Small web containers will load faster than overloaded webcontainers with the kitchen sink built in (.. cough .. jboss ).
Some design decisions slow build times (e.g. aspect-weaving based toolkits add an aspect-weaving phase to compile times).
Avoid building components that can only be tested after long elaborate load cycles. Caches are a prime culprit here. If your system has deep dependencies on a global cache scattered everywhere you'll need to load the cache every time you need to test something.
Unit-testable components, so you can run pieces instead of the whole thing.
I find that projects built reasonably compile, deploy, and startup in a few to 10 seconds, which is usually fine.
GWT in eclipse is probably the fastest I can think of. Using the hosted mode browser for your tests you can debug and change your code without restarting anything. Just need to click the refresh button in the browser and the changes are there (java, css, etc). One other thing is that GWT is adding this same support to normal browsers (Firefox, IE, Safari) so you can debug from within them the same way. These changes are coming in 2.0. See http://code.google.com/events/io/sessions/GwtPreviewGoogleWebToolkit2.html
Have you tried using Eclipse Java EE and then tell it to deploy to a server managed by Eclipse? Tomcat and JBOss works pretty well in this way. Also allow you to change code in a method, use Ctrl-S and have the class updated inside the server.
MyEclipse also works pretty well like this.
JRuby on Rails. Develop on whatever platform you want, deploy to standard Java servers.
I think the best way to avoid the long build deploy tests cycles is writing unit tests for your code. This way you can find bugs without waiting for the build/deploy phases.
For JSP you can edit the JSP files directly in the JBOSS work folder:
> cd $JBOSS_HOME/server/default/tmp
> find -name myJspFile.jsp
./tmp/vfs/automountd798af2a1b44fc64/Jee6Demo.war-bafecc49fc594b00/myJspFile.jsp
If you edit the file in the tmp folder you can test your changes just hitting the browser refresh button.

Categories