You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Jose Correia <jo...@traderoot.com> on 2007/06/22 13:05:34 UTC

Jelly question

Hi all

I'm trying to use jelly inside a maven reactor. When I iterate through a
project.xml I have the following component:

<dependency>

<groupId>tools</groupId>

<artifactId>artifact</artifactId>

<version>SNAPSHOT</version>

<properties>

<classloader>root</classloader>

<artifact.origin>traderoot</artifact.origin>

</properties>

</dependency>

<dependency>

<groupId>jaxb</groupId>

<artifactId>jaxb-api</artifactId>

<version>1.5</version>

<properties>

<classloader>root</classloader>

</properties>

</dependency>

When I go through the project.xml Iam trying to identify the
"dependency" elements which have not got this subElement :

"artifact.origin" but jelly does not seem to respond to this:

<j:forEach var="dep" items="${multipoms.dependencies}">

<j:choose trim="true">

<j:when test="${(dep.properties != null) and (not
empty(dep.properties))}">

<j:forEach var="prop" items="${dep.properties}">

<j:set var="propArtifact" value="${prop.artifact.origin}D"/>

<echo>testing2 ${propArtifact}</echo> 

......

When i do that echo, even for the top element above (the one with group
id "tools" and which has a artifact.origin) I get: testing2 D instead of
testing2 traderootD How does one deal with a defined element with a "."
in it? Does one escape it as it seems that ${prop.artifact.origin}
doesn't do the trick....

Thanks

Jose


Re: Jelly question

Posted by Lukas Theussl <lt...@apache.org>.
A dot in jelly indicates a method call, you can't access an element name 
like that (best thing is usually to avoid using . and - in variable names).

Try:

<j:set var="propArtifact" value="${dep.getProperty('artifact.origin')}"/>

HTH,
-Lukas


Jose Correia wrote:
> Hi all
> 
> I'm trying to use jelly inside a maven reactor. When I iterate through a
> project.xml I have the following component:
> 
> <dependency>
> 
> <groupId>tools</groupId>
> 
> <artifactId>artifact</artifactId>
> 
> <version>SNAPSHOT</version>
> 
> <properties>
> 
> <classloader>root</classloader>
> 
> <artifact.origin>traderoot</artifact.origin>
> 
> </properties>
> 
> </dependency>
> 
> <dependency>
> 
> <groupId>jaxb</groupId>
> 
> <artifactId>jaxb-api</artifactId>
> 
> <version>1.5</version>
> 
> <properties>
> 
> <classloader>root</classloader>
> 
> </properties>
> 
> </dependency>
> 
> When I go through the project.xml Iam trying to identify the
> "dependency" elements which have not got this subElement :
> 
> "artifact.origin" but jelly does not seem to respond to this:
> 
> <j:forEach var="dep" items="${multipoms.dependencies}">
> 
> <j:choose trim="true">
> 
> <j:when test="${(dep.properties != null) and (not
> empty(dep.properties))}">
> 
> <j:forEach var="prop" items="${dep.properties}">
> 
> <j:set var="propArtifact" value="${prop.artifact.origin}D"/>
> 
> <echo>testing2 ${propArtifact}</echo> 
> 
> ......
> 
> When i do that echo, even for the top element above (the one with group
> id "tools" and which has a artifact.origin) I get: testing2 D instead of
> testing2 traderootD How does one deal with a defined element with a "."
> in it? Does one escape it as it seems that ${prop.artifact.origin}
> doesn't do the trick....
> 
> Thanks
> 
> Jose
> 
> 

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