Using the run mojo from the cargo-maven2-plugin I would like to know of a better way to shut down the container.
The console output says Ctrl+C to stop, but that seems to do nothing.
If I terminate, it leaves an orphan java.exe process that I have to kill myself.
Am I doing something wrong? This is a little cumbersome.
Edit: I am usign Tomcat in a standalone config. If I use embedded Jetty, naturally terminate works, however we need Tomcat.
The CTRL+C thing seems to be a known Eclipse/Jetty issue. The last post says that issuing mvn cargo:stop would stop an already running container, however it doesn't work for me—albeit, I've only made some quick test a with an archetype generated webapp.
Using Eclipse Indigo Service Release 1 (20110916-0149) if I issue mvn cargo:run and wait for the container to boot (for now it's Jetty, no configurations; let's see if you can get it working like this) clicking on the big red Terminate button kills the running process and no lingering java{,w}.exe are left behind.
I don't know how do you issue mvn cargo:run from Eclipse right now, but maybe you're using it as an External Tool (and that's why a process is left behind). If you have m2eclipse installed you should create Maven run configurations for it like this:
Run --> Run Configurations --> Maven build --> right click --> New
It should be straightforward from here on.
(I've found two Eclipse bug tickets (here and here) that seems to be related to Eclipse's inability to read a healthy CTRL+C via it's console.)
I've verified that when I'm starting an external Tomcat (7.0.23) instance with mvn cargo:run from Eclipse via the m2e plugin (after the container have started) CTRL+C indeed doesn't work.
After this I've ran mvn cargo:run from my Cygwin console. The result was the same.
Finally I've tried it from Windows's cmd and it worked.
My guess is that this is a bug in the cargo-maven-plugin.
Running mvn cargo:stop from either Eclipse or Cygwin did the trick for me.
You can run the cargo plugin from Eclipse by creating a Maven build Run or Debug configuration in Eclipse.
In general if you run Cargo using an Eclipse Maven launcher in DEBUG mode (i.e. Debug as --> Maven build...), killing the process on the Eclipse console (the red button) doesn't leave any orphan process...
I don't know why, but it works :) At least on my workspace
Related
We are instructed to do the following (while using Eclipse)
And if you make a left click on your project you get the option “Debug
as…”. Hit that and generate a profile that debugs the goal jetty:run.
https://www.ninjaframework.org/documentation/debugging.html
However, when we do the jetty:run, we simply build the project, and the project does not start.
Furthermore, when we run with ninja:run, the debug does not stop at breakpoints.
What I need is a debug-mode that stops at breakpoints.
How do we fix this ?
The answer is in the Ninja Framework source code, and the new versions of a Jetty... and therefore, there is (probably) no answer without recompiling the whole framework to fix the issue. I have tried diff-ing the projects, but could not see anything that would fix the higher versions. Up until the version 6.4.0 (inclusive) running the command mvn jetty:run starts the server. Any other version that is higher than 6.4.0 just builds the project and then stops.
So, one of the solutions is to simply start a new project using the old-version code executing:
mvn archetype:generate -DarchetypeGroupId=org.ninjaframework -DarchetypeArtifactId=ninja-servlet-archetype-simple -DarchetypeVersion=6.4.0
Another solution is to deploy (Jetty or Tomcat server) and try to debug the deployed jar/war file.
The first solution is simpler, however, the second one is more proper.
At the time of writing, the latest version is
<ninja.version>6.6.1</ninja.version>
<jetty.version>9.4.18.v20190429</jetty.version>
Trying to build my application using using MVN Install cmd no build errors. Can one ahead and start the jboss server in eclipse ID? Will one be able to see all the changes getting affected with out ECLIPSE->Build ALL ?? Trying because my eclipse build takes lot of time and it validates the target folder as well as a result build is very slow. So to avoid this one can do MVN Install and run my server in debug will one be able to see my changes getting built?
If you are building project from Maven and starting server. It has no impact from eclipse changes.
If you are running server in debug mode and you are doing "Remote Debug" in eclipse then changes in eclipse will be effective as debug mode changes.
I come from a background in C++, Python, and Django and I'm trying to expand my horizons and learn Scala and Lift. However, I'm having a really hard time figuring out how to debug Lift applications using eclipse.
I can create projects using some of the lift sbt templates and run them no problem. However, I haven't been able to start the application from within Eclipse because it can't find Jetty, and as a result, I'm not able to use the debugger to step through the Lift code. Weeks of googling haven't helped much.
Could someone share their methods or suggestions? I'm also new to the jvm, so feel free to share best practices or point out important differences that I may be missing.
Ok, I've gotten this figured out.
So I'm not actually launching the application from the Eclipse debugger. I'm starting the application through sbt, and then connecting the Eclipse remote debugger to the sbt vm that's running the webapp.
Here's what I did:
Assuming you have sbt-launch.jar in /bin:
Create the file /bin/sbt_debug with permission to execute and containing this line:
java -Xmx512M -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 -jar /bin/sbt-launch.jar "$#"
What this script is doing is starting sbt and instructing the jvm to allow debugging on port 5005
Go to your lift project directory in your terminal and enter sbt_debug. Once you're in the sbt console enter container:start / container:update or ~jetty:start / ~jetty:update depending on which version of sbt you're using.
Next go to Eclipse, click the debug icon and select "Debug Configurations..."
On the left column, click "Remote Java Application" and create a new debug configuration. Set the Port to 5005.
Hit the Debug button and the Eclipse debugger should now be debugging the sbt process you started earlier
Note: This is the first method that has worked for me. If you have one that is better, please share
I've found the most useful tools to be the SBT Eclipse Plugin and the RunJettyRun plugin for Eclipse. The former will allow you to generate Eclipse config files based on your SBT setup and the latter will launch Jetty from Eclipse with the debugger attached. An added bonus is that generating your Eclipse config using "eclipse with-source=true" from the SBT prompt will download and attach src jars as well so you can step through Lift and any other 3rd party libraries you depend on as well as your own code.
I work on web applications with eclipse which means each time I modify server side code I have to run maven clean install then start my server again. I have run configurations for these both steps in eclipse but need to wait for the first one to finish before starting the second one.
I have also other cases when I need to run maven clean install on 5 or 6 projects in a given order after having updated all of them.
So my question is: does anybody know how to define sequels of runs and run them in the right order on one click in Eclipse (i'm using Indigo). I didn't found any plugin nor help on my favorite search engine.
You can write an Ant-script which wraps the Maven commands (with using Maven Ant Tasks) in the correct order. Then you can create a launch configuration for that Ant script in Eclipse.
Or just write a shell script and create an launch configuration for that in Eclipse.
I'm using Eclipse Indigo on Win XP with Java 6. I have Maven 3.0.3 and have a GWT (2.1) project, which I have imported into Eclipse. How do I create a run configuration that will run the GWT project in develpoment mode? I tried a run configuration with these goals:
clean gwt:run
But this fails to run in debug mode, since my breakpoint immediately upon entering the "onModuleLoad" method never gets triggered.
Thanks, - Dave
Have you seen http://code.google.com/intl/fr-FR/eclipse/docs/faq.html#gwt_with_maven ?
Follow the "if you'really not able to use Eclipse for Java EE" steps for best experience.
You should run it with:
gwt:debug
For more information about goals check gwt-maven-plugin.