You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by amit kumar <am...@gmail.com> on 2008/04/28 12:43:07 UTC
Creating a maven variable
Hi,
I want to create a variable that can take a value of directory path on the
system and that variable can be read by children projects of the project. I
tried with
<properties>
<build.directory>C:\builds</build.directory>
</properties>
but problem with this is that ${build.directory} seems to be taken as
${basedir}/${build.directory} which ultimately throws an error since the
C:\builds is not in the ${basedir}. Any clues?
The reason for having having the value in the variable is because I am
trying to put all the builds of a project in a dynamic folder named with
that particular day's date.
Regards,
Amit
Re: Creating a maven variable
Posted by amit kumar <am...@gmail.com>.
Thanks martin, problem got resolved (still to figure out why wasn't it
working earlier). I am using a property now, which seems to work, now the
issue lies with buildnumber-maven-plugin , i am not able to have two
separate buildNumbers with different formats.
Thanks adn regards,
Amit
On Tue, Apr 29, 2008 at 12:13 PM, Martin Höller <ma...@xss.co.at> wrote:
> On Monday 28 April 2008 amit kumar wrote:
> > Hi Olivier,
> > I tried the same thing in the root pom. But at the sub module level it
> > was taking ${my.build.directory} as {basedir}/${my.build.directory}, so
> > the error that was coming was like could not create *
> > D:\myProjects\project1\C:\builds\my-artifact-1.0.jar*
>
> The contents of the variable ${my.build.directory} is probably correct
> (verify it by using an antrun echo task). I bet the problem is the plugin
> using your variable. This plugin might not accept absolute path but only
> relative ones (like most maven-plugins do).
>
> See also this thread and the provided link to Brian's blog:
>
> http://www.nabble.com/Using-a-distribution-built-by-the-assembly-plugin-as-a-dependency...-to16887959s177.html
>
> hth,
> - martin
>
Re: Creating a maven variable
Posted by Martin Höller <ma...@xss.co.at>.
On Monday 28 April 2008 amit kumar wrote:
> Hi Olivier,
> I tried the same thing in the root pom. But at the sub module level it
> was taking ${my.build.directory} as {basedir}/${my.build.directory}, so
> the error that was coming was like could not create *
> D:\myProjects\project1\C:\builds\my-artifact-1.0.jar*
The contents of the variable ${my.build.directory} is probably correct
(verify it by using an antrun echo task). I bet the problem is the plugin
using your variable. This plugin might not accept absolute path but only
relative ones (like most maven-plugins do).
See also this thread and the provided link to Brian's blog:
http://www.nabble.com/Using-a-distribution-built-by-the-assembly-plugin-as-a-dependency...-to16887959s177.html
hth,
- martin
Re: Creating a maven variable
Posted by amit kumar <am...@gmail.com>.
Hi Olivier,
I tried the same thing in the root pom. But at the sub module level it was
taking ${my.build.directory} as {basedir}/${my.build.directory}, so the
error that was coming was like could not create *
D:\myProjects\project1\C:\builds\my-artifact-1.0.jar*
Is the any work around to this?
Regards,
Amit
On Mon, Apr 28, 2008 at 5:35 PM, Olivier Dehon <od...@gmail.com> wrote:
> Avoid redefining variables that are (or might be) defined by maven
> itself.
>
> Use something like:
>
> <properties>
> <my.build.directory>C:/builds</my.build.directory>
> </properties>
>
> instead.
>
> HTH, -Olivier
>
> On Mon, 2008-04-28 at 16:13 +0530, amit kumar wrote:
> > Hi,
> > I want to create a variable that can take a value of directory path on
> the
> > system and that variable can be read by children projects of the
> project. I
> > tried with
> > <properties>
> > <build.directory>C:\builds</build.directory>
> > </properties>
> >
> > but problem with this is that ${build.directory} seems to be taken as
> > ${basedir}/${build.directory} which ultimately throws an error since the
> > C:\builds is not in the ${basedir}. Any clues?
> >
> > The reason for having having the value in the variable is because I am
> > trying to put all the builds of a project in a dynamic folder named with
> > that particular day's date.
> >
> >
> > Regards,
> > Amit
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
Re: Creating a maven variable
Posted by Olivier Dehon <od...@gmail.com>.
Avoid redefining variables that are (or might be) defined by maven
itself.
Use something like:
<properties>
<my.build.directory>C:/builds</my.build.directory>
</properties>
instead.
HTH, -Olivier
On Mon, 2008-04-28 at 16:13 +0530, amit kumar wrote:
> Hi,
> I want to create a variable that can take a value of directory path on the
> system and that variable can be read by children projects of the project. I
> tried with
> <properties>
> <build.directory>C:\builds</build.directory>
> </properties>
>
> but problem with this is that ${build.directory} seems to be taken as
> ${basedir}/${build.directory} which ultimately throws an error since the
> C:\builds is not in the ${basedir}. Any clues?
>
> The reason for having having the value in the variable is because I am
> trying to put all the builds of a project in a dynamic folder named with
> that particular day's date.
>
>
> Regards,
> Amit
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org