You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Dominik Dahlem <Do...@cs.tcd.ie> on 2005/01/24 16:24:04 UTC

change dependency properties in maven.xml [u]

Hi all.

I am in a situation where I'd like to change a property for a dependency
at runtime. Depending on which goal I'm running it coud have two
different values. So far I tried to change the property with: 

    <j:forEach items="${pom.dependencies}" var="dep">
      <j:if test="${dep.getGroupId().equalsIgnoreCase('j2meunit')}">
        ${dep.setProperty('dependencyType', 'lib')}
      </j:if>
    </j:forEach>

The output of

    <echo>${dep.getProperty('dependencyType')}</echo>

is empty.

Does anyone know whether this is possible?
Any help is appreciated.

Thanks a million.
Dominik



-- 
Dominik Dahlem <Do...@cs.tcd.ie>
-------------------------------------------------------
Trinity College Dublin
Department of Computer Science,
Dublin 2, Ireland

tel: (+353) 1-608 1539
fax: (+353) 1-677 2204
www: http://www.cs.tcd.ie/Dominik.Dahlem/
-------------------------------------------------------

Re: change dependency properties in maven.xml

Posted by Dominik Dahlem <Do...@cs.tcd.ie>.
Thanks for this reply. That solved my problem. Since, this part of the
build can not be automated in cruisecontrol it is a nice workaround.
Otherwise, a more solid solution would be necessary.

Thanks again.
Dominik


On Tue, 2005-01-25 at 13:48 +0100, Charles-Alexandre Sabourdin wrote:
> My workaround was to create an other project.xml file that inherite from my 
> main project then I only have to type mavne -p project-son.xml
> Le mardi 25 Janvier 2005 12:09, Brett Porter a écrit :
> > ok, I've had a look at the code. sorry, unfortunately there isn't any
> > compatible way to modify them until 1.1 is released as the old model
> > doesn't expose the properties object.
> >
> > For Maven 1.0.x, I think this will work, but it will stop working in Maven
> > 1.1: ${dep.addProperty('dependencyType:lib')}
> > ${dep.resolveProperties()}
> >
> > I'd strongly encourage seeking a workaround.
-- 
Dominik Dahlem <Do...@cs.tcd.ie>
-------------------------------------------------------
Trinity College Dublin
Department of Computer Science,
Dublin 2, Ireland

tel: (+353) 1-608 1539
fax: (+353) 1-677 2204
www: http://www.cs.tcd.ie/Dominik.Dahlem/
-------------------------------------------------------

Re: change dependency properties in maven.xml [u]

Posted by Charles-Alexandre Sabourdin <ka...@dedaletechnology.com>.
My workaround was to create an other project.xml file that inherite from my 
main project then I only have to type mavne -p project-son.xml
Le mardi 25 Janvier 2005 12:09, Brett Porter a écrit :
> ok, I've had a look at the code. sorry, unfortunately there isn't any
> compatible way to modify them until 1.1 is released as the old model
> doesn't expose the properties object.
>
> For Maven 1.0.x, I think this will work, but it will stop working in Maven
> 1.1: ${dep.addProperty('dependencyType:lib')}
> ${dep.resolveProperties()}
>
> I'd strongly encourage seeking a workaround.
-- 
Charles-Alexandre
SABOURDIN
-----------------

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: change dependency properties in maven.xml [u]

Posted by Brett Porter <br...@gmail.com>.
ok, I've had a look at the code. sorry, unfortunately there isn't any
compatible way to modify them until 1.1 is released as the old model
doesn't expose the properties object.

For Maven 1.0.x, I think this will work, but it will stop working in Maven 1.1:
${dep.addProperty('dependencyType:lib')}
${dep.resolveProperties()}

I'd strongly encourage seeking a workaround.

Cheers,
Brett

On Tue, 25 Jan 2005 11:01:13 +0000, Dominik Dahlem
<Do...@cs.tcd.ie> wrote:
> Hi Brett.
> 
> I tried that without success. I have the following code:
> 
>     <j:forEach items="${pom.dependencies}" var="dep">
>       <j:if test="${dep.getGroupId().equalsIgnoreCase('j2meunit')}">
>         ${dep.getProperties().setProperty('dependencyType', 'lib')}
>         <echo>Added dependencyType ${dep.getProperties()}</echo>
>       </j:if>
>     </j:forEach>
> 
> with this output:
> 
> [echo] Added dependencyType []
> 
> if no properties are specified in the project.xml file and this one:
> 
> [echo] Added dependencyType [property:dependencyType:]
> 
> if I specify the property dependencyType in the project.xml file but
> leave it empty.
> 
> It appears to me that setting properties has no effect at runtime.
> Do you have another idea?
> 
> Cheers,
> Dominik
> 
> 
> On Tue, 2005-01-25 at 21:22 +1100, Brett Porter wrote:
> > IIRC, you had to do ${dep.getProperties().setProperty('foo', 'bar')}
> >
> >
> > On Tue, 25 Jan 2005 10:20:06 +0000, Dominik Dahlem
> > <Do...@cs.tcd.ie> wrote:
> > > Hi Brett. I did search the archives, but I'm afraid I couldn't find a
> > > working solution. I tried another proposed solution [1], but this one
> > > only considered the dependency path disregarding the properties.
> > >
> > > Any help or pointers is appreciated.
> > > Thanks.
> > > Dominik
> > >
> > > [1] http://www.mail-archive.com/users@maven.apache.org/msg06567.html
> > >
> > >
> > > On Tue, 2005-01-25 at 06:33 +1100, Brett Porter wrote:
> > > > this was discussed recently: was there anything in the archives?
> > > >
> > > >
> > > > On Mon, 24 Jan 2005 15:24:04 +0000, Dominik Dahlem
> > > > <Do...@cs.tcd.ie> wrote:
> > > > > Hi all.
> > > > >
> > > > > I am in a situation where I'd like to change a property for a dependency
> > > > > at runtime. Depending on which goal I'm running it coud have two
> > > > > different values. So far I tried to change the property with:
> > > > >
> > > > >     <j:forEach items="${pom.dependencies}" var="dep">
> > > > >       <j:if test="${dep.getGroupId().equalsIgnoreCase('j2meunit')}">
> > > > >         ${dep.setProperty('dependencyType', 'lib')}
> > > > >       </j:if>
> > > > >     </j:forEach>
> > > > >
> > > > > The output of
> > > > >
> > > > >     <echo>${dep.getProperty('dependencyType')}</echo>
> > > > >
> > > > > is empty.
> > > > >
> > > > > Does anyone know whether this is possible?
> > > > > Any help is appreciated.
> > > > >
> > > > > Thanks a million.
> > > > > Dominik
> > > > >
> > > > > --
> > > > > Dominik Dahlem <Do...@cs.tcd.ie>
> > > > > -------------------------------------------------------
> > > > > Trinity College Dublin
> > > > > Department of Computer Science,
> > > > > Dublin 2, Ireland
> > > > >
> > > > > tel: (+353) 1-608 1539
> > > > > fax: (+353) 1-677 2204
> > > > > www: http://www.cs.tcd.ie/Dominik.Dahlem/
> > > > > -------------------------------------------------------
> > > > >
> > > > >
> > > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > > For additional commands, e-mail: users-help@maven.apache.org
> > > >
> > > --
> > > Dominik Dahlem <Do...@cs.tcd.ie>
> > > -------------------------------------------------------
> > > Trinity College Dublin
> > > Department of Computer Science,
> > > Dublin 2, Ireland
> > >
> > > tel: (+353) 1-608 1539
> > > fax: (+353) 1-677 2204
> > > www: http://www.cs.tcd.ie/Dominik.Dahlem/
> > > -------------------------------------------------------
> > >
> > >
> > >
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> --
> Dominik Dahlem <Do...@cs.tcd.ie>
> -------------------------------------------------------
> Trinity College Dublin
> Department of Computer Science,
> Dublin 2, Ireland
> 
> tel: (+353) 1-608 1539
> fax: (+353) 1-677 2204
> www: http://www.cs.tcd.ie/Dominik.Dahlem/
> -------------------------------------------------------
> 
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: change dependency properties in maven.xml [u]

Posted by Dominik Dahlem <Do...@cs.tcd.ie>.
Hi Brett.

I tried that without success. I have the following code:

    <j:forEach items="${pom.dependencies}" var="dep">
      <j:if test="${dep.getGroupId().equalsIgnoreCase('j2meunit')}">
        ${dep.getProperties().setProperty('dependencyType', 'lib')}
        <echo>Added dependencyType ${dep.getProperties()}</echo>
      </j:if>
    </j:forEach>

with this output:

[echo] Added dependencyType []

if no properties are specified in the project.xml file and this one:

[echo] Added dependencyType [property:dependencyType:]

if I specify the property dependencyType in the project.xml file but
leave it empty.


It appears to me that setting properties has no effect at runtime.
Do you have another idea?

Cheers,
Dominik




On Tue, 2005-01-25 at 21:22 +1100, Brett Porter wrote:
> IIRC, you had to do ${dep.getProperties().setProperty('foo', 'bar')}
> 
> 
> On Tue, 25 Jan 2005 10:20:06 +0000, Dominik Dahlem
> <Do...@cs.tcd.ie> wrote:
> > Hi Brett. I did search the archives, but I'm afraid I couldn't find a
> > working solution. I tried another proposed solution [1], but this one
> > only considered the dependency path disregarding the properties.
> > 
> > Any help or pointers is appreciated.
> > Thanks.
> > Dominik
> > 
> > [1] http://www.mail-archive.com/users@maven.apache.org/msg06567.html
> > 
> > 
> > On Tue, 2005-01-25 at 06:33 +1100, Brett Porter wrote:
> > > this was discussed recently: was there anything in the archives?
> > >
> > >
> > > On Mon, 24 Jan 2005 15:24:04 +0000, Dominik Dahlem
> > > <Do...@cs.tcd.ie> wrote:
> > > > Hi all.
> > > >
> > > > I am in a situation where I'd like to change a property for a dependency
> > > > at runtime. Depending on which goal I'm running it coud have two
> > > > different values. So far I tried to change the property with:
> > > >
> > > >     <j:forEach items="${pom.dependencies}" var="dep">
> > > >       <j:if test="${dep.getGroupId().equalsIgnoreCase('j2meunit')}">
> > > >         ${dep.setProperty('dependencyType', 'lib')}
> > > >       </j:if>
> > > >     </j:forEach>
> > > >
> > > > The output of
> > > >
> > > >     <echo>${dep.getProperty('dependencyType')}</echo>
> > > >
> > > > is empty.
> > > >
> > > > Does anyone know whether this is possible?
> > > > Any help is appreciated.
> > > >
> > > > Thanks a million.
> > > > Dominik
> > > >
> > > > --
> > > > Dominik Dahlem <Do...@cs.tcd.ie>
> > > > -------------------------------------------------------
> > > > Trinity College Dublin
> > > > Department of Computer Science,
> > > > Dublin 2, Ireland
> > > >
> > > > tel: (+353) 1-608 1539
> > > > fax: (+353) 1-677 2204
> > > > www: http://www.cs.tcd.ie/Dominik.Dahlem/
> > > > -------------------------------------------------------
> > > >
> > > >
> > > >
> > > 
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > --
> > Dominik Dahlem <Do...@cs.tcd.ie>
> > -------------------------------------------------------
> > Trinity College Dublin
> > Department of Computer Science,
> > Dublin 2, Ireland
> > 
> > tel: (+353) 1-608 1539
> > fax: (+353) 1-677 2204
> > www: http://www.cs.tcd.ie/Dominik.Dahlem/
> > -------------------------------------------------------
> > 
> > 
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
-- 
Dominik Dahlem <Do...@cs.tcd.ie>
-------------------------------------------------------
Trinity College Dublin
Department of Computer Science,
Dublin 2, Ireland

tel: (+353) 1-608 1539
fax: (+353) 1-677 2204
www: http://www.cs.tcd.ie/Dominik.Dahlem/
-------------------------------------------------------

Re: change dependency properties in maven.xml [u]

Posted by Brett Porter <br...@gmail.com>.
IIRC, you had to do ${dep.getProperties().setProperty('foo', 'bar')}


On Tue, 25 Jan 2005 10:20:06 +0000, Dominik Dahlem
<Do...@cs.tcd.ie> wrote:
> Hi Brett. I did search the archives, but I'm afraid I couldn't find a
> working solution. I tried another proposed solution [1], but this one
> only considered the dependency path disregarding the properties.
> 
> Any help or pointers is appreciated.
> Thanks.
> Dominik
> 
> [1] http://www.mail-archive.com/users@maven.apache.org/msg06567.html
> 
> 
> On Tue, 2005-01-25 at 06:33 +1100, Brett Porter wrote:
> > this was discussed recently: was there anything in the archives?
> >
> >
> > On Mon, 24 Jan 2005 15:24:04 +0000, Dominik Dahlem
> > <Do...@cs.tcd.ie> wrote:
> > > Hi all.
> > >
> > > I am in a situation where I'd like to change a property for a dependency
> > > at runtime. Depending on which goal I'm running it coud have two
> > > different values. So far I tried to change the property with:
> > >
> > >     <j:forEach items="${pom.dependencies}" var="dep">
> > >       <j:if test="${dep.getGroupId().equalsIgnoreCase('j2meunit')}">
> > >         ${dep.setProperty('dependencyType', 'lib')}
> > >       </j:if>
> > >     </j:forEach>
> > >
> > > The output of
> > >
> > >     <echo>${dep.getProperty('dependencyType')}</echo>
> > >
> > > is empty.
> > >
> > > Does anyone know whether this is possible?
> > > Any help is appreciated.
> > >
> > > Thanks a million.
> > > Dominik
> > >
> > > --
> > > Dominik Dahlem <Do...@cs.tcd.ie>
> > > -------------------------------------------------------
> > > Trinity College Dublin
> > > Department of Computer Science,
> > > Dublin 2, Ireland
> > >
> > > tel: (+353) 1-608 1539
> > > fax: (+353) 1-677 2204
> > > www: http://www.cs.tcd.ie/Dominik.Dahlem/
> > > -------------------------------------------------------
> > >
> > >
> > >
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> --
> Dominik Dahlem <Do...@cs.tcd.ie>
> -------------------------------------------------------
> Trinity College Dublin
> Department of Computer Science,
> Dublin 2, Ireland
> 
> tel: (+353) 1-608 1539
> fax: (+353) 1-677 2204
> www: http://www.cs.tcd.ie/Dominik.Dahlem/
> -------------------------------------------------------
> 
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: change dependency properties in maven.xml [u]

