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