Debugging Clover

Debugging Ant plugin

  1. Create "Remote" run configuration in IDEA.
  2. Export ANT_OPTS, e.g.:

    export ANT_OPTS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005
  3. Run 'ant'. Attach remote debugger in IDEA.

Debugging Maven plugin

  1. Create "Remote" run configuration in IDEA.
  2. Export MAVEN_OPTS, e.g.:

    export MAVEN_OPTS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005
  3. Run 'mvn'. Attach remote debugger in IDEA.

Debugging Eclipse plugin

  1. Create "Remote" run configuration in IDEA.
  2. Edit eclipse.ini and add options for remote debugging after the "-vmargs" flag, e.g.:

    -startup
    [...]
    -vmargs
    -Dosgi.requiredJavaVersion=1.7
    -XstartOnFirstThread
    -Dorg.eclipse.swt.internal.carbon.smallFonts
    -XX:MaxPermSize=256m
    -Xms256m
    -Xmx1024m
    -Xdock:icon=../Resources/Eclipse.icns
    -XstartOnFirstThread
    -Dorg.eclipse.swt.internal.carbon.smallFonts
    -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
  3. Run Eclipse. Attach remote debugger in IDEA.

 

Debugging IDEA plugin

Debugging directly in IDE

  1. Add "Plugin" run configuration and set "Use classpath of module" to clover-idea.
  2. Optional: setup alternative JRE.

  3. Click "Debug".

    In case you encounter this error while building a project in IDEA instance being debugged:

    Error:Internal error: (java.lang.ClassNotFoundException) clover.com.google.common.collect.Lists
    java.lang.ClassNotFoundException: clover.com.google.common.collect.Lists
    	at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    	at com.atlassian.clover.idea.build.jps.CloverSerializerExtension.getGlobalExtensionSerializers(CloverSerializerExtension.java:50)
    ...

    then extract all "clover/**" classes from clover-idea.jar into $IDEA_CACHES_DIR/plugins-sandbox/plugin/clover-idea/classes. A problem is caused by a fact that a build server process does not see third party JARs from the 'clover-idea' module. The IDEA_CACHES_DIR is base directory where is your`s Idea stores caches.
    For Mac it's: ~/Library/Caches/IntelliJIdea14/plugins-sandbox/plugin/clover-idea/

    For Windows it's: ~/.IntelliJIdea/system/plugins-sandbox/plugins/clover-idea

    Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544519-Directories-used-by-the-IDE-to-store-settings-caches-plugins-and-logs

Debugging in standalone IDEA

  1. Create "Remote" run configuration in IDEA.
  2. Edit idea64.vmoptions (or idea.vmoptions) of your test IDEA instance and add options for remote debugging, e.g.:

    -Xms128m
    -Xmx750m
    -XX:ReservedCodeCacheSize=240m
    -XX:+UseCompressedOops
    -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
  3. Run test IDEA instance. Attach remote debugger in developer IDEA.

  4. In case you would like to debug the external build process (which is launched by IDEA), then add the following option to the idea.properties file:

    -Dcompiler.process.debug.port=5006

    External compiler process will pause until debugger is connected to specified port.