<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>
<channel>
	<title>Ramblings from the bit bucket &#187; debug</title>
	<atom:link href="http://blogs.planetingres.org/notnull/tag/debug/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.planetingres.org/notnull</link>
	<description>Just another blogs.planetingres.org weblog</description>
	<lastBuildDate>Tue, 01 Feb 2011 09:13:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Debugging the Hibernate project with Eclipse</title>
		<link>http://blogs.planetingres.org/notnull/2010/05/16/debugging-the-hibernate-project-with-eclipse/</link>
		<comments>http://blogs.planetingres.org/notnull/2010/05/16/debugging-the-hibernate-project-with-eclipse/#comments</comments>
		<pubDate>Sun, 16 May 2010 10:42:44 +0000</pubDate>
		<dc:creator>notnull</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[ingres]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[hibernate]]></category>
		<category><![CDATA[Java]]></category>
		<guid isPermaLink="false">http://blogs.planetingres.org/notnull/?p=174</guid>
		<description><![CDATA[Trying to debug projects made using Apache Maven has not been something achieved with any success. Having been working at the periphery of the Hibernate source and submitting simple patches for the Ingres dialect and some tests I am now in a position to start debugging some of the issues discovered whilst testing. I have [...]]]></description>
			<content:encoded><![CDATA[<p>Trying to debug projects made using <a href="http://maven.apache.org/">Apache Maven</a> has not been something achieved with any success.</p>
<p>Having been working at the periphery of the Hibernate source and submitting simple patches for the Ingres dialect and some tests I am now in a position to start debugging some of the issues discovered whilst testing.  I have been dabbling with building maven projects from Eclipse using <a href="http://m2eclipse.sonatype.org/">m2eclipse</a>, but have not managed to perform source level debugging.  I found this article <a href="http://docs.codehaus.org/display/MAVENUSER/Dealing+with+Eclipse-based+IDE">Dealing with the Eclipse IDE</a> that provides some clues on how it is done.</p>
<p>Essentially it involves a remote debug session from a container project to a running maven goal configured to listen.</p>
<h2>Versions</h2>
<p>The versions of software that I&#8217;ve been playing with</p>
<ul>
<li>Eclipse Galileo ~SR1 &#8211; Build id: 20090920-1017</li>
<li>Eclipse Helios M5 &#8211; Build id: 20100204-0846 (I started to install the m2eclipse plugin and import the projects, but needs more work)</li>
<li>Ingres 9.3.1 (int.lnx/106)</li>
<li>java version &#8220;1.6.0_16&#8243;</li>
<li>mvn Apache Maven 2.2.1 (r801777; 2009-08-06 20:16:01+0100)</li>
<li>Apache Ant version 1.7.1 compiled on June 27 2008</li>
<li>Hibernate 3.5.0-Final</li>
<p><code>Path: .<br />
URL: http://anonsvn.jboss.org/repos/hibernate/core/tags/hibernate-3.5.0-Final<br />
Repository Root: http://anonsvn.jboss.org/repos/hibernate<br />
Repository UUID: 1b8cb986-b30d-0410-93ca-fae66ebed9b2<br />
Revision: 19149<br />
Node Kind: directory<br />
Schedule: normal<br />
Last Changed Author: steve.ebersole@jboss.com<br />
Last Changed Rev: 19148<br />
Last Changed Date: 2010-03-31 18:38:55 +0100 (Wed, 31 Mar 2010)<br />
</code>
</ul>
<p>These notes assume that the software has been installed and configured.  For example, the Maven local repository location is available and that the Maven remote repository is accessible.</p>
<h2>Installing m2eclipse</h2>
<p>The article <a href="http://docs.codehaus.org/display/MAVENUSER/Dealing+with+Eclipse-based+IDE">Dealing with the Eclipse IDE</a> includes links on how to install m2eclipse, but in summary, to install new software in Eclipse use the built-in update manager:</p>
<ul>
<li>Using the menus select
<ul>
<li>Help &gt; Install New Software</li>
<li>In the dialog add the URL <a href="http://m2eclipse.sonatype.org/sites/m2e">http://m2eclipse.sonatype.org/sites/m2e</a></li>
<li>Check the boxes of the packages that should be installed
<ul>
<li>NB&#8221; Version 0.9.8 should be un-installed before upgrading to 0.10.</li>
</ul>
</li>
</ul>
</li>
</ul>
<h2>Import the Hibernate project</h2>
<p>Once the m2eclipse extensions have been installed into Eclipse the preparation for importing the Hibernate Project Object Model (POM) XML file into the IDE is complete.  Importing the Hibernate project is <em><strong>optional</strong></em> and is only required if you intend to build Hibernate from Eclipse.  The remote Java application perspective will connect to either a command line invoked maven process or an Eclipse invoked maven process.</p>
<ul>
<li>Start Eclipse
<ul>
<li>Create a new workspace for the Hibernate project.</li>
</ul>
</li>
<li>Using the menu File &gt; Import
<ul>
<li>Select Maven &gt; Existing Maven Projects</li>
<li>Click Next and use the browse button to specify the root directory of the Hibernate source code, this is the directory in which the top level pom.xml file exists.</li>
<li>The sub-projects appear in the tree view in addition to the hierarchy beneath the top level project.</li>
</ul>
</li>
<p><img src="http://blogs.planetingres.org/notnull/files/2010/05/02-eclipse-import-maven-projects.png" alt="Import Exisiting Maven Project" /></ul>
<p>The initial import and build of the workspace can take a while.</p>
<h2><strong>Create a Surefire Debug Configuration</strong></h2>
<p>Create a run configuration for a specific test class for debugging.  In this example the filter.DynamicFilterTest has been cut down into filter.IngresDynamicFilterTest.</p>
<ul>
<li> Select the menu Run &gt; Run configuration option or from the context menu using a right click.</li>
<li>In the Run Configuration dialog select &#8221;maven&#8221; and create a new configuration
<ul>
<li>Enter a name for the configuration</li>
<li>Surefire Debug</li>
<li>Set the base directory to the test suite directory by browsing the file system</li>
<li>Set the goals</li>
<li> <code>test -Dmaven.surefire.debug</code></li>
<li>Use a JDBC profile if one is required and has been configured</li>
<li>Set the &#8221;test&#8221; parameter to a specific test class intended for debugging
<ul>
<li> <code>test=org.hibernate.test.filter.IngresDynamicFilterTest</code></li>
</ul>
</li>
</ul>
</li>
<p><img src="http://blogs.planetingres.org/notnull/files/2010/05/06-debug-config-m2-test.png" alt="Maven Test Run Configuration" /></ul>
<h2>Create a Debugging Container Project</h2>
<p>The container java project does not contain any source and is used as the launch point for a remote debugging configuration.</p>
<ul>
<li> Using the File-&gt;New-&gt;Project-&gt;Java Project (or equivalent)</li>
<li>Set the project name in the wizard</li>
<li><code>Project Name: Maven Debug</code> and finish</li>
<p>In order to debug a maven project a container project is used to connect to maven in debug mode.</p>
<p><a href="http://vimeo.com/11763677">Create Container Project</a> from <a href="http://vimeo.com/user3822721">Ray Fan</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<li>Use the Run-&gt;Debug Configurations menu to create a configuration for the Remote Java Application
<ul>
<li>Set the name<code>Name: Maven</code></li>
<li>Keep all the existing settings and apply</li>
<p><img src="http://blogs.planetingres.org/notnull/files/2010/05/10-debug-config-remote-maven-project.png" alt="Debug Remote Application" /></p>
<li>Select the Source tab and add source
<ul>
<li><code>File System Directory</code> and browse to the Hibernate route source directory</li>
<li>Select the <code>Search subfolders</code> check box</li>
<li>Apply and close</li>
</ul>
<p><img src="http://blogs.planetingres.org/notnull/files/2010/05/13-source-folders-added.png" alt="Add Source Folders" /></li>
</ul>
</li>
<li>Use the Run &gt; Debug Configurations menu to duplicate the Maven configuration for the Remote Java Application
<ul>
<li>Set the name
<ul>
<li><code>Name: Maven Debug</code></li>
</ul>
</li>
<li>Change the port value
<ul>
<li><code>Port: 5005</code></li>
</ul>
</li>
<li>Apply and close</li>
<p><img src="http://blogs.planetingres.org/notnull/files/2010/05/11-debug-config-remote-maven-surefile-project.png" alt="Remote Application Maven Surefire Configuration" /></ul>
</li>
</ul>
<h2>Set breakpoints and start the test</h2>
<p>At least one breakpoint should be set in the source prior to the run configuration Surefire Debug is started</p>
<ul>
<li> Browse the source tree in the package explorer to the test class</li>
<li>Set a breakpoint</li>
<li>Use the Run-&gt;Run Configurations menu and select the Maven-&gt;Surefire Debug configuration
<ul>
<li>Click debug to start maven</li>
</ul>
</li>
<p><a href="http://vimeo.com/11760638">Eclipse breakpoint setting and starting maven</a> from <a href="http://vimeo.com/user3822721">Ray Fan</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<p>Using Eclipse to browse the project source and set a breakpoint prior to starting maven to run the test.</p>
<h2>Start the debugger</h2>
</ul>
<ul>
<li> Use the Debug-&gt;Debug Configurations menu and select the <code>Maven Debug</code> remote debugging configuration
<ul>
<li>Click debug to start the debugging session</li>
<li>Switch to the debugging perspective when prompted</li>
<li>Once execution of the test starts the breakpoint set previously should be hit</li>
</ul>
</li>
<p><a href="http://vimeo.com/11767128">Starting to debug</a> from <a href="http://vimeo.com/user3822721">Ray Fan</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<p>Starting to debug, switching perspective and hitting the breakpoint.</p>
</ul>
<h3>Related posts</h3>
<ul class="related_post">
<li><a href="http://blogs.planetingres.org/notnull/2010/04/01/hibernate-3-5-0-final-released/" title="Hibernate 3.5.0-Final released">Hibernate 3.5.0-Final released</a></li>
<li><a href="http://blogs.planetingres.org/notnull/2008/08/06/donnez-moi-un-cafe-ingres/" title="Donnez-moi un café Ingres">Donnez-moi un café Ingres</a></li>
<li><a href="http://blogs.planetingres.org/notnull/2008/01/21/rapid/" title="Rapid">Rapid</a></li>
<li><a href="http://blogs.planetingres.org/notnull/2011/02/01/ingres-migration-toolset/" title="Ingres Migration Toolset">Ingres Migration Toolset</a></li>
<li><a href="http://blogs.planetingres.org/notnull/2010/02/23/useful-or-useless-follow-on-post/" title="Useful or useless? Follow on post &#8230;">Useful or useless? Follow on post &#8230;</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blogs.planetingres.org/notnull/2010/05/16/debugging-the-hibernate-project-with-eclipse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

