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
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

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.
-- 
View this message in context: 
http://www.nabble.com/Compiler-plugin%3A-trying-to-set-compileSourceRoots-tf2079114.html#a5727585
Sent from the Maven - Users forum at Nabble.com.


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

Reply via email to