Julian Wood <[EMAIL PROTECTED]> wrote on 02/28/2007 12:27:37 PM:

> I don't know how you can do this. I've come across this before, and
> haven't been able to come up with a solution. In the end, you have to
> work with it. Either change the format so that it is something which
> will be the same even if they are executed a few seconds apart, or
> use revision numbers from scm, which will be the same.
Yeah, this would have been my choice, but the developers want a date
timestamp:-)
>
> If anyone knows how to prevent the modules from running the parent
> plugin, please let us know. Actually, I wonder if you could specify
> the plugin in the module poms again, but fiddle with the execution.
> Does it override what the parent specifies? Does it execute in
> addition to the parent? If it overrides, then you could change the
> phase or get rid of the goal. You might be able to stop it that way.
> Worth a shot.
In the end, my workaround was to modify the maven-buildnumber-plugin.
Here's the code snippet

 if ( project != null )
 {
            //Check if buildNumber has been set
            //If not, set it to t buildNumber
            String buildnum = System.getProperty("buildNumber");
            if (buildnum == null)
            {
                System.setProperty("buildNumber", revision);
            }

            revision = System.getProperty("buildNumber");
            project.getProperties().put( "buildNumber", revision );
            String buildnumber = (String)
project.getProperties().get("buildNumber");
            getLog().info( "Build Number: " + buildnumber );
 }

Enrique

>
> J
>
> On 24-Feb-07, at 12:19 PM, Enrique Gaona wrote:
>
> > Hi,
> > Anyone know how I can do this? Thanks
> >
> > Enrique
> >
> >> How do you run a plugin the parent pom only once and have its
> >> configuration
> >> inherited by its children.   I'm using the maven-buildnumber-
> >> plugin in my
> >> parent pom and when I run my build, this plugin gets executed on
> >> every
> >> child pom and I end up with different buildNumber ID.
> >
> >            <plugin>
> >                                <groupId>org.codehaus.mojo</groupId>
> >
> > <artifactId>maven-buildnumber-plugin</artifactId>
> >                                <version>0.9.4</version>
> >                                <executions>
> >                                        <execution>
> >                                                <phase>validate</phase>
> >                                                <goals>
> >
> > <goal>create</goal>
> >                                                </goals>
> >                                        </execution>
> >                                </executions>
> >                                <configuration>
> >                                        <doCheck>false</doCheck>
> >                                        <doUpdate>false</doUpdate>
> >                                        <format>{0,date,yyyy-MM-dd
> > HH:mm:ss}</format>
> >                                        <items>
> >                                                <item>timestamp</item>
> >                                        </items>
> >                                </configuration>
> >                        </plugin>
> >
> >
> > As you can see from the output, the both the parent and child pom.xml
> > executes the plugin ad the  buildNumber gets changed.   So,
> > basically, I
> > just want the plugin to run once and have the child poms inherit the
> > buildNumber.   Is this doable?  I tried using the
> > <inherited>false</inherited> in the parent pom, it executes the plugin
> > once, but the child poms do not get the buildNumber.
> >
>
> --
> Julian Wood <[EMAIL PROTECTED]>
>
> Software Engineer
> Teaching & Learning Centre
> University of Calgary
>
> http://tlc.ucalgary.ca
>
>

Reply via email to