This relates to the issue and fix provided as a part of following PR. https://github.com/apache/ant/pull/81
I understand that this fix is available as part of Ant 1.10.6. However I continue to face this problem even with Ant 1.10.6. I have a new task defined (run-module-target) in one of my build script (macro-library.xml), which gets called by another build script (common-include.xml). /builds/v2020/demand-forecasting/scpp-stable-source/scpp-builder/build/common-include.xml:564: The following error occurred while executing this line: /builds/v2020/demand-forecasting/scpp-stable-source/scpp-builder/build/macro-library.xml:880: The following error occurred while executing this line: /builds/v2020/demand-forecasting/scpp-stable-source/scpp-builder/build/macro-library.xml:890: java.util.ConcurrentModificationException. Above ConcurrentModificationException is thrown by following line of code in macro-library.xml (details can be found in the code snippet below). <ant antfile="${@{module}.config.dir}/@{module}-build.xml" inheritRefs="true" target="@{target}"> Please note that this issue happens intermittently. I did not get the complete exception trace as seen on the PR. Do I need to run ant command with verbose flag? Code snippet from common-include.xml: <!-- - - - - - - - - - - - - - - - --> <!-- M a c r o F u n c t i o n s --> <!-- - - - - - - - - - - - - - - - --> <import file="macro-library.xml" /> <target name="war" depends="-init,-fetch-runtime-lib"> <prepare-war /> <run-module-target modules="${user.modules}" target="post-war" parallel="true" target.optional="true" /> <print-timestamp target="war" /> </target> Code snippet from macro-library.xml: <macrodef name="run-module-target"> <attribute name="modules"/> <attribute name="target"/> <attribute name="parallel" default="false" /> <attribute name="target.optional" default="false" /> <sequential> <for list="@{modules}" param="module" parallel="@{parallel}"> <sequential> <property name="@{module}.config.dir" value="${@{module}.module.dir}/Config/" /> <available property="@{module}.exists" file="${@{module}.config.dir}" type="dir" /> <if> <equals arg1="${@{module}.exists}" arg2="true" /> <then> <trycatch property="@{module}.@{target}.prop" reference="@{module}.@{target}.ref"> <try> <echo message="processing target '@{target}' for module @{module}"/> <ant antfile="${@{module}.config.dir}/@{module}-build.xml" inheritRefs="true" target="@{target}"> <property name="modulename" value="@{module}" /> <property name="module.classes.dir" value="${global.war.classes.dir}" /> <property name="module.impl.dir" value="${global.war.classes.dir}" /> </ant> </try> <catch> <if> <and> <contains casesensitive="false" string="${@{module}.@{target}.prop}" substring=""@{target}" does not exist in the project" /> <equals arg1="@{target.optional}" arg2="true" /> </and> <then> <echo message="Error running the target : ${@{module}.@{target}.prop}" level="verbose" /> <echo message="Optional target @{target} does not exist in ${@{module}.config.dir}/@{module}-build.xml. So skipping it" /> </then> <else> <throw refid="@{module}.@{target}.ref" /> </else> </if> </catch> </trycatch> </then> <else> <echo>@{module} found in composition but ${@{module}.module.dir}/Config does not exist. Target '@{target}' for @{module} will be skipped</echo> </else> </if> </sequential> </for> </sequential> </macrodef> Thanks, Avanish