<?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>Sonatype Blog &#187; quality</title>
	<atom:link href="http://www.sonatype.com/people/tag/quality/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sonatype.com/people</link>
	<description>Sonatype is transforming software development with tools, information and services that enable organizations to build better software, faster, using open-source components.</description>
	<lastBuildDate>Thu, 09 Feb 2012 15:48:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Profiling Maven Tests</title>
		<link>http://www.sonatype.com/people/2009/09/profiling-maven-tests/</link>
		<comments>http://www.sonatype.com/people/2009/09/profiling-maven-tests/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 12:02:30 +0000</pubDate>
		<dc:creator>Marvin Froeder</dc:creator>
				<category><![CDATA[How-To]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[quality]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.sonatype.com/people/?p=2763</guid>
		<description><![CDATA[A few days ago we changed nexus integration tests to use an embedded version of nexus instead of using a forked VM. Before every test Nexus is started and then stopped again after the test completes. This is done once for each test class (Junit: @BeforeClass=start nexus, @AfterClass=stop nexus). During the first run we noticed [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago we changed nexus integration tests to use an embedded version of nexus instead of using a forked VM.  Before every test Nexus is started and then stopped again after the test completes.  This is done once for each test class (Junit: @BeforeClass=start nexus, @AfterClass=stop nexus).</p>

<p>During the first run we noticed some problems.Each time Nexus started, VM would use an additional 45Mb of memory.  Soon we realized that our embedder was not working right.  Stopping Nexus was not removing it from memory.</p>

<p>Setting all fields to null after stopping helped somewhat.  But now instead of 45Mb of leak we were getting 40Mb, which was still too much when we had more then 200 tests to run. It was time to profile our tests.</p>

<p>At Sonatype we use <a href="http://www.yourkit.com/">yourkit</a> for profiling, so I will demonstrate how to use yourkit to profile tests executed by maven. You should be able to use the same principle with any other profile tool.
<span id="more-2763"></span>
1 &#8211; First, <a href="http://www.yourkit.com/download/index.jsp">download, get a license</a> and install yourkit.
2 &#8211; Create a new profile to hold yourkit-related configuration:</p>


<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;profiles<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
...
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;profile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #808080; font-style: italic;">&lt;!-- http://www.yourkit.com/docs/80/help/agent.jsp --&gt;</span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>yourkit-profile<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;properties<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;yourkit.home<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>C:\Arquivos de programas\YourKit Java Profiler 8.0.13<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/yourkit.home<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/properties<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/profile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/profiles<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>


<p>I put the yourkit.home in pom.xml, but you can have it in settings.xml as well.</p>

<p>3 &#8211; Add yourkit agent to surefire inside the profile:</p>


<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">...
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;profile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
...
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;build<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugins<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.apache.maven.plugins<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>maven-surefire-plugin<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
              <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;argLine<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>-agentpath:&quot;${yourkit.home}\bin\win32\yjpagent.dll&quot;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/argLine<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugins<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/build<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/profile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>


<p>There are other ways to do this you can see <a href="http://www.yourkit.com/docs/80/help/agent.jsp">here</a>.</p>

<p>4 &#8211; Launch yourkit UI.</p>

<div id="attachment_2765" class="wp-caption alignnone" style="width: 160px"><img class="size-thumbnail wp-image-2765" title="ui" src="http://www.sonatype.com/people/wp-content/uploads/2009/08/ui-150x150.png" alt="Yourkit UI" width="150" height="150" /><p class="wp-caption-text">Yourkit UI</p></div>

<p>5 &#8211; Launch maven using yourkit profile:
$ mvn clean test -P yourkit-profile -Dyourkit.home={your yourkit installation home}</p>

<p>As soon as yourkit UI detects your application, it will begin collecting profiling data.</p>

<div id="attachment_2766" class="wp-caption alignnone" style="width: 160px"><img class="size-thumbnail wp-image-2766" title="loaded-ui" src="http://www.sonatype.com/people/wp-content/uploads/2009/08/loaded-ui-150x150.png" alt="Test running" width="150" height="150" /><p class="wp-caption-text">Test running</p></div>

<h5>Optional, using the API</h5>

<p>Regular profiling is not very useful to find memory leaks on unit tests.  A much more efficient approach is to take memory snapshots programmatically.  To do so, we need <a href="http://www.yourkit.com/docs/80/help/api.jsp">yourkit API</a>.</p>

<p>On the same profile, add this dependency:</p>


<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;profile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
...
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependencies<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>com.yourkit<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>yjp<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>8.0.13<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;scope<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>system<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/scope<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;systemPath<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>${yourkit.home}\lib\yjp.jar<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/systemPath<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependencies<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
...
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/profile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>


<p>Note that you should not move yjp.jar to your local maven repository.</p>

<p>Now we can create a <em>com.yourkit.api.Controller</em> instance and take memory snapshos when we need to.</p>

<p>To avoid compilation problems during regular builds (when you are not profiling) I suggest doing that using reflection, like this:</p>


<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">    <span style="color: #666666; font-style: italic;">// profiling with yourkit, activate using -P youtkit-profile</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #003399;">Object</span> profiler<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> startProfiler<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">Class</span> controllerClazz<span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">try</span>
        <span style="color: #009900;">&#123;</span>
            controllerClazz <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">Class</span>.<span style="color: #006633;">forName</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;com.yourkit.api.Controller&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span> <span style="color: #003399;">Exception</span> e <span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            log.<span style="color: #006633;">info</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;Profiler not present&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000000; font-weight: bold;">return</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">try</span>
        <span style="color: #009900;">&#123;</span>
            profiler <span style="color: #339933;">=</span> controllerClazz.<span style="color: #006633;">newInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            controllerClazz.<span style="color: #006633;">getMethod</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;captureMemorySnapshot&quot;</span> <span style="color: #009900;">&#41;</span>.<span style="color: #006633;">invoke</span><span style="color: #009900;">&#40;</span> profiler <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span> <span style="color: #003399;">Exception</span> e <span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            fail<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;Profiler was active, but failed due: &quot;</span> <span style="color: #339933;">+</span> e.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> takeSnapshot<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> profiler <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">try</span>
            <span style="color: #009900;">&#123;</span>
                profiler.<span style="color: #006633;">getClass</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getMethod</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;forceGC&quot;</span> <span style="color: #009900;">&#41;</span>.<span style="color: #006633;">invoke</span><span style="color: #009900;">&#40;</span> profiler <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                profiler.<span style="color: #006633;">getClass</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getMethod</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;captureMemorySnapshot&quot;</span> <span style="color: #009900;">&#41;</span>.<span style="color: #006633;">invoke</span><span style="color: #009900;">&#40;</span> profiler <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span> <span style="color: #003399;">Exception</span> e <span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#123;</span>
                fail<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;Profiler was active, but failed due: &quot;</span> <span style="color: #339933;">+</span> e.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>


<p>That way you won&#8217;t need to change the code to run in non-profiling mode.</p>

<p>You can see the full example in place at <a href="https://svn.sonatype.org/nexus/trunk/nexus/nexus-test-harness/nexus-test-harness-launcher">nexus-test-harness</a>.</p>

<p>If you are still reading and are curious what was causing the memory leak on Nexus tests, we discovered that jetty creates Shutdown Hook that can hold a reference to all servers (depends on how you configure it).  That shutdown hook stops jetty instances when the VM is going down.  So it was just a matter of removing my jetty instances from it when I manually stopped Nexus.</p>
<div style="float: right; margin-left: 10px;"><a href="http://twitter.com/share?url=http://www.sonatype.com/people/2009/09/profiling-maven-tests/&via=SonatypeCM&text=Profiling Maven Tests&related=:&lang=en&count=horizontal" class="twitter-share-button">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.sonatype.com/people/2009/09/profiling-maven-tests/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Integration tests with Maven (Part 1): Failsafe Plugin</title>
		<link>http://www.sonatype.com/people/2009/06/integration-tests-with-maven-part-1-failsafe-plugin/</link>
		<comments>http://www.sonatype.com/people/2009/06/integration-tests-with-maven-part-1-failsafe-plugin/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 15:40:08 +0000</pubDate>
		<dc:creator>Marvin Froeder</dc:creator>
				<category><![CDATA[Maven]]></category>
		<category><![CDATA[failsafe]]></category>
		<category><![CDATA[junit]]></category>
		<category><![CDATA[quality]]></category>
		<category><![CDATA[surefire]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.sonatype.com/people/?p=2408</guid>
		<description><![CDATA[Everyone knows Maven is great for running unit tests, and it is usually one of the first things that people learn when they are adopting Maven as a technology. Integration tests are another matter, and require a more detailed introduction. In this series of articles, I will explain how to set up integration tests in [...]]]></description>
			<content:encoded><![CDATA[<p>Everyone knows Maven is great for running unit tests, and it is usually one of the first things that people learn when they are adopting Maven as a technology.   Integration tests are another matter, and require a more detailed introduction.  In this series of articles, I will explain how to set up integration tests in Maven starting the series by testing a simple jar and then advancing into more complex scenarios.</p>

<p><span id="more-2408"></span></p>

<h3>The application</h3>

<p>Let&#8217;s define a very simple application to be tested.  The application will return an exit code equal to the number of command-line parameters.  Running the program with no parameters will produce an exit code equal to zero, two parameters exit code two, and so on.</p>

<p>The application:</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">org.sonatype.simpleclientapp</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Main
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args <span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #003399;">System</span>.<span style="color: #006633;">exit</span><span style="color: #009900;">&#40;</span> execute<span style="color: #009900;">&#40;</span> args <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">int</span> execute<span style="color: #009900;">&#40;</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args <span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> args <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">return</span> args.<span style="color: #006633;">length</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>


<p>This class is very simple to test, in the next section you will see how you can write a simple integration test using JUnit.</p>

<h3>Creating and running integration tests</h3>

<p>Let&#8217;s create a simple integration test using JUnit:</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">org.sonatype.simpleclientapp</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.File</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">junit.framework.TestCase</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MainIT
    <span style="color: #000000; font-weight: bold;">extends</span> TestCase
<span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> testExecute<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Exception</span>
    <span style="color: #009900;">&#123;</span>
        assertEquals<span style="color: #009900;">&#40;</span> <span style="color: #cc66cc;">0</span>, execute<span style="color: #009900;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        assertEquals<span style="color: #009900;">&#40;</span> <span style="color: #cc66cc;">1</span>, execute<span style="color: #009900;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> <span style="color: #0000ff;">&quot;one&quot;</span> <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        assertEquals<span style="color: #009900;">&#40;</span> <span style="color: #cc66cc;">6</span>, execute<span style="color: #009900;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> <span style="color: #0000ff;">&quot;one&quot;</span>, <span style="color: #0000ff;">&quot;two&quot;</span>, <span style="color: #0000ff;">&quot;three&quot;</span>, <span style="color: #0000ff;">&quot;four&quot;</span>, <span style="color: #0000ff;">&quot;five&quot;</span>, <span style="color: #0000ff;">&quot;six&quot;</span> <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">int</span> execute<span style="color: #009900;">&#40;</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args <span style="color: #009900;">&#41;</span>
        <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Exception</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #003399;">File</span> jar <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">File</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;target/simple-client-app-1.0-SNAPSHOT.jar&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> execArgs <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span>args.<span style="color: #006633;">length</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        <span style="color: #003399;">System</span>.<span style="color: #006633;">arraycopy</span><span style="color: #009900;">&#40;</span> args, <span style="color: #cc66cc;">0</span>, execArgs, <span style="color: #cc66cc;">3</span>, args.<span style="color: #006633;">length</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        execArgs<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;java&quot;</span><span style="color: #339933;">;</span>
        execArgs<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;-jar&quot;</span><span style="color: #339933;">;</span>
        execArgs<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> jar.<span style="color: #006633;">getCanonicalPath</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003399;">Process</span> p <span style="color: #339933;">=</span> <span style="color: #003399;">Runtime</span>.<span style="color: #006633;">getRuntime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">exec</span><span style="color: #009900;">&#40;</span> execArgs <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        p.<span style="color: #006633;">waitFor</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">return</span> p.<span style="color: #006633;">exitValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>


<p>Note that this test needs the packaged jar (simple-client-app-1.0-SNAPSHOT.jar), which isn&#8217;t created when surefire runs the unit tests.</p>

<p>To run this we need a different approach. By different approach I mean a different plugin: the <a href="http://mojo.codehaus.org/failsafe-maven-plugin/">Failsafe Maven Plugin</a>.  The Failsafe Plugin is a fork of the Surefire plugin designed to run integration tests.</p>

<p>The Failsafe plugin goals are designed to run after the package phase, on the integration-test phase.</p>

<p>The Maven lifecycle has four phases for running integration tests:</p>

<ul>
<li>pre-integration-test: on this phase we can start any required service or do any action, like starting a database, or starting a webserver, anything&#8230; you can think on this as Junit.setUp()</li>
<li>integration-test: failsafe will run the test on this phase, so after all required services are started.</li>
<li>post-integration-test: time to shutdown all services&#8230; you can think of this as Junit.tearDown()</li>
<li>verify: failsafe runs another goal that interprets the results of tests here, if any tests didn&#8217;t pass failsafe will display the results and exit the build.</li>
</ul>

<p>Configuring Failsafe in the POM:</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>23
24
25
26
27
28
29
30
31
32
33
34
35
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;">      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.codehaus.mojo<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>failsafe-maven-plugin<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2.4.3-alpha-1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;executions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;execution<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;goals<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
              <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>integration-test<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
              <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>verify<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/goals<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/execution<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/executions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>


<p>By default, the Surefire plugin executes **/Test&#42;.java, **/&#42;Test.java, and **/&#42;TestCase.java test classes.    The Failsafe plugin will look for **/IT&#42;.java, **/&#42;IT.java, and **/&#42;ITCase.java.  If you are using both the Surefire and Failsafe plugins, make sure that you use this naming convention to make it easier to identify which tests are being executed by which plugin.</p>

<p>In the next part of this series, I will talk about test coverage and demonstrate a method of including coverage of both Unit Tests and Integration Tests in a report that can be generated for a Maven project.</p>
<div style="float: right; margin-left: 10px;"><a href="http://twitter.com/share?url=http://www.sonatype.com/people/2009/06/integration-tests-with-maven-part-1-failsafe-plugin/&via=SonatypeCM&text=Integration tests with Maven (Part 1): Failsafe Plugin&related=:&lang=en&count=horizontal" class="twitter-share-button">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.sonatype.com/people/2009/06/integration-tests-with-maven-part-1-failsafe-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Interview with Rich Seddon on m2eclipse Testing</title>
		<link>http://www.sonatype.com/people/2009/02/interview-with-rich-seddon-on-m2eclipse-testing/</link>
		<comments>http://www.sonatype.com/people/2009/02/interview-with-rich-seddon-on-m2eclipse-testing/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 13:00:55 +0000</pubDate>
		<dc:creator>Tim O'Brien</dc:creator>
				<category><![CDATA[m2eclipse]]></category>
		<category><![CDATA[Sonatype]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[OSGi]]></category>
		<category><![CDATA[quality]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.sonatype.com/people/?p=1628</guid>
		<description><![CDATA[In a previous post entitled m2e Roadmap, Jason discussed Sonatype&#8217;s commitment to quality and testing for m2eclipse. As a follow-up, I did a quick interview with Rich Seddon and asked him some questions about Sonatype&#8217;s approach to testing for Eclipse plugins. The interview is approximately five minutes long and in this interview, you&#8217;ll here Rich [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous post entitled <a href="http://www.sonatype.com/people/2009/01/m2e-roadmap/">m2e Roadmap</a>, Jason discussed Sonatype&#8217;s commitment to quality and testing for m2eclipse.    As a follow-up, I did a quick interview with Rich Seddon and asked him some questions about Sonatype&#8217;s approach to testing for Eclipse plugins.     The interview is approximately five minutes long and in this interview, you&#8217;ll here Rich give some detailed descriptions of the tools he uses to test the m2eclipse plugin.</p>

<p>[media id=1 width=320 height=70]
<span id="more-1628"></span>
INTERVIEW TRANSCRIPT</p>

<p><b>Tim O’Brien:</b>  So, Rich could you introduce yourself?</p>

<p><b>Rich Seddon:</b>  Yeah, my name is Rich Seddon and I’ve been brought on at Sonatype for the purpose of producing a set of automated tests for the M2 Eclipse Product and the reason for doing this is that there’s a lot of performance improvements and bugs that we want to fix. But if we don’t have the automated test in place we won’t know if we’re breaking things. And it’s got to be automated because of the number of platforms that we support and the number of operating systems that we run on is very large and the manual testing process is really much, much more than a small company can possibly handle.</p>

<p><b>TO:</b>  So, can you give me a sense of what’s the difference between what you do and something like a basic  JUnit test.</p>

<p><b>RS:</b>  Well, what I’m actually doing here is a full set of system tests for M2 eclipse so I actually in the test harness bring up the M2 eclipse on various platforms and drive the UI through a set of scenarios and verify along the way that no errors have occurred and that the state of the UI is as expected and the state of the project under test is as expected&#8230;.you might say that what I’m doing is trying to capture, in an automated fashion, the types of usage that our users will actually go through from day to day.</p>

<p><b>TO:</b>  What kind of tools are you using for this?</p>

<p><b>RS:</b>    Right now I’m using uumm; I’m kind of using Hybrid approach. There are sort of two approaches to doing eclipse UI I testing. One of them is to drive it with a sort of UI robot where the robot pushes buttons and manipulates trees and things like that. And the other approach is sort of a white box testing approach where you bring up in a regular old unit test, eclipse, and you drive eclipse at the API level to the unit test.   Both of these tests have their advantages and disadvantages.</p>

<p>The reason that I got attracted to this position is that, in the last few years, it seems there’s been a few sort of hybrid approaches come along one of them is called SWT POD (sp?)    PPTP by eclipse and then there was Abbott.  Then there’s a commercial company, Instantiations has a product called “Window Tester”.  And these allow you to do both kinds of testing, UI Robot testing and API testing at the same time. What they do is they sort of record your actions as your drive eclipse through a set of scenarios and produce a JUnit test that you can then edit.</p>

<p><b>TO:</b>   Is this run as a part of the Maven build for m2eclipse?</p>

<p><b>RS:</b>   Yeah, it is run in…..  integration using the Maven OSGI plugin. There’s an OSGI test runner plug-in that actually brings up the eclipse, loads in the unit test, and then within the running eclipses project runs the unit test.</p>

<p><b>TO:</b>  So, what sorts of things have you found through the testing that we wouldn’t have found if we hadn’t been doing this?</p>

<p><b>RS:</b>  Well, I’ve found quite a few things. There’s been certainly some deadlock situations that I don’t think we would have been able to reproduce. We would have got reports of them, but we never would have been able to reproduce them in-house because they don’t happen that often. But, when you have these tests running continuously and you’re capturing the output of them when things go wrong then that allows us to find intermittent bugs which is very difficult to do otherwise with manual testing.</p>

<p>The other thing that I’m finding though is that because I’m actually driving eclipse through an automated scenario, it forces me to pay very close attention to eclipse itself. So, I actually think even  the manual testing that I’ve been doing has benefited from this process because I have to really think very carefully about how I’m driving eclipse through various scenarios in order to be able to produce these tests.</p>

<p><b>TO:</b>  I notice that sometimes the bugs that people find in a plug-in for eclipse have nothing to do with the plug-in itself. Are you testing different distributions of eclipse; like different combinations of plug-ins?</p>

<p><b>RS:</b>  I am not doing so much of that yet. I’ve just got started about a month ago, but it’s on the road map. So, I plan to have these automated tests&#8212; Right now they’re just running in Eclipse 3.4 and they’re running essentially with all the of the required plug-ins that M2Eclipse could ever never need: WTP, Subclipse and all kinds of things like that. But yes, it’s on the road map for maybe in a month or two, I’m going to start expanding the set of platforms and have different sets of plug-ins and different combinations of plug-ins. Certainly Eclipse 3.3, possibly Eclipse 3.2, IBM RAD and of course get running on different OS; These are all on the road map. And, once I’ve got the automated test running, I mean this is the advantage of the automation right, I can really easily expand it to be able to get good quality testing on all these different platforms.</p>

<p><b>TO:</b>  Well, thanks for taking the time to talk to us. And, we’ll check with you in a few months to see what progress you’ve made.</p>

<p><b>RS:</b>  All right, sounds good.</p>
<div style="float: right; margin-left: 10px;"><a href="http://twitter.com/share?url=http://www.sonatype.com/people/2009/02/interview-with-rich-seddon-on-m2eclipse-testing/&via=SonatypeCM&text=Interview with Rich Seddon on m2eclipse Testing&related=:&lang=en&count=horizontal" class="twitter-share-button">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.sonatype.com/people/2009/02/interview-with-rich-seddon-on-m2eclipse-testing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>m2e roadmap</title>
		<link>http://www.sonatype.com/people/2009/01/m2e-roadmap/</link>
		<comments>http://www.sonatype.com/people/2009/01/m2e-roadmap/#comments</comments>
		<pubDate>Wed, 28 Jan 2009 07:00:21 +0000</pubDate>
		<dc:creator>Jason van Zyl</dc:creator>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[m2eclipse]]></category>
		<category><![CDATA[Book]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[m2e]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[quality]]></category>

		<guid isPermaLink="false">http://blogs.sonatype.com/people/?p=1492</guid>
		<description><![CDATA[I just wanted to let people know what&#8217;s been happening with m2e recently and what we&#8217;ll be focusing on in the near term. Recently, there has been a lull in the number of releases because we have decided that testing and quality are the priority so we had to take a step back and figure [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blogs.sonatype.com/people/wp-content/uploads/2009/01/m2e.png"><img class="alignright size-thumbnail wp-image-1496" title="m2e" src="http://blogs.sonatype.com/people/wp-content/uploads/2009/01/m2e.png" alt="" width="126" height="68" /></a>I just wanted to let people know what&#8217;s been happening with m2e recently and what we&#8217;ll be focusing on in the near term. Recently, there has been a lull in the number of releases because we have decided that testing and quality are the priority so we had to take a step back and figure out a plan of action.  The primary outcome is that we feel that the infrastructure for the testing needs to take precedence in order for everything else to fall into place. New feature development has to take a back seat to make sure the current functionality is flawless in execution.   Quality is our primary concern, and this means that all new features have to be backed by a completely automated tests (including automated UI tests). As we have discovered, this is an extraordinarily difficult task to accomplish. Provisioning target platforms, meshing Tycho with Hudson for CI/Releases, and automating UI tests is not simple by any stretch of the imagination.</p>

<p>Nonetheless we&#8217;re committed to the task and we&#8217;ve hired Rich Seddon to create the testing framework and infrastructure.  Our goal is to reach the standard set by <a href="http://nexus.sonatype.org">Nexus</a> which has so many integration tests that virtually nothing regresses and we can refactor and add new features without introducing new bugs.  Unfortunately, we know from experience in our training classes and feedback from users that m2eclipse has not reached this level of quality and we are fully addressing this fact by committing ourselves to testing and quality. We probably should have pursued fewer features and more testing, but what&#8217;s done is done.  From this point forward, testing is our primary concern. We will be able to add some new features, and do some architectural work to help stabilize m2e for the 1.0 but we&#8217;re basically going to be eradicating defects and adding the testing which will facilitate the convergence of m2e with the current Maven trunk and ultimately the Maven 3.0 final release.   In this post, I&#8217;ll walk through what we&#8217;re doing at a high level and then try to layout a schedule for what&#8217;s going to happen in the next few months.</p>

<p><span id="more-1492"></span></p>

<h3>Testing Plan &amp; Test Automation</h3>

<p>We are working on getting a complete feature map which will allow us to accurately test the features we purport to provide in m2e. Along with the feature map, we are gathering standard use cases and creating test plans around those. For example, we are trying to walk through the chapter in Maven: The Definitive Guide on m2e and finding that we even have problems there. So, we will be mapping out the features, creating standard projects and standard workflows to test.  Throughout this process, users will have the opportunity to participate. We also want to make it as easy as possible for users to get involved and having a large number of tests can only help us in that area. We&#8217;ll be documenting the testing setup and we&#8217;ll also be making it easier for people to write tests so they can, in general, participate more effectively.</p>

<h3>Documentation</h3>

<p>Tim O&#8217;Brien who is responsible for the <a href="http://books.sonatype.com/maven-book">Maven: The Definitive Guide</a> is going to pull the m2e chapter out of the Guide and create a more complete mini-book which will describe with example the features we have mapped out. Right now we have many documents in the Wiki which are hard to find and piece together, so it will be Tim&#8217;s task to organize this documentation and add to it so that we can provide a free &#8220;book&#8221; about m2e.  We&#8217;re also expanding our documentation presence to produce more cookbook-style &#8220;recipes&#8221;, and we&#8217;re rethinking the idea of the online book to provide smaller, more targetted guides for people looking to learn quickly.</p>

<h3>Problem Reporting</h3>

<p>One of the new features that will be released with 0.9.7 is the new problem reporting feature. Although this feature is orthogonal to the functionality directly in m2e I think this is the most critical addition we have made in some months. With one click you will be able to gather up your logs and system information and automatically submit that information to our issue tracking system. We want to accurately capture the information from problems as quickly as possible so users get correct information to us quickly. We are also making tools on our side to process these automated problem submissions so we can determine what&#8217;s wrong faster. This functionality is already present in the code base and will be in the next dev build and in 0.9.7. We took a page out of Joel Spolsky&#8217;s book:</p>

<p><a href="https://fogbugz.bitvise.com/help/Articles/GetCrashReportsFromUsersA.html" target="_blank">https://fogbugz.bitvise.com/help/Articles/GetCrashReportsFromUsersA.html</a></p>

<h3>Architecture</h3>

<p>We are going to be working on the architecture of m2e to allow the clear separation of dependency management, the configuration framework, and the Maven life cycle. Right now a great number of our problems can be attributed to some muddling in this area. We made a first attempt and we see now how things internally need to change. The separation of the dependency management means that you will be able to use this feature by itself on non-Maven projects if you wish.</p>

<p>The configuration framework will be responsible for taking configuration in POMs and mapping that into Eclipse, but it will also be responsible for taking preferences in Eclipse and mapping those into POMs. Currently we are working on Flex integration for a client and this is the first case of having fully bidirectional configuration management. You change the POM and Eclipse preferences are changed, you change the Eclipse preferences and the POM is updated to reflect those changes.  These are what we call configurators and we will document how these work so that people can create their own bidirectional support for any tool they wish to support.</p>

<p>The Maven lifecycle work will focus on optimizing what Maven itself actually does. Igor is currently working on some prototypes for a limited set of use cases to make the workflow as efficient as possible. In a session with a client they reported that Maven always seems to be &#8220;pulsing&#8221;, that the life cycle is always being fired and slowing things down/consumes a lot of resources. Igor is trying to work from concrete scenarios which will help me understand what needs to be changed in Maven 3.x itself to support a Maven integration that is not so invasive and resource-hungry.</p>

<h3>Features and Improvements</h3>

<p>As I stated earlier, we are going to limit much of the new feature work in order to support the testing and quality aspects of m2e. But what we would like to do is capture what users are asking for in major categories like:</p>

<ul>
    <li>Extension points for integration</li>
    <li>WTP functionality</li>
    <li>POM Editor functionality</li>
    <li>Tight integration with Nexus</li>
</ul>

<p>This is the kind of information we will be looking for during the 0.9.8 iteration and, once decided, those will be the final targets for the 1.0 release. We will be looking for accurate user stories and we will be using the voting mechanism in JIRA to help us decide. We are looking to be fairly aggressive on the 1.0 schedule which we will be able to do once the testing is in place. As such we will likely time-box the releases and we&#8217;ll do as much as we can in a fixed period of time and then release. This will be easier as Rich automates more of the testing.</p>

<h3>Convergence with Maven 3.x</h3>

<p>As many users know we are using a version of the Maven Embedder from 4 months ago which at the time was Maven 2.1.x. In Maven, we now have a 3.x, 2.1.x, and 2.0.x branch and m2e is working from the 3.x branch. Given that we&#8217;re 4 months behind and the testing is not adequate to just slot in what we currently have on the trunk (3.x). We need to be cautious about absorbing those changes. Right now Shane and Benjamin Bentmann are almost entirely adding unit and integration tests to the Maven 3.x code base so that we can safely do this. We are about to release Maven 3.0 alpha-2 (the alpha-1 was quiet) and I imagine that around alpha-5 the testing on the Maven side will converge with the testing efforts here and we will be able to start using what&#8217;s on Maven trunk. What we are going to do is create a branch where we will integrate Maven trunk for those that want to try it but it won&#8217;t be something we suggest for daily use but will be available for the adventurous.</p>

<p>One of the biggest changes that we&#8217;ve made in Maven 3.x is the integration of Mercury which is the next generation of our repository management &amp; transport APIs. We really don&#8217;t want to try and integrate Maven trunk into m2e proper until Mercury is properly integrated into Maven trunk itself. It&#8217;s a very big change which is why we need all the testing. We believe that Mercury is the only real way we can improve Maven 3.x itself so there are big changes but the long-term benefit is a big win. The artifact resolution will be deadly accurate and fast. If you want to know more about Mercury you can take a look at Oleg&#8217;s blog:</p>

<p><a href="http://blogs.sonatype.com/people/author/oleg/" target="_blank">http://blogs.sonatype.com/people/author/oleg/</a></p>

<h3>Project Infrastructure</h3>

<p>We are going to be making to be making some infrastructure changes to help us organize the project better and hopefully make it easier for users to participate. Starting next week, daily builds will be available for people. As we fix issues, the builds will be available for people to try.</p>

<p>We are going to start using the same reporting infrastructure that we use for Maven so that we can track what users want. This is what we are currently using for Maven itself and so I would encourage users to start voting on issues and features they care about as we&#8217;ll start scheduling time to fix the issues and features with the highest vote counts. If you want to take a look at the actual reports you can take a look here:</p>

<p><a href="http://www.sonatype.org/%7Ej2ee-hudson/reports/maven-votes.html" target="_blank">http://www.sonatype.org/~j2ee-hudson/reports/maven-votes.html</a>
<a href="http://www.sonatype.org/%7Ej2ee-hudson/reports/plugin-votes.html" target="_blank">http://www.sonatype.org/~j2ee-hudson/reports/plugin-votes.html</a></p>

<p>We are going to make a big pass this week at triaging all the issue currently in our Codehaus JIRA instance because we want to reduce the issue count because we are going to migrate all our issues to the Sonatype JIRA instance. We want to do this because we have some reporting tools and plugins (like Green Hopper) which are not available at Codehaus. We also need to do this so that we can synchronize this with our problem reporting and error submission system. We are basically going to let users automatically submit issues with the data attached and we need to be able to move these issues around. Trying to move an issues from one JIRA instance to another is a real pain in the ass. We are going to take care of migrating the issues and users so there should be minimal impact to users. We will test the migration several times before we do it for real.</p>

<p>People also want to know about what&#8217;s happening with the move to Eclipse. We are definitely going to do this and Sonatype is a strategic development partner so this is certainly going to happen. After some discussions with folks at Eclipse we have decided to move to Eclipse after the 1.0. There are a couple reasons for this: the first is that we want to focus on testing and quality and some architectural changes will change the dependencies and this impacts the legal work we need to do. Basically we want to focus on getting a quality 1.0 out and then we&#8217;ll worry about moving to Eclipse. Moving to Eclipse incurs a lot of overhead and we just have to set some priorities and a high quality 1.0 of m2e is a higher priority for us.</p>
<div style="float: right; margin-left: 10px;"><a href="http://twitter.com/share?url=http://www.sonatype.com/people/2009/01/m2e-roadmap/&via=SonatypeCM&text=m2e roadmap&related=:&lang=en&count=horizontal" class="twitter-share-button">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.sonatype.com/people/2009/01/m2e-roadmap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

