In POM we have a version number of the project as
<version>1.4</version>
Instead of hardcoding it each time I take a new build, I would like to
replace it with the one entered by the user when he takes a buld using
maven. I want the user to enter the version number, which will be used
placed in maven's pom.xml and then used by Maven. So this is like modifying
the pom dynamically.
I was thinking to call a ant task (which in turn calls a shell script asking
for the user to enter the version number) from within the pom when the user
executes the *mvn install* command.
Is all this possible with the approach above? How do I call a ant task that
runs BEFORE maven proceeds for all other stuff.
Similar to a constructor that is executed when you create a java object, i
want this task to be run.
Please help.
One more thing: When you execute mvn install, Maven looks for java classes
in this default directory for the compile phase
<project_home>/src/main/java/com/<java_files>
test phase <project_home>/src/test/java/com/<java_files>
How do I override this directory structure, and make maven look for the java
classes in the place that I decide.
On 5/7/08, RockRider <[EMAIL PROTECTED]> wrote:
>
>
> Hi Julien,
>
> Well, I got that by accident :). The plugin's working now. :). But it runs
> only if i run this command:
> mvn buildnumber:create install (adding the create goal explicitly in the
> command line)
>
> logically, the plugin should run on it's own, if its bound to the install
> phase as i did:
> ..........
> ......
> <phase>validate</phase>
> <goals>
> <goal>create</goal>
> </goals>
> </execution>
> ........
> .........
>
> Julien CARSIQUE wrote:
> >
> > Hi,
> >
> > The variable is "buildNumber" not "timestamp" which the value you gave to
> > buildNumber.
> >
> > I use this :
> > <plugin>
> > <groupId>org.codehaus.mojo</groupId>
> > <artifactId>buildnumber-maven-plugin</artifactId>
> > <version>1.0-beta-1</version>
> > <executions>
> > <execution>
> > <phase>validate</phase>
> > <goals>
> > <goal>create</goal>
> > </goals>
> > </execution>
> > </executions>
> > <configuration>
> > <format>{0,date,yyyyMMdd-HHmmss}</format>
> > <items>
> > <item>timestamp</item>
> > </items>
> > <doCheck>false</doCheck>
> > <doUpdate>false</doUpdate>
> > </configuration>
> > </plugin>
> >
> > Then, I use ${buildNumber} in manifest files only, not to change the
> > artifact name but you can use
> > something like this :
> >
> > <finalName>${pom.artifactId}-${pom.version}-r${buildNumber}</finalName>
> >
> > Cheers,
> > Julien
> >
> > RockRider a écrit :
> >> Hi Julien ,
> >>
> >> I have installed the plugin's jar file using the maven install install
> >> file
> >> command
> >> the plugin xml fragment, i have added to pom, under the
> >> <pluginManagement>
> >> tag.
> >> I am trying to access the timestaamp property as:
> >>
> >> <version>${timestamp}</version>, this is at the top of the xml, where in
> >> we
> >> give projects group id, artifact id, description.
> >>
> >> but the build generated is generated as applicationName-${timestamp}.
> >>
> >> so the pom is not resolving the refernce to the timestamp variable
> >> generated
> >> by the plugin.
> >>
> >> As per this link
> >> http://mojo.codehaus.org/buildnumber-maven-plugin/plugin-info.html
> >> the ${timstamp} should work.
> >>
> >> How may I debug this?
> >> May I know how you are using the timstamp variable in ur pom?
> >>
> >> Please let me know.
> >>
> >>
> >> Julien CARSIQUE wrote:
> >>> RockRider a écrit :
> >>>> As per my understanding, the artifactId is nothing but a directory
> >>>> name.
> >>>> correct?
> >>>> I am using the same name for the artifactid as well as directory where
> >>>> the
> >>>> plugin classes are present
> >>>>
> >>>> makes snese??
> >>>>
> >>> No. Module is a directory name. ArtifactId is the artifactId given to
> >>> the
> >>> artifact in its pom.xml
> >>> (in your case, the plugin's artifactId).
> >>>
> >>> Directory where plugin classes are present? You do not need to manually
> >>> download the plugin, it's
> >>> done by maven (with the correct groupId, artifactId, etc.).
> >>>
> >>>
> >>> --
> >>> Julien CARSIQUE, Nuxeo (Paris, France)
> >>> www.nuxeo.com - The Open Source ECM Platform - www.nuxeo.org
> >>> Nuxeo ECM Stack - The Java EE, scalable, standard-based ECM Platform
> >>> [EMAIL PROTECTED] | Tel: +33 1 40 33 79 87
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>> For additional commands, e-mail: [EMAIL PROTECTED]
> >>>
> >>>
> >>>
> >>
> >
> >
> > --
> > Julien CARSIQUE, Nuxeo (Paris, France)
> > www.nuxeo.com - The Open Source ECM Platform - www.nuxeo.org
> > Nuxeo ECM Stack - The Java EE, scalable, standard-based ECM Platform
> > [EMAIL PROTECTED] | Tel: +33 1 40 33 79 87
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/***-Parse-error-reading-POM-***-tp17019499p17111002.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
Regards,
Niranjan Deshpande
"Shut yourself from the world and create the reality you want"