You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Yaakov Chaikin <ya...@gmail.com> on 2007/10/28 04:00:22 UTC
Referring to basedir
Hi,
I have a spring context XML file in src/resourses/context.xml. I need
to refer to a property file inside the context.xml file, so I have the
following line there:
<constructor-arg index="0"
value="${project.build.directory}/aim-validator.properties"/>
I also have this in my pom.xml:
<build>
<resources>
<resource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
....
</build>
Am I referring to the base directory properly? Because Spring keeps
blowing up with FileNotFoundException and citing the file location
with ${project.build.directory}/aim-validator.properties, so the
property is not opened up to the real path.
Anyone know if I am referring to this property correctly or if
something else I am forgetting?
Thanks,
Yaakov.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Referring to basedir
Posted by Greg Morgan <dr...@cox.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Yaakov Chaikin wrote:
> Wait a second... If I am pretty new to maven, so...
>
> I did tell maven in my pom.xml that I want the directory
> src/test/resources filtered. So, why wouldn't it filter it? OR are you
> saying that I have to create a 'filters' directory and place a
> property file there and use THAT to filter things?
>
> What's the usual way to filter files you want copied in maven?
The code download via the props/pom.xml file of this article
http://www.devx.com/Java/Article/32386/0/page/1 says
<!--
In order to use filters you must specify a resource
directory and set filtering to true. The remaining
elements are not required.
-->
<resources>
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
<targetPath>META-INF</targetPath>
<includes>
<include>*.xml</include>
</includes>
</resource>
</resources>
Page 2 http://www.devx.com/Java/Article/32386/0/page/2 has a section
called "Filter is Your Friend. That may provide you with a working
example of what you are trying to accomplish.
Regards,
Greg
>
> Thanks,
> Yaakov.
>
> On 10/28/07, Nicole Lacoste <ni...@gmail.com> wrote:
>> Hi Yaakov,
>>
>> Do I understand right that the ${project.build.directory} in in a file that
>> is not a pom? I don't think that if gets resolved outside of pom files.
>> Try just the name of the file "aim-validator.properties" instead of "${
>> project.build.directory}/aim-validator.properties". If it is in
>> src/test/resources maven should find it by itself.
>>
>> Nicole
>>
>>
>> On 28/10/2007, Yaakov Chaikin <ya...@gmail.com> wrote:
>>> I got mixed up when typing up the email. I do have the context.xml in
>>> src/test/resources.
>>>
>>> Either way, I am not sure why the FileNotFoundException cites the
>>> literal string: ${project.build.directory} and not the absolute path.
>>>
>>> Yaakov.
>>>
>>> On 10/28/07, Nicole Lacoste <ni...@gmail.com> wrote:
>>>> Hi Yaakov,
>>>>
>>>> Not sure if this is your problem, but
>>>>
>>>> ${project.build.directory} refers to the target directory.
>>>> ${project.directory} refers to the directory that contains the src
>>>> directory. Also I am wondering why you have the context.xml file where
>>> you
>>>> do in src/resources, and not in src/main/resourses or
>>> src/test/resourses,
>>>> which maven automatically sees.
>>>>
>>>> Hope this helps,
>>>>
>>>> Nicole
>>>>
>>>>
>>>> On 28/10/2007, Yaakov Chaikin <ya...@gmail.com> wrote:
>>>>> Hi,
>>>>>
>>>>> I have a spring context XML file in src/resourses/context.xml. I need
>>>>> to refer to a property file inside the context.xml file, so I have the
>>>>> following line there:
>>>>> <constructor-arg index="0"
>>>>> value="${project.build.directory}/aim-validator.properties"/>
>>>>>
>>>>> I also have this in my pom.xml:
>>>>> <build>
>>>>> <resources>
>>>>> <resource>
>>>>> <directory>src/test/resources</directory>
>>>>> <filtering>true</filtering>
>>>>> </resource>
>>>>> </resources>
>>>>> ....
>>>>> </build>
>>>>>
>>>>> Am I referring to the base directory properly? Because Spring keeps
>>>>> blowing up with FileNotFoundException and citing the file location
>>>>> with ${project.build.directory}/aim-validator.properties, so the
>>>>> property is not opened up to the real path.
>>>>>
>>>>> Anyone know if I am referring to this property correctly or if
>>>>> something else I am forgetting?
>>>>>
>>>>> Thanks,
>>>>> Yaakov.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org
iD8DBQFHJRr4xyxe5L6mr7IRAs7cAJ98oimlids46nfoCbk3OTZT5VjFKQCfbWOc
caYFLWLznlOdDCFIYJ0iuYw=
=ABAf
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Referring to basedir
Posted by Nicole Lacoste <ni...@gmail.com>.
I don't know about filters. But maven sees src/test/resources, so you can
refer to stuff directly. Did you try it? Are you still getting the same
error?
Nicole
On 28/10/2007, Yaakov Chaikin <ya...@gmail.com> wrote:
>
> Wait a second... If I am pretty new to maven, so...
>
> I did tell maven in my pom.xml that I want the directory
> src/test/resources filtered. So, why wouldn't it filter it? OR are you
> saying that I have to create a 'filters' directory and place a
> property file there and use THAT to filter things?
>
> What's the usual way to filter files you want copied in maven?
>
> Thanks,
> Yaakov.
>
> On 10/28/07, Nicole Lacoste <ni...@gmail.com> wrote:
> > Hi Yaakov,
> >
> > Do I understand right that the ${project.build.directory} in in a file
> that
> > is not a pom? I don't think that if gets resolved outside of pom files.
> > Try just the name of the file "aim-validator.properties" instead of "${
> > project.build.directory}/aim-validator.properties". If it is in
> > src/test/resources maven should find it by itself.
> >
> > Nicole
> >
> >
> > On 28/10/2007, Yaakov Chaikin <ya...@gmail.com> wrote:
> > >
> > > I got mixed up when typing up the email. I do have the context.xml in
> > > src/test/resources.
> > >
> > > Either way, I am not sure why the FileNotFoundException cites the
> > > literal string: ${project.build.directory} and not the absolute path.
> > >
> > > Yaakov.
> > >
> > > On 10/28/07, Nicole Lacoste <ni...@gmail.com> wrote:
> > > > Hi Yaakov,
> > > >
> > > > Not sure if this is your problem, but
> > > >
> > > > ${project.build.directory} refers to the target directory.
> > > > ${project.directory} refers to the directory that contains the src
> > > > directory. Also I am wondering why you have the context.xml file
> where
> > > you
> > > > do in src/resources, and not in src/main/resourses or
> > > src/test/resourses,
> > > > which maven automatically sees.
> > > >
> > > > Hope this helps,
> > > >
> > > > Nicole
> > > >
> > > >
> > > > On 28/10/2007, Yaakov Chaikin <ya...@gmail.com> wrote:
> > > > >
> > > > > Hi,
> > > > >
> > > > > I have a spring context XML file in src/resourses/context.xml. I
> need
> > > > > to refer to a property file inside the context.xml file, so I have
> the
> > > > > following line there:
> > > > > <constructor-arg index="0"
> > > > > value="${project.build.directory}/aim-validator.properties"/>
> > > > >
> > > > > I also have this in my pom.xml:
> > > > > <build>
> > > > > <resources>
> > > > > <resource>
> > > > > <directory>src/test/resources</directory>
> > > > > <filtering>true</filtering>
> > > > > </resource>
> > > > > </resources>
> > > > > ....
> > > > > </build>
> > > > >
> > > > > Am I referring to the base directory properly? Because Spring
> keeps
> > > > > blowing up with FileNotFoundException and citing the file location
> > > > > with ${project.build.directory}/aim-validator.properties, so the
> > > > > property is not opened up to the real path.
> > > > >
> > > > > Anyone know if I am referring to this property correctly or if
> > > > > something else I am forgetting?
> > > > >
> > > > > Thanks,
> > > > > Yaakov.
> > > > >
> > > > >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > > > For additional commands, e-mail: users-help@maven.apache.org
> > > > >
> > > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
Re: Referring to basedir
Posted by Yaakov Chaikin <ya...@gmail.com>.
Wait a second... If I am pretty new to maven, so...
I did tell maven in my pom.xml that I want the directory
src/test/resources filtered. So, why wouldn't it filter it? OR are you
saying that I have to create a 'filters' directory and place a
property file there and use THAT to filter things?
What's the usual way to filter files you want copied in maven?
Thanks,
Yaakov.
On 10/28/07, Nicole Lacoste <ni...@gmail.com> wrote:
> Hi Yaakov,
>
> Do I understand right that the ${project.build.directory} in in a file that
> is not a pom? I don't think that if gets resolved outside of pom files.
> Try just the name of the file "aim-validator.properties" instead of "${
> project.build.directory}/aim-validator.properties". If it is in
> src/test/resources maven should find it by itself.
>
> Nicole
>
>
> On 28/10/2007, Yaakov Chaikin <ya...@gmail.com> wrote:
> >
> > I got mixed up when typing up the email. I do have the context.xml in
> > src/test/resources.
> >
> > Either way, I am not sure why the FileNotFoundException cites the
> > literal string: ${project.build.directory} and not the absolute path.
> >
> > Yaakov.
> >
> > On 10/28/07, Nicole Lacoste <ni...@gmail.com> wrote:
> > > Hi Yaakov,
> > >
> > > Not sure if this is your problem, but
> > >
> > > ${project.build.directory} refers to the target directory.
> > > ${project.directory} refers to the directory that contains the src
> > > directory. Also I am wondering why you have the context.xml file where
> > you
> > > do in src/resources, and not in src/main/resourses or
> > src/test/resourses,
> > > which maven automatically sees.
> > >
> > > Hope this helps,
> > >
> > > Nicole
> > >
> > >
> > > On 28/10/2007, Yaakov Chaikin <ya...@gmail.com> wrote:
> > > >
> > > > Hi,
> > > >
> > > > I have a spring context XML file in src/resourses/context.xml. I need
> > > > to refer to a property file inside the context.xml file, so I have the
> > > > following line there:
> > > > <constructor-arg index="0"
> > > > value="${project.build.directory}/aim-validator.properties"/>
> > > >
> > > > I also have this in my pom.xml:
> > > > <build>
> > > > <resources>
> > > > <resource>
> > > > <directory>src/test/resources</directory>
> > > > <filtering>true</filtering>
> > > > </resource>
> > > > </resources>
> > > > ....
> > > > </build>
> > > >
> > > > Am I referring to the base directory properly? Because Spring keeps
> > > > blowing up with FileNotFoundException and citing the file location
> > > > with ${project.build.directory}/aim-validator.properties, so the
> > > > property is not opened up to the real path.
> > > >
> > > > Anyone know if I am referring to this property correctly or if
> > > > something else I am forgetting?
> > > >
> > > > Thanks,
> > > > Yaakov.
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > > For additional commands, e-mail: users-help@maven.apache.org
> > > >
> > > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Referring to basedir
Posted by Nicole Lacoste <ni...@gmail.com>.
Hi Yaakov,
Do I understand right that the ${project.build.directory} in in a file that
is not a pom? I don't think that if gets resolved outside of pom files.
Try just the name of the file "aim-validator.properties" instead of "${
project.build.directory}/aim-validator.properties". If it is in
src/test/resources maven should find it by itself.
Nicole
On 28/10/2007, Yaakov Chaikin <ya...@gmail.com> wrote:
>
> I got mixed up when typing up the email. I do have the context.xml in
> src/test/resources.
>
> Either way, I am not sure why the FileNotFoundException cites the
> literal string: ${project.build.directory} and not the absolute path.
>
> Yaakov.
>
> On 10/28/07, Nicole Lacoste <ni...@gmail.com> wrote:
> > Hi Yaakov,
> >
> > Not sure if this is your problem, but
> >
> > ${project.build.directory} refers to the target directory.
> > ${project.directory} refers to the directory that contains the src
> > directory. Also I am wondering why you have the context.xml file where
> you
> > do in src/resources, and not in src/main/resourses or
> src/test/resourses,
> > which maven automatically sees.
> >
> > Hope this helps,
> >
> > Nicole
> >
> >
> > On 28/10/2007, Yaakov Chaikin <ya...@gmail.com> wrote:
> > >
> > > Hi,
> > >
> > > I have a spring context XML file in src/resourses/context.xml. I need
> > > to refer to a property file inside the context.xml file, so I have the
> > > following line there:
> > > <constructor-arg index="0"
> > > value="${project.build.directory}/aim-validator.properties"/>
> > >
> > > I also have this in my pom.xml:
> > > <build>
> > > <resources>
> > > <resource>
> > > <directory>src/test/resources</directory>
> > > <filtering>true</filtering>
> > > </resource>
> > > </resources>
> > > ....
> > > </build>
> > >
> > > Am I referring to the base directory properly? Because Spring keeps
> > > blowing up with FileNotFoundException and citing the file location
> > > with ${project.build.directory}/aim-validator.properties, so the
> > > property is not opened up to the real path.
> > >
> > > Anyone know if I am referring to this property correctly or if
> > > something else I am forgetting?
> > >
> > > Thanks,
> > > Yaakov.
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
Re: Referring to basedir
Posted by Yaakov Chaikin <ya...@gmail.com>.
I got mixed up when typing up the email. I do have the context.xml in
src/test/resources.
Either way, I am not sure why the FileNotFoundException cites the
literal string: ${project.build.directory} and not the absolute path.
Yaakov.
On 10/28/07, Nicole Lacoste <ni...@gmail.com> wrote:
> Hi Yaakov,
>
> Not sure if this is your problem, but
>
> ${project.build.directory} refers to the target directory.
> ${project.directory} refers to the directory that contains the src
> directory. Also I am wondering why you have the context.xml file where you
> do in src/resources, and not in src/main/resourses or src/test/resourses,
> which maven automatically sees.
>
> Hope this helps,
>
> Nicole
>
>
> On 28/10/2007, Yaakov Chaikin <ya...@gmail.com> wrote:
> >
> > Hi,
> >
> > I have a spring context XML file in src/resourses/context.xml. I need
> > to refer to a property file inside the context.xml file, so I have the
> > following line there:
> > <constructor-arg index="0"
> > value="${project.build.directory}/aim-validator.properties"/>
> >
> > I also have this in my pom.xml:
> > <build>
> > <resources>
> > <resource>
> > <directory>src/test/resources</directory>
> > <filtering>true</filtering>
> > </resource>
> > </resources>
> > ....
> > </build>
> >
> > Am I referring to the base directory properly? Because Spring keeps
> > blowing up with FileNotFoundException and citing the file location
> > with ${project.build.directory}/aim-validator.properties, so the
> > property is not opened up to the real path.
> >
> > Anyone know if I am referring to this property correctly or if
> > something else I am forgetting?
> >
> > Thanks,
> > Yaakov.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Referring to basedir
Posted by Nicole Lacoste <ni...@gmail.com>.
Hi Yaakov,
Not sure if this is your problem, but
${project.build.directory} refers to the target directory.
${project.directory} refers to the directory that contains the src
directory. Also I am wondering why you have the context.xml file where you
do in src/resources, and not in src/main/resourses or src/test/resourses,
which maven automatically sees.
Hope this helps,
Nicole
On 28/10/2007, Yaakov Chaikin <ya...@gmail.com> wrote:
>
> Hi,
>
> I have a spring context XML file in src/resourses/context.xml. I need
> to refer to a property file inside the context.xml file, so I have the
> following line there:
> <constructor-arg index="0"
> value="${project.build.directory}/aim-validator.properties"/>
>
> I also have this in my pom.xml:
> <build>
> <resources>
> <resource>
> <directory>src/test/resources</directory>
> <filtering>true</filtering>
> </resource>
> </resources>
> ....
> </build>
>
> Am I referring to the base directory properly? Because Spring keeps
> blowing up with FileNotFoundException and citing the file location
> with ${project.build.directory}/aim-validator.properties, so the
> property is not opened up to the real path.
>
> Anyone know if I am referring to this property correctly or if
> something else I am forgetting?
>
> Thanks,
> Yaakov.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
Re: Referring to basedir
Posted by Dan Kigelman <dk...@gmail.com>.
A nice test to do would be:
<constructor-arg index="0" value="${pom.artifactId}/aim-validator.properties
"/>
That way, if you get FileNotFoundException citing the file location
your-artifact-id/aim-validator.properties, then the problem is (somehow)
with the ${project.build.directory}. If you get a FileNotFoundException
with ${pom.artifactId}/aim-validator.properties, then the problem is with
filtering. ${pom.artifactId} is something that's always filtered correctly
for me...
Hope this helps..
-- Dan
On 10/27/07, Yaakov Chaikin <ya...@gmail.com> wrote:
>
> Hi,
>
> I have a spring context XML file in src/resourses/context.xml. I need
> to refer to a property file inside the context.xml file, so I have the
> following line there:
> <constructor-arg index="0"
> value="${project.build.directory}/aim-validator.properties"/>
>
> I also have this in my pom.xml:
> <build>
> <resources>
> <resource>
> <directory>src/test/resources</directory>
> <filtering>true</filtering>
> </resource>
> </resources>
> ....
> </build>
>
> Am I referring to the base directory properly? Because Spring keeps
> blowing up with FileNotFoundException and citing the file location
> with ${project.build.directory}/aim-validator.properties, so the
> property is not opened up to the real path.
>
> Anyone know if I am referring to this property correctly or if
> something else I am forgetting?
>
> Thanks,
> Yaakov.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>