Created attachment 30429 [details] Simple demonstration of problem If you import the same file via two different resource types (url and javaresource in my case) it can be resolved to exactly the same URL but still be imported twice. Attached is a complete demonstration of this problem. In brief, if we have a file imported.xml which fails if it is imported twice, then: <?xml version="1.0"?> <project name="multi-import"> <dirname file="${ant.file}" property="path"/> <import> <url url="file:${path}/imported.xml"/> <javaresource classpath="." name="imported.xml"/> </import> </project> will fail. This is despite the fact that ant -debug clearly shows the file is resolved to the same underlying URL: Importing file file:/home/suttona/bugs/ant-multi-import/imported.xml from /home/suttona/bugs/ant-multi-import/build.xml Overriding previous definition of reference to ant.projectHelper Adding reference: ant.projectHelper parsing buildfile file:/home/suttona/bugs/ant-multi-import/imported.xml with URI = file:/home/suttona/bugs/ant-multi-import/imported.xml ... Importing file imported.xml from /home/suttona/bugs/ant-multi-import/build.xml ResourceStream for imported.xml loaded from ant loader Overriding previous definition of reference to ant.projectHelper Adding reference: ant.projectHelper Resource imported.xml loaded from ant loader parsing buildfile file:/home/suttona/bugs/ant-multi-import/imported.xml with URI = file:/home/suttona/bugs/ant-multi-import/imported.xml The simplified example is clearly a stupid thing to do, but we ran across this issue in a much more reasonable use case. For the background see http://www.symphonious.net/2013/06/12/importing-an-ant-buildfile-multiple-times/ The work around is just to use URLs consistently - they are quite capable of pointing to files on remote servers local file systems or within zip/jar files which is all we need. Issue exists at least as far back as 1.8.4.
fixed with svn revision 1554400