You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Vincent Massol <vm...@pivolis.com> on 2006/01/09 10:42:22 UTC

[m2] Modifying project.build.sourceDirectory and executions

Hi,

In the Clover plugin I modify the project.build.sourceDirectory value (in
the generate-sources phase). This is because I want any subsequent plugin to
use the directory where clover has generated the clovered source files.

For example, I would expect the following to print the new sourceDirectory
value:

      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <phase>process-classes</phase>
            <configuration>
              <tasks>
                <echo message="${project.build.sourceDirectory}"/>
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

But it prints the original value (src/main/java).

Does the problem occur because of the <execution>? Doesn't executions
inherit their default configurations from the executing lifecycle?

Or it the problem elsewhere?

Thanks
-Vincent


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


RE: [m2] Modifying project.build.sourceDirectory and executions

Posted by Vincent Massol <vm...@pivolis.com>.

> -----Original Message-----
> From: Brett Porter [mailto:brett@apache.org]
> Sent: vendredi 13 janvier 2006 00:00
> To: Maven Developers List
> Subject: Re: [m2] Modifying project.build.sourceDirectory and executions
> 
> This is because the part of clover that runs is forked, and the project
> is cloned then reset when it returns. This is by design, so forked
> lifecycles don't polllute the original. The final clover goal that cause
> the fork has access to ${executedProject}, and can pump settings back
> into the main project if desired at that point:
> 
> project.getBuild().setSourceDirectory(
> executedProject.getBuild().getSourceDirectory() );

Yes the Clover plugin does fork a lifecycle when the test phase is reached.
However the new source directory is for the forked lifecycle. I don't want
nor need it to be modified in the original lifecycle (the executedProject
one).

The AntRun plugin is executed after the clover:instrument (which modifies
the source directory):

C:\dev\maven\trunks\plugins\maven-clover-plugin\src\it\maven-clover-plugin-s
ample-class-post-processing>mvn clean site
[...]
[INFO] Preparing clover:clover
[INFO] [clover:instrument]
Clover Version 1.3.11, built on November 02 2005
[...]
Instrumented 1 source files.
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
Compiling 1 source file to
C:\dev\maven\trunks\plugins\maven-clover-plugin\src\it\maven-clover-plugin-s
ample-class-post-processing
\target\clover\classes
[INFO] [antrun:run {execution: default}]
[INFO] Executing tasks
[INFO]
----------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
----------------------------------------------------------------------------
[INFO] Error executing ant tasks

Embedded error: Source directory value was [src/main/java] instead of
[target/clover/src]

Could this be related to MNG-1927? I've seen Jason has committed something
in the AntRun plugin (see attached file).
 
> If you wanted the blow to work, you'd need to include it in the
> lifecycle.xml inside the plugin.

I don't understand this. In clover:instrument I also modify other pom stuff
like the output directory and the classes output directory, etc and
subsequent executing plugin do use the newly modified value. I'd like to do
the same for the source directory.

Thanks
-Vincent

> Vincent Massol wrote:
> > Hi,
> >
> > In the Clover plugin I modify the project.build.sourceDirectory value
> (in
> > the generate-sources phase). This is because I want any subsequent
> plugin to
> > use the directory where clover has generated the clovered source files.
> >
> > For example, I would expect the following to print the new
> sourceDirectory
> > value:
> >
> >       <plugin>
> >         <artifactId>maven-antrun-plugin</artifactId>
> >         <executions>
> >           <execution>
> >             <phase>process-classes</phase>
> >             <configuration>
> >               <tasks>
> >                 <echo message="${project.build.sourceDirectory}"/>
> >               </tasks>
> >             </configuration>
> >             <goals>
> >               <goal>run</goal>
> >             </goals>
> >           </execution>
> >         </executions>
> >       </plugin>
> >
> > But it prints the original value (src/main/java).
> >
> > Does the problem occur because of the <execution>? Doesn't executions
> > inherit their default configurations from the executing lifecycle?
> >
> > Or it the problem elsewhere?
> >
> > Thanks
> > -Vincent
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > For additional commands, e-mail: dev-help@maven.apache.org
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org

Re: [m2] Modifying project.build.sourceDirectory and executions

Posted by Brett Porter <br...@apache.org>.
This is because the part of clover that runs is forked, and the project
is cloned then reset when it returns. This is by design, so forked
lifecycles don't polllute the original. The final clover goal that cause
the fork has access to ${executedProject}, and can pump settings back
into the main project if desired at that point:

project.getBuild().setSourceDirectory(
executedProject.getBuild().getSourceDirectory() );

If you wanted the blow to work, you'd need to include it in the
lifecycle.xml inside the plugin.

- Brett

Vincent Massol wrote:
> Hi,
> 
> In the Clover plugin I modify the project.build.sourceDirectory value (in
> the generate-sources phase). This is because I want any subsequent plugin to
> use the directory where clover has generated the clovered source files.
> 
> For example, I would expect the following to print the new sourceDirectory
> value:
> 
>       <plugin>
>         <artifactId>maven-antrun-plugin</artifactId>
>         <executions>
>           <execution>
>             <phase>process-classes</phase>
>             <configuration>
>               <tasks>
>                 <echo message="${project.build.sourceDirectory}"/>
>               </tasks>
>             </configuration>
>             <goals>
>               <goal>run</goal>
>             </goals>
>           </execution>
>         </executions>
>       </plugin>
> 
> But it prints the original value (src/main/java).
> 
> Does the problem occur because of the <execution>? Doesn't executions
> inherit their default configurations from the executing lifecycle?
> 
> Or it the problem elsewhere?
> 
> Thanks
> -Vincent
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org