Java Mailing List Archive

http://www.ant-tasks.com/

Home » Ant Users List »

Re: Conditional Path

Antoine Levy-Lambert

2010-02-02

Replies: Find Java Web Hosting

Author LoginPost Reply
Hello Tim,

<fileset dir="${catalina.home}">
   <include name="common/endorsed/*.jar" if="on.tomcat1.5"/>
  </fileset>

works.

you would need to define a property "on.tomcat1.5"

actually, if the common/endorsed folder does not exist on newer tomcat
versions, you can even simplify to :

<fileset dir="${catalina.home}">
   <include name="common/endorsed/*.jar"/>
</fileset>

which will work all the same but is not as expressive.

Regards,



Antoine

Tim Andrianoff wrote:
> I'm using a build.xml file that has the following <path> in it:
>
>  <path id="compile.classpath">
>   <pathelement location="${basedir}"/>
>
>   <fileset dir="${basedir}/lib" >
>     <include name="*.jar" />
>   </fileset>
>
>   <!-- Include all elements that Tomcat exposes to applications -->
>   <pathelement location="${catalina.home}/common/classes"/>
>   <fileset dir="${catalina.home}/common/endorsed">
>     <include name="*.jar"/>
>   </fileset>
>   <fileset dir="${catalina.home}/common/lib">
>     <include name="*.jar"/>
>   </fileset>
>   <pathelement location="${catalina.home}/shared/classes"/>
>   <fileset dir="${catalina.home}/shared/lib">
>     <include name="*.jar"/>
>   </fileset>
>  </path>
>
>
> This only works for tomcat 1.5 and below, I think, which have the "common"
> and "shared" folders in the tomcat root directory (tomcat 1.6 and up have a
> "lib" folder only under the tomcat root). This build.xml needs to be used
> by people running old and new Tomcat versions, so I want to be able to check
> for these directories, and only include them if they are present (otherwise
> the ant script doesn't work), and otherwise run the equivalent of:
>
> <path id="compile.classpath">
>   <pathelement location="${basedir}"/>
>
>   <fileset dir="${basedir}/lib" >
>     <include name="*.jar" />
>   </fileset>
>
>   <fileset dir="${catalina.home}/lib">
>     <include name="*.jar"/>
>   </fileset>
>  </path>
>
> But I'm having no luck accomplishing this. Is this possible? If so, how?
> If this makes no sense to try and do, what am I missing and how should I
> accomplish this?
>
> Thanks.
>
>  


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.