Monday 4 October 2010

Apache Ant error: restrict doesn't support the nested "name" element

System: Ant 1.7.1 and Sun Java 1.6 on Ubuntu Lucid 10.04

Code snippet:
<target name="jar">
<jar basedir="${bin}" destfile="${project.name}.jar">
<restrict>
<name name="**/*" />
<archives>
<zips>
<fileset dir="/opt/project_jars">
<include name="file.jar" /> 
</fileset> 
</zips> 
</archives> 
</restrict> 
</jar> 
</target>

From googling the error, I found this thread: http://markmail.org/message/y2ly5gykzbpab7p7. The suggested solution of adding namespace information got rid of the original error, but introduced a new one:
restrict doesn't support the nested "archives" element

Actual solution: upgrade Ant to 1.8
sudo apt-get install ant1.8 

2 comments: