Automate clean projects, build projects, clean tomcat, debug tomcat - eclipse

In Eclipse I am trying to automate the following sequence:
Select couple of projects and run Clean (it triggers build too).
Select Tomcat (in eclipse) and run Clean.
Select Tomcat (in eclipse) and run Debug.
1,2,3 alone can take from 1 to 5 minutes. I get distracted and sometimes I even forgot what command I am running and have to start all over again.
Some kind of notification upon completion would be nice, too.

Related

Ninja Framework : Debugging via Eclipse and m2eclipse plugin - jetty:run does not start the server, builds instead

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>

Eclipse 2019-03 failing to run certain JUnit 4 tests from the Window but not Test suites or run configuration

I have installed Eclipse 2019-03 from both the installer and tar ball. Certain JUnit test will run from a "run as" selection in the window and others will not. The ones that will not run will run:
Test suite that includes the test class
Run -> run configurations
You can also run it from the JUnit view either from a test suite or run it again.
I have tried deleting then adding the code back in then which seems to work but then fails again in future.
I have tried re-installing eclipse and then adding the src and pom to the maven project and the issue is still there.
Any suggestions?
2019-06-28:
It seems there are also issues with this version of eclipse finding the main method in my Main class. Although removing or changing the code did resolve the issue there were a number of other issues croping up. I tried again to resolve this using both a new "run configuration" and run "Java Application". Both fail to find the class. This is a very simple Java 11 maven projet and I do not see why it is having these issues.
At this point I am going to roll back to a previous version of eclipse to see if it is having similar issues with this code.
2019-06-28 NEW:
Rolling back to photon resolved the issues with both running the code and the junit issues.
Version: Photon Release (4.8.0)
Build id: 20180619-1200

Eclipse build all vs MVN install

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.

Run sequel of run configurations in Eclipse

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.

How to cleanly stop m2e cargo:run from Eclipse?

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