| -----Original Message-----
| From: Denis Cabasson [mailto:[EMAIL PROTECTED] 
| Sent: Wednesday, August 09, 2006 11:07 AM
| To: [email protected]
| Subject: Re: Compiler plugin: trying to set compileSourceRoots
| 
| Alexander Hars wrote:
| > 
| > Hi,
| > 
| > I am trying to specify multiple source locations for the 
| compiler-plugin 
| > (goal: test-compile). How do I accomplish that?
| > 
| > I have tried to set the compileSourceRoots in the 
| configuration of the 
| > compiler plugin:
| > <configuration>
| >   
| <compileSourceRoots>src/test/main;src/test2/main</compileSourceRoots>
| > </configuration>
| > 
| > But I always get an error:
| >   Cannot override read-only parameter: compileSourceRoots
| > 
| > Is there a different way by which I can set the property
| >   project.testCompileSourceRoots
| > separately?
| > 
| > Thanks,
| > 
| >  Alexander
| > 
| 
| You can't do that in the compiler plugin.
| You have to do you own custom maven plugin if you want to add 
| sources to the
| compile phase.
| 
| Sample mojo (kudos to emmanuel Venisse):
| public class AddSourcesDirectoryMojo
|     extends AbstractMojo
| {
|     /**
|      * @parameter
|      */
|     private List sources;
|     
|     /**
|      * @parameter expression="${project}"
|      *
|      * @required
|      */
|     private MavenProject project;
| 
|     public void execute()
|         throws MojoExecutionException
|     {
|         if ( project != null && sources != null )
|         {
|             for ( Iterator i = sources.iterator(); i.hasNext(); )
|             {
|                 String sourceDirectory = (String) i.next();
|                 project.addCompileSourceRoot( sourceDirectory );
|             }
|         }
|     }
| }
| 
| Denis.
| -- 


Or you can use the build-helper plugin -
http://mojo.codehaus.org/build-helper-maven-plugin/howto.html

-Ian

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to