Showing posts with label ide. Show all posts
Showing posts with label ide. Show all posts

Wednesday, January 15, 2014

Remote debug unit test run by MAVEN

Once in a while, you have this unit test that run perfectly within your IDEA / Eclipse ide, but fails when executed by maven.

If it happens, you may want to debug your unit test when it fails.
In order to remote debug it , when executed by maven, you can do the following:

SureFire Method

You can achieve it in another way by adding -Dmaven.surefire.debug to your mvn command. the debug port is 5005.
If you need to cancel the the fork of your surefire plugin , add -DforkCount=0.

All is explained nicely in: Maven Surefire Plugin - Debugging Tests

Thanks to GuyH for the tip. Didn't try it yet but it should work.

My old fashion method

Add the "remote debug" JVM argument to your maven execution:

-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044


In addition, In addition, be sure that your maven surefire-plugin, responsible of running your unit test, doesn't execute your unit test(s) in fork mode but within its own jvm, so you can add breakpoint on the unit test itself. 

         <plugin>                <groupId>org.apache.maven.plugins</groupId>                <artifactId>maven-surefire-plugin</artifactId>                                <configuration>                                        <forkMode>always</forkMode>        <<== this must be deleted or on false                                </configuration>                <inherited>true</inherited>            </plugin>


Then, once your maven is running, attach your IDE tool (eclipse/idea or whatever) to your JVM (here, in our above example, attach it to port 1044, on the host where your maven is running) 

If maven is running too quickly, you can use the suspend mode (suspend=y) , so your maven JVM when start until you attach your IDE to it:

-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=1044


Thursday, May 24, 2012

IDEA JetBrain intellij

I started using IDEA instead of eclipse ...
First impressions:
I don't like their GUI
I do like their integration with spring/tomcat/everything ...
I do like the fastness in search ...

Some tip for newbies and for ubuntu / linux user:

1) when clicking on Switch-Tab for moving between application, I don't see the IDEA icon.
Solution: http://devnet.jetbrains.net/thread/435242


intellij-launcher.png

Please remove your launcher, start IDEA from a terminal, invoke a Tools | Create Desktop Entry action, exit IDEA, and restart session. After that you'll have a correct main menu entry which displays right icon in a switcher and is pinnable to Unity launcher.






2) Good link for better navigation in IDEA:

like here:

Quick switch of the current scheme

screenshot
There is no need to dig deep into the settings dialogs hierarchy when you need to apply another Color/Code style Scheme, Keymap or even Look and Feel of the application. This can be achieved with a short series of shortcuts. Just press Ctrl + BackQuote and then the number of the scheme to change.