I want to use maven to run my application in test mode. I have a multi module project which uses gwt. To debug my app I want to do the following:
Run jetty in exploded directory
Run gwt in a hosted mode with -noserver option
Now I have to do this manually in the IDE. Is there any way to do this automatically from maven?
Using Maven, you can use the jetty-maven-plugin to run Jetty in your server module (use the start or run goal), and the gwt-maven-plugin to launch GWT's DevMode (use the run or debug goal).
To my knowledge, you cannot however do that with a single Maven command.
Have a look at https://github.com/tbroyer/gwt-maven-archetypes for sample configurations of such multi-module GWT projects.
Related
I have spring-boot mvc project - maven.
Specifically I want to debug #Controller class.
I converted it to eclipse project with
mvn eclipse:eclipse -Dwtpversion=2.0
Then in eclipse, I tried to Debug it on Server (Tomcat 7), but got an error
The server does not support version 3.1 of the J2EE Web module
specification.
In Facets configurations, it doesn't allow me to choose any other version of 'Dynamic Web Module' from 3.1.
I also tried to debug like that: from project root I ran:
mvndebug spring-boot::run
And then connected debug-remote, but when I opened the page in browser, break point of the controller didn't trigger.
You should not use eclipse:eclipse cause it's deprecated very long time...If you like to debug the Spring Boot application you can do this via:
mvn spring-boot:run -Drun.jvmArguments="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"
You need to start Eclipse via Debug configuration.
The execution mvnDebug... will debug Maven itself which is not what you want to do.
I have a maven project. I am trying to run a single test in maven command line and that works fine. I am trying to debug that test in eclipse and using -Dmaven.surefire.debug option and starting a debug on port 5005 as "Remote Application" in maven - ref http://maven.apache.org/surefire/maven-surefire-plugin/examples/debugging.html
Now when I do so - as part of my maven command in command line all classes/test-classes, spring config get compiled and put in right places. However when I am Run Debug from eclipse when the test pauses to listen on port 5005 - I see eclipse is running a maven build all over again and all classes are recompiled. And while doing this it is not picking up all the profiles required for the test as not all profiles are active by default. I could fix that by Project->Properties->Maven and set the active Maven profiles there.
What I am looking for if why is eclipse trying to do a maven build when I am trying to run my test for which a compiled class is already present? Is that a default behaviour of eclipse maven plugin m2e? And can this be turned off - so that it only executes the class instead of trying a maven build?
I have multi module maven project.
One of the modules is actual web application, the JBoss is the server.
Other subprojects are dependencies for the web project.
I am running it in JBoss embedded in eclipse. Pretty straightforward configuration.
When executed from within eclipse, if I do mvn clean, mvn package - then clean + publish to JBoss, everything works wonderfully.
If I change source code for the web project, eclipse detects the need to republish automatically and does job well.
However if I change source in the non-web subproject, eclipse does not detect change and I have to mvn clean, mvn package, then publish to JBoss manually for it to pick the code change.
This is annoying since packaging job takes about a minute, then publishing job takes another 30 seconds. I have to clean since simply packaging without clean does not pick the change either.
Is there a way to configure things in the eclipse so that any source change in any subproject/module is automatically recognized by eclipse and it would republish to JBoss upon selecting "run"?
There is another bad side effect - debugging of the source that is not web project is impossible - eclipse's debugger does not see that source. It sees only source of the web module.
Thanks,
Nikolay
Make sure that your web project has dependencies on the other modules(projects) defined in the pom and in the eclipse project. you can check that in the build settings. If they are not there then it probably means that the project file was not generated from your maven .pom file. You can generate that by running
mvn eclipse:eclipse
I have a proof of concept GWT 2.4 / Spring 3.1 / Maven 3 / Eclipse Indigo project that I have been working on. I am able to run the application in Dev Mode using the embedded Jetty server. I am able to create a war (mvn package with help of the gwt-maven-plugin) and run the application on an installed Tomcat server. But when I try to Run as > Run on Server, it does not use/copy the generated/compiled JavaScript. When I go to the wtpwebapps dir, all is there but the generated/compiled JavaScript. The generated/compiled JavaScript is in the correct location in the maven target dir, it seems, but the eclipse process that copies the code the applcation to the wtpwebapps dir doesn't pick it up.
I'm not sure if I need to give more info to solve this problem, but any help is appreciated.
You could use a custom com.google.gwt.core.ext.ServletContainerLauncher using the embedded Tomcat API, or much more simply run your server code in Tomcat (using WTP or the tomcat7-maven-plugin) and then run DevMode in -noserver mode.
See https://developers.google.com/eclipse/docs/faq#gwt_with_maven and https://developers.google.com/web-toolkit/doc/latest/DevGuideCompilingAndDebugging#How_do_I_use_my_own_server_in_development_mode_instead_of_GWT's
I'm using the second approach in https://github.com/tbroyer/gwt-maven-archetypes
The archetype uses Jetty for now, but I'm successfully using the tomcat7-maven-plugin on a project based on the archetype (with too many tricks preventing me to set it as the default in the archetype; those tricks only being needed because of the multi-module nature of the project; but there are tricks for Jetty too).
I encountered a similar problem with GWT-dev 2.8.0-beta1 and jetty 9 in my eclipse maven project. Since the GWT-dev jar includes Jetty and other code directly in its jar (which is bad), it conflicts with the jetty I import in my project. The work around was to create a separate module just for running super dev mode, importing GWT-dev and my project's code but excluding the jetty jars. I then run super dev mode via the main below. This way, the super dev mode runs without seeing my jetty libs.
import com.google.gwt.dev.codeserver.CodeServer;
public class SuperDevModeMain {
public static void main(String[] pArgs) throws Exception {
System.out.println("Starting management-station-web-sdm!");
String[] options = "-port 9876 com.something.ms.web.MsWeb".split(" ");
CodeServer.main(options);
}
}
Sounds simple, but I'm having lots of issues.
I want to run a GWT project in a tomcat on Intellij-idea 10.
Does anyone know how to set up the run config?
Regards,
Charles.
You can use '-noserver' option to start Dev Mode under Tomcat. Edit your GWT run configuration by adding '-noserver -port 8080' to 'Dev Mode parameters' field, then run the Tomcat configuration and after that run the GWT configuration.
This all implies that this is a development run, i.e. for local testing/debugging purposes. This is not deployment to production servers. I also assume you have GWT and Web facets defined for this project.
If you need GWT debugging, then you must run as GWT run configuration: here you can only choose a Default server (Jetty that comes with GWT) or an AppEngine Development server (if installed).
If you must run under Tomcat, then:
a. Add a Tomcat server under Settings - App Servers.
b. Create an Artifact - WAR exploded (under project settings). Add all items in right pane to the left pane.
b. Create a Tomcat run configuration with this Artifact.
You first run gwt compiler for compile gwt module, then compiler creates to your hosted .js and .html files. And you can run tomcat as usual but tomcat does not compiles your gwt modules.
I suggest you t use ant to compile gwt modules.