Repository: tomee Updated Branches: refs/heads/develop 1f4c6660f -> 3d9c644fe
TOMEE-1519 Give Windows a second chance to delete this object. Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/3d9c644f Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/3d9c644f Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/3d9c644f Branch: refs/heads/develop Commit: 3d9c644fe8150bb6d345f7e8548f6c24a4aef65e Parents: 1f4c666 Author: Thiago Veronezi <[email protected]> Authored: Mon Feb 23 06:34:18 2015 -0500 Committer: Thiago Veronezi <[email protected]> Committed: Mon Feb 23 06:35:25 2015 -0500 ---------------------------------------------------------------------- .../main/groovy/commands/SetupCommand.groovy | 27 +++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tomee/blob/3d9c644f/tomee/apache-tomee/src/main/groovy/commands/SetupCommand.groovy ---------------------------------------------------------------------- diff --git a/tomee/apache-tomee/src/main/groovy/commands/SetupCommand.groovy b/tomee/apache-tomee/src/main/groovy/commands/SetupCommand.groovy index f86a5ce..512f89e 100644 --- a/tomee/apache-tomee/src/main/groovy/commands/SetupCommand.groovy +++ b/tomee/apache-tomee/src/main/groovy/commands/SetupCommand.groovy @@ -27,7 +27,7 @@ class SetupCommand { def pom def log def project - def ant + AntBuilder ant def properties def require(String name) { @@ -45,6 +45,15 @@ class SetupCommand { return value } + def deleteWithRetry = { + try { + ant.delete(it) + } catch (e) { + log.warn("RETRY Deleting: ${it}") + ant.delete(it) + } + } + def execute() { String tomcatVersion = require('tomcat.version') System.setProperty('tomcat.version', tomcatVersion) @@ -93,20 +102,20 @@ class SetupCommand { // clean up duplicate jars since in TomEE it is useless // = gain of space ;) - ant.delete(file: paths.getJAXBImpl()) - ant.delete(file: paths.getOpenEJBTomcatLoaderJar()) - ant.delete(file: paths.findTomEELibJar('jaxb-impl')) - ant.delete(file: paths.findTomEELibJar("openejb-javaagent-${openejbVersion}.jar" as String)) + deleteWithRetry(file: paths.getJAXBImpl()) + deleteWithRetry(file: paths.getOpenEJBTomcatLoaderJar()) + deleteWithRetry(file: paths.findTomEELibJar('jaxb-impl')) + deleteWithRetry(file: paths.findTomEELibJar("openejb-javaagent-${openejbVersion}.jar" as String)) // we need the one without version - ant.delete(file: paths.findOpenEJBWebJar('tomee-loader')) - ant.delete(file: paths.findOpenEJBWebJar('swizzle-stream')) + deleteWithRetry(file: paths.findOpenEJBWebJar('tomee-loader')) + deleteWithRetry(file: paths.findOpenEJBWebJar('swizzle-stream')) log.info('Assigning execute privileges to scripts in Tomcat bin directory') ant.chmod(dir: "${workDir}/apache-tomcat-${tomcatVersion}/bin", perm: 'u+x', includes: '**/*.sh') - ant.delete(dir: "${workDir}/apache-tomcat-${tomcatVersion}/webapps/examples") - ant.delete(dir: "${workDir}/apache-tomcat-${tomcatVersion}/webapps/tomee") + deleteWithRetry(dir: "${workDir}/apache-tomcat-${tomcatVersion}/webapps/examples") + deleteWithRetry(dir: "${workDir}/apache-tomcat-${tomcatVersion}/webapps/tomee") } }
