You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Alexander von Zitzewitz <a....@hello2morrow.com> on 2009/10/27 00:08:41 UTC
Problem with aggregator Mojo and compile source roots (generated
sources)
Hello !
I am currently building a Mojo, that creates an architecture description for
a tool (SonarJ) by analyzing dependencies in a multi-module pom. Here is a
simplified version of it:
/** * Create SonarJ Architecture Description from POM * * @goal
generate-description * @aggregator * @execute phase="generate-sources" */
public class ArchitectureDescriptionMojo extends AbstractMojo implements
IValidationResult { /** * @parameter
default-value="${executedProject}" * @readOnly */ private
MavenProject project;
public void execute() throws MojoExecutionException,
MojoFailureException {
List<MavenProject> modules = (List<MavenProject>)
project.getCollectedProjects();
for (MavenProject module : modules) {
getLog().info(³Project ³+module.getArtifactId());
for (String dir : (List<String>)
module.getCompileSourceRoots())
{
getLog().info(³ dir: ³+dir);
} } } }
Since the Mojo states, that the generate-sources phase should be executed
before, I was hoping that the list of compile source roots would include the
directories of generated sources, but it does not!! I can confirm that the
generated-sources phase is actually executed for each child module. After
spending a day trying all kind of things I now hope, that somebody out there
knows how to get a complete list of compile source roots for all child
modules including generated source directories.
This is my environment:
mvn --version
Apache Maven 2.1.0 (r755702; 2009-03-18 15:10:27-0400)
Java version: 1.6.0_15
Java home: /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x" version: "10.5.8" arch: "x86_64" Family: "mac"
Thanks for any hint in advance.
Best regards
Alexander von Zitzewitz
FW: Problem with aggregator Mojo and compile source roots (generated
sources)
Posted by Alexander von Zitzewitz <a....@hello2morrow.com>.
Formatting fixed - and btw, if I call the same Mojo on one of the children
poms, that generated sources directories are included in the compile source
roots.
Hello !
I am currently building a Mojo, that creates an architecture description for
a tool (SonarJ) by analyzing dependencies in a multi-module pom. Here is a
simplified version of it:
/**
* Create SonarJ Architecture Description from POM
*
* @goal generate-description
* @aggregator
* @execute phase="generate-sources"
*/
public class ArchitectureDescriptionMojo extends AbstractMojo implements
IValidationResult
{
/**
* @parameter default-value="${executedProject}"
* @readOnly
*/
private MavenProject project;
public void execute() throws MojoExecutionException,MojoFailureException
{
List<MavenProject> modules = (List<MavenProject>)
project.getCollectedProjects();
for (MavenProject module : modules)
{
getLog().info(³Project ³+module.getArtifactId());
for (String dir : (List<String>)module.getCompileSourceRoots())
{
getLog().info(³ dir: ³+dir);
}
}
}
}
Since the Mojo states, that the generate-sources phase should be executed
before, I was hoping that the list of compile source roots would include the
directories of generated sources, but it does not!! I can confirm that the
generated-sources phase is actually executed for each child module. After
spending a day trying all kind of things I now hope, that somebody out there
knows how to get a complete list of compile source roots for all child
modules including generated source directories.
This is my environment:
mvn --version
Apache Maven 2.1.0 (r755702; 2009-03-18 15:10:27-0400)
Java version: 1.6.0_15
Java home: /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x" version: "10.5.8" arch: "x86_64" Family: "mac"
Thanks for any hint in advance.
Best regards
Alexander von Zitzewitz
------ End of Forwarded Message
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org