Posted by Dominik Dahlem <Do...@cs.tcd.ie>.
Hi Brett. I did search the archives, but I'm afraid I couldn't find a
working solution. I tried another proposed solution [1], but this one
only considered the dependency path disregarding the properties.

Any help or pointers is appreciated.
Thanks.
Dominik


[1] http://www.mail-archive.com/users@maven.apache.org/msg06567.html



On Tue, 2005-01-25 at 06:33 +1100, Brett Porter wrote:
> this was discussed recently: was there anything in the archives?
> 
> 
> On Mon, 24 Jan 2005 15:24:04 +0000, Dominik Dahlem
> <Do...@cs.tcd.ie> wrote:
> > Hi all.
> > 
> > I am in a situation where I'd like to change a property for a dependency
> > at runtime. Depending on which goal I'm running it coud have two
> > different values. So far I tried to change the property with:
> > 
> >     <j:forEach items="${pom.dependencies}" var="dep">
> >       <j:if test="${dep.getGroupId().equalsIgnoreCase('j2meunit')}">
> >         ${dep.setProperty('dependencyType', 'lib')}
> >       </j:if>
> >     </j:forEach>
> > 
> > The output of
> > 
> >     <echo>${dep.getProperty('dependencyType')}</echo>
> > 
> > is empty.
> > 
> > Does anyone know whether this is possible?
> > Any help is appreciated.
> > 
> > Thanks a million.
> > Dominik
> > 
> > --
> > Dominik Dahlem <Do...@cs.tcd.ie>
> > -------------------------------------------------------
> > Trinity College Dublin
> > Department of Computer Science,
> > Dublin 2, Ireland
> > 
> > tel: (+353) 1-608 1539
> > fax: (+353) 1-677 2204
> > www: http://www.cs.tcd.ie/Dominik.Dahlem/
> > -------------------------------------------------------
> > 
> > 
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
-- 
Dominik Dahlem <Do...@cs.tcd.ie>
-------------------------------------------------------
Trinity College Dublin
Department of Computer Science,
Dublin 2, Ireland

tel: (+353) 1-608 1539
fax: (+353) 1-677 2204
www: http://www.cs.tcd.ie/Dominik.Dahlem/
-------------------------------------------------------

Re: change dependency properties in maven.xml [u]

Posted by Brett Porter <br...@gmail.com>.
this was discussed recently: was there anything in the archives?


On Mon, 24 Jan 2005 15:24:04 +0000, Dominik Dahlem
<Do...@cs.tcd.ie> wrote:
> Hi all.
> 
> I am in a situation where I'd like to change a property for a dependency
> at runtime. Depending on which goal I'm running it coud have two
> different values. So far I tried to change the property with:
> 
>     <j:forEach items="${pom.dependencies}" var="dep">
>       <j:if test="${dep.getGroupId().equalsIgnoreCase('j2meunit')}">
>         ${dep.setProperty('dependencyType', 'lib')}
>       </j:if>
>     </j:forEach>
> 
> The output of
> 
>     <echo>${dep.getProperty('dependencyType')}</echo>
> 
> is empty.
> 
> Does anyone know whether this is possible?
> Any help is appreciated.
> 
> Thanks a million.
> Dominik
> 
> --
> Dominik Dahlem <Do...@cs.tcd.ie>
> -------------------------------------------------------
> Trinity College Dublin
> Department of Computer Science,
> Dublin 2, Ireland
> 
> tel: (+353) 1-608 1539
> fax: (+353) 1-677 2204
> www: http://www.cs.tcd.ie/Dominik.Dahlem/
> -------------------------------------------------------
> 
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org