ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phillip Lord <p.l...@russet.org.uk>
Subject pattern set problems
Date Thu, 14 Aug 2003 17:56:05 GMT



I'm having a problem with the patternset type, which I've come across
while developing our antmerge tool.

Take a build file like so...

<project name="hello" default="test">

  <property name="base"
    value="SomeDirectoryWithLotsOfJarsIn/ext"/>

  <property name="jar-dependencies" value=""/>

  <patternset id="test-pattern">
    <patternset includes="${jar-dependencies}"/>
  </patternset>

  <target name="test">
    <copy todir=".">
      <fileset dir="${base}">
        <patternset refid="test-pattern"/>
      </fileset>
    </copy>
  </target>

</project>


Imagine /ext contains lots of jars, some of which I want to obtain. 

As it stands this build file will copy everything in the directory. If
I change 

  <property name="jar-dependencies" value=""/>

to equal  

  <property name="jar-dependencies" value="ant.jar"/>

for instance, it only copies ant.jar. 

I find this a little counter intuitive as, in the first case, I have
not asked it to include anything at all. But still it does.

Now the behaviour that I want, is not to include anything at all. I
have tried a few variations. So



  <patternset id="test-pattern">
    <patternset includes="${jar-dependencies}" excludes="**"/>
  </patternset>


fails because ant appears to include, then exclude, rather than vice
versa. 

The only solution that I can come up with is by default include...

  <property name="jar-dependencies"
  value="somerandomstringwhichisunlikelytobematched"/>


which then works as I want, but it seems rather nasty. 

Has anyone get a better idea?

Phil

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


Mime
View raw message