You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Michael Niemand <mi...@gmail.com> on 2013/04/17 16:11:52 UTC

basedir setting not working?

Hi folks,

my basedir setting doesnt seem to work.

I have the same project I check out to two different locations.

in the second project the basedir setting doesnt seem to work.

Here's what I do:

<!-- <project name="ClientKapselTest" default="targets" basedir="./"> also
tried that -->
<project name="ClientKapselTest" default="targets" >

<!-- ==================== Initialization properties =====================
-->
<echo message="*** what's considered basedir before setting it: ${basedir}"
/>
<property name="basedir" value="."/>
<echo message="*** what's considered basedir after setting it: ${basedir}"
/>

</project>

The result is always:

     [echo] *** what's considered basedir before setting it: M:\path\to\A
     [echo] *** what's considered basedir after setting it: M:\path\to\A


even though I execute the ant-skript in M:\path\to\B


I thought basedir is always the path where the build.xml itself resides?

AW: basedir setting not working?

Posted by "Jan Matèrne (jhm)" <ap...@materne.de>.
Usually you should have the basedir="." - or leave it empty (<project>...).
All paths "inside the project" should be relative.
Paths "outside the project" should be defined via properties.

So you could port the project to other locations (just define the "external
paths" as new properties).


If this doesnt answer your question I didnt get your point ...


Jan

> -----Ursprüngliche Nachricht-----
> Von: Michael Niemand [mailto:michael.niemand@gmail.com]
> Gesendet: Donnerstag, 18. April 2013 13:07
> An: Ant Users List
> Betreff: Re: basedir setting not working?
> 
> Thanks Jan,
> 
> I check out the project to 2 different locations. Hence the build file
> resides in 2 different locations. yet, the basedir is the same in both
> locations. This results in a failed build in one location.
> 
> 
> 
> On Thu, Apr 18, 2013 at 8:15 AM, Jan Matèrne (jhm)
> <ap...@materne.de>wrote:
> 
> > The "." in the basedir attribute is relative to the buildfile itself,
> > not the current directory.
> > You could access that via ${user.dir} :
> >
> > <project basedir=".">
> >     <echo>BaseDir: ${basedir}</echo>
> >     <echo>UserDir: ${user.dir}</echo>
> > </project>
> >
> > You can't set that value as basedir because at the time when basedir
> > is set, the system properties aren't populates as Ant properties.
> > (Also I would not do that because can't be sure from where a user is
> > calling the buildfile with strange site effects ... think of a "ant
> > clean" in your home dir?)
> >
> >
> > Jan
> >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Michael Niemand [mailto:michael.niemand@gmail.com]
> > > Gesendet: Mittwoch, 17. April 2013 16:12
> > > An: user@ant.apache.org
> > > Betreff: basedir setting not working?
> > >
> > > Hi folks,
> > >
> > > my basedir setting doesnt seem to work.
> > >
> > > I have the same project I check out to two different locations.
> > >
> > > in the second project the basedir setting doesnt seem to work.
> > >
> > > Here's what I do:
> > >
> > > <!-- <project name="ClientKapselTest" default="targets"
> > > basedir="./"> also tried that --> <project name="ClientKapselTest"
> default="targets"
> > > >
> > >
> > > <!-- ==================== Initialization properties
> > > =====================
> > > -->
> > > <echo message="*** what's considered basedir before setting it:
> > > ${basedir}"
> > > />
> > > <property name="basedir" value="."/> <echo message="*** what's
> > > considered basedir after setting it:
> > > ${basedir}"
> > > />
> > >
> > > </project>
> > >
> > > The result is always:
> > >
> > >      [echo] *** what's considered basedir before setting it:
> > > M:\path\to\A
> > >      [echo] *** what's considered basedir after setting it:
> > > M:\path\to\A
> > >
> > >
> > > even though I execute the ant-skript in M:\path\to\B
> > >
> > >
> > > I thought basedir is always the path where the build.xml itself
> > > resides?
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For
> additional
> > commands, e-mail: user-help@ant.apache.org
> >
> >
> 
> 
> --
> Dipl.-Ing. (FH) *Michael Niemand**
> *
> Albusstr. 17
> 60313 Frankfurt/M
> Germany
> 
> Tel.: +49 (0) 69 200 130 60
> Mobile: +49 (0) 171 645 29 07
> 
> eMail: michael.niemand@gmail.com
> sip:1406283@sipgate.de


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: basedir setting not working?

Posted by Michael Niemand <mi...@gmail.com>.
Ok, nevermind, I've found the problem.

In the ant script I call the other ant script, I set the "dir" property to
location A, so the basedir is taken from there ...




On Thu, Apr 18, 2013 at 1:07 PM, Michael Niemand
<mi...@gmail.com>wrote:

> Thanks Jan,
>
> I check out the project to 2 different locations. Hence the build file
> resides in 2 different locations. yet, the basedir is the same in both
> locations. This results in a failed build in one location.
>
>
>
> On Thu, Apr 18, 2013 at 8:15 AM, Jan Matèrne (jhm) <ap...@materne.de>wrote:
>
>> The "." in the basedir attribute is relative to the buildfile itself, not
>> the current directory.
>> You could access that via ${user.dir} :
>>
>> <project basedir=".">
>>     <echo>BaseDir: ${basedir}</echo>
>>     <echo>UserDir: ${user.dir}</echo>
>> </project>
>>
>> You can't set that value as basedir because at the time when basedir is
>> set,
>> the system properties aren't populates as Ant properties.
>> (Also I would not do that because can't be sure from where a user is
>> calling
>> the buildfile with strange site effects ... think of a "ant clean" in your
>> home dir?)
>>
>>
>> Jan
>>
>> > -----Ursprüngliche Nachricht-----
>> > Von: Michael Niemand [mailto:michael.niemand@gmail.com]
>> > Gesendet: Mittwoch, 17. April 2013 16:12
>> > An: user@ant.apache.org
>> > Betreff: basedir setting not working?
>> >
>> > Hi folks,
>> >
>> > my basedir setting doesnt seem to work.
>> >
>> > I have the same project I check out to two different locations.
>> >
>> > in the second project the basedir setting doesnt seem to work.
>> >
>> > Here's what I do:
>> >
>> > <!-- <project name="ClientKapselTest" default="targets" basedir="./">
>> > also tried that --> <project name="ClientKapselTest" default="targets"
>> > >
>> >
>> > <!-- ==================== Initialization properties
>> > =====================
>> > -->
>> > <echo message="*** what's considered basedir before setting it:
>> > ${basedir}"
>> > />
>> > <property name="basedir" value="."/>
>> > <echo message="*** what's considered basedir after setting it:
>> > ${basedir}"
>> > />
>> >
>> > </project>
>> >
>> > The result is always:
>> >
>> >      [echo] *** what's considered basedir before setting it:
>> > M:\path\to\A
>> >      [echo] *** what's considered basedir after setting it:
>> > M:\path\to\A
>> >
>> >
>> > even though I execute the ant-skript in M:\path\to\B
>> >
>> >
>> > I thought basedir is always the path where the build.xml itself
>> > resides?
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>
>
> --
> Dipl.-Ing. (FH) *Michael Niemand**
> *
> Albusstr. 17
> 60313 Frankfurt/M
> Germany
>
> Tel.: +49 (0) 69 200 130 60
> Mobile: +49 (0) 171 645 29 07
>
> eMail: michael.niemand@gmail.com
> sip:1406283@sipgate.de
>



-- 
Dipl.-Ing. (FH) *Michael Niemand**
*
Albusstr. 17
60313 Frankfurt/M
Germany

Tel.: +49 (0) 69 200 130 60
Mobile: +49 (0) 171 645 29 07

eMail: michael.niemand@gmail.com
sip:1406283@sipgate.de

Re: basedir setting not working?

Posted by Michael Niemand <mi...@gmail.com>.
Thanks Jan,

I check out the project to 2 different locations. Hence the build file
resides in 2 different locations. yet, the basedir is the same in both
locations. This results in a failed build in one location.



On Thu, Apr 18, 2013 at 8:15 AM, Jan Matèrne (jhm) <ap...@materne.de>wrote:

> The "." in the basedir attribute is relative to the buildfile itself, not
> the current directory.
> You could access that via ${user.dir} :
>
> <project basedir=".">
>     <echo>BaseDir: ${basedir}</echo>
>     <echo>UserDir: ${user.dir}</echo>
> </project>
>
> You can't set that value as basedir because at the time when basedir is
> set,
> the system properties aren't populates as Ant properties.
> (Also I would not do that because can't be sure from where a user is
> calling
> the buildfile with strange site effects ... think of a "ant clean" in your
> home dir?)
>
>
> Jan
>
> > -----Ursprüngliche Nachricht-----
> > Von: Michael Niemand [mailto:michael.niemand@gmail.com]
> > Gesendet: Mittwoch, 17. April 2013 16:12
> > An: user@ant.apache.org
> > Betreff: basedir setting not working?
> >
> > Hi folks,
> >
> > my basedir setting doesnt seem to work.
> >
> > I have the same project I check out to two different locations.
> >
> > in the second project the basedir setting doesnt seem to work.
> >
> > Here's what I do:
> >
> > <!-- <project name="ClientKapselTest" default="targets" basedir="./">
> > also tried that --> <project name="ClientKapselTest" default="targets"
> > >
> >
> > <!-- ==================== Initialization properties
> > =====================
> > -->
> > <echo message="*** what's considered basedir before setting it:
> > ${basedir}"
> > />
> > <property name="basedir" value="."/>
> > <echo message="*** what's considered basedir after setting it:
> > ${basedir}"
> > />
> >
> > </project>
> >
> > The result is always:
> >
> >      [echo] *** what's considered basedir before setting it:
> > M:\path\to\A
> >      [echo] *** what's considered basedir after setting it:
> > M:\path\to\A
> >
> >
> > even though I execute the ant-skript in M:\path\to\B
> >
> >
> > I thought basedir is always the path where the build.xml itself
> > resides?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>


-- 
Dipl.-Ing. (FH) *Michael Niemand**
*
Albusstr. 17
60313 Frankfurt/M
Germany

Tel.: +49 (0) 69 200 130 60
Mobile: +49 (0) 171 645 29 07

eMail: michael.niemand@gmail.com
sip:1406283@sipgate.de

AW: basedir setting not working?

Posted by "Jan Matèrne (jhm)" <ap...@materne.de>.
The "." in the basedir attribute is relative to the buildfile itself, not
the current directory.
You could access that via ${user.dir} :

<project basedir=".">
    <echo>BaseDir: ${basedir}</echo>
    <echo>UserDir: ${user.dir}</echo>
</project>

You can't set that value as basedir because at the time when basedir is set,
the system properties aren't populates as Ant properties.
(Also I would not do that because can't be sure from where a user is calling
the buildfile with strange site effects ... think of a "ant clean" in your
home dir?)


Jan

> -----Ursprüngliche Nachricht-----
> Von: Michael Niemand [mailto:michael.niemand@gmail.com]
> Gesendet: Mittwoch, 17. April 2013 16:12
> An: user@ant.apache.org
> Betreff: basedir setting not working?
> 
> Hi folks,
> 
> my basedir setting doesnt seem to work.
> 
> I have the same project I check out to two different locations.
> 
> in the second project the basedir setting doesnt seem to work.
> 
> Here's what I do:
> 
> <!-- <project name="ClientKapselTest" default="targets" basedir="./">
> also tried that --> <project name="ClientKapselTest" default="targets"
> >
> 
> <!-- ==================== Initialization properties
> =====================
> -->
> <echo message="*** what's considered basedir before setting it:
> ${basedir}"
> />
> <property name="basedir" value="."/>
> <echo message="*** what's considered basedir after setting it:
> ${basedir}"
> />
> 
> </project>
> 
> The result is always:
> 
>      [echo] *** what's considered basedir before setting it:
> M:\path\to\A
>      [echo] *** what's considered basedir after setting it:
> M:\path\to\A
> 
> 
> even though I execute the ant-skript in M:\path\to\B
> 
> 
> I thought basedir is always the path where the build.xml itself
> resides?


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org