Hi, I am creating a new plugin that generates test sources. This is
my first Maven plugin ever, so I'm sure I'm doing something wrong.
Following the way the antlr plugin is structured, my plugin @goal and
@phase match the below config and my plugin correctly generates the
test source in the correct place (as configured by my test project --
see below).
The problem is that Maven doesn't actually compile the generated
tests. Perhaps I'm not understanding the way phases/binding works in
M2. I've gone through most of the documentation, and most of the
BetterBuildsWithMaven.pdf
Any help?
...
...
/**
* @parameter expression="${project}"
* @required
*/
private MavenProject project;
public void execute()
throws MojoExecutionException, MojoFailureException
{
...
...
// blah, blah, generate sources
...
...
project.addTestCompileSourceRoot( genSrcOutputDirectory );
}
My test project that uses my plugin...
...
(junit dependency)
...
...
<build>
<testSourceDirectory>${project.build.directory}/generated-tests/my-
plugin</testSourceDirectory>
<plugins>
<plugin>
<groupId>my.group.id</groupId>
<artifactId>maven-gentests-plugin</artifactId>
<executions>
<execution>
<id>generate-tests</id>
<phase>generate-test-sources</phase>
<configuration>
<scriptSourceDirectory>src/main/scripts/</scriptSourceDirectory>
<genSrcOutputDirectory>${project.build.directory}/generated-
tests/my-plugin</genSrcOutputDirectory>
</configuration>
<goals>
<goal>generateTests</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
--
James Mitchell
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]