m2eclipse and separate output folders

The recent versions of m2eclipse (> 0.9.3) are a nightmare to get working. The biggest issues is that if you run a command line build whilst eclipse is working, one or the other will get totally borked. there is a section in the FAQ describing how to use separate output folders. Essentially you have to tell eclipse to use a certain maven profile, which changes your project configuration.

The instructions almost work. However, some plugins need the project.build.directory variable (for example for code-generation) to be set, and the FAQ does not achieve that.

Ordinarily you would have to specify the directory element in the build section:

<directory>${basedir}/${target.dir}</directory>

If you do this however, anything you launch in eclipse will not have the correct classpath. You must fully specify the output directories:

<directory>${basedir}/${target.dir}</directory>
<outputDirectory>${basedir}/${target.dir}/classes</outputDirectory>
<testOutputDirectory>${basedir}/${target.dir}/test-classes</testOutputDirectory>

I assume this is because m2eclipse is doing some kind of parsing of the pom.xml

Maven Default Execution Ids

Maven execution IDs have changed in maven versions greater than 2.2.0.

It seems that you can disable a default a default execution by binding it to the phase “none”:

<plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-dependency-plugin</artifactId>
   <executions>
      <execution>
         <id>default</id>
         <goals>
            <goal>unpack</goal>
         </goals>
         <phase>none</phase>
      </execution>
      <execution>
         <id>unpack</id>
         <phase>process-resources</phase>
         <goals>
            <goal>unpack</goal>
         </goals>
         <configuration>
            <artifactItems>
               <artifactItem>
                  [...]
               </artifactItem>
            </artifactItems>
         </configuration>
      </execution>
   </executions>
</plugin>