From bbecbd5f580fb763caa1c995e7c061545e3add73 Mon Sep 17 00:00:00 2001 From: Sean Flanigan Date: Thu, 11 Jun 2015 16:46:05 +1000 Subject: [PATCH] Use groovy to install appserver --- etc/scripts/extractAppserver.groovy | 51 ++++++++++++++++++++++++ functional-test/pom.xml | 17 +++++--- pom.xml | 61 +++++++++++++++++------------ zanata-war/pom.xml | 9 ++--- 4 files changed, 104 insertions(+), 34 deletions(-) create mode 100644 etc/scripts/extractAppserver.groovy diff --git a/etc/scripts/extractAppserver.groovy b/etc/scripts/extractAppserver.groovy new file mode 100644 index 0000000000..f6d4520966 --- /dev/null +++ b/etc/scripts/extractAppserver.groovy @@ -0,0 +1,51 @@ +/* + * Copyright 2015, Red Hat, Inc. and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +/** + * @author Sean Flanigan sflaniga@redhat.com + */ + +import groovy.util.AntBuilder + +// NB: project is a MavenProject +// http://maven.apache.org/ref/3-LATEST/maven-core/apidocs/org/apache/maven/project/MavenProject.html + +String downloadDir = project.properties.get('download.dir') // ~/Downloads +String cargoExtractDir = project.properties.get('cargo.extract.dir') // target/cargo/installs +String url = project.properties.get('cargo.installation') // http://example.com/jbosseap6.zip + +String filename = url.substring(url.lastIndexOf('/')+1) +String filePath = "${downloadDir}/${filename}" +String basename = filename.substring(0, filename.lastIndexOf('.')) +String extractDir = "${cargoExtractDir}/${basename}" + +def ant = new AntBuilder() +ant.mkdir(dir: downloadDir) +ant.get(src: url, dest: filePath, skipexisting: "true") +ant.unzip(src: filePath, dest:"${extractDir}") + +def files = new File(extractDir).listFiles() +if (files.length != 1) { + throw new Exception('zip should contain exactly one top-level dir; see ' + extractDir) +} +def topLevelDir = files[0].path + +project.properties.put('appserver.home', topLevelDir) diff --git a/functional-test/pom.xml b/functional-test/pom.xml index af0c3ab9e9..3a4fbf56f3 100644 --- a/functional-test/pom.xml +++ b/functional-test/pom.xml @@ -476,6 +476,16 @@ + + org.codehaus.gmavenplus + gmavenplus-plugin + + + extract-appserver + prepare-package + + + maven-dependency-plugin @@ -585,10 +595,6 @@ - - cargo-install - prepare-package - cargo-start pre-integration-test @@ -854,7 +860,7 @@ - + @@ -903,6 +909,7 @@ installed + ${appserver.home} ${project.build.directory}/ehcache diff --git a/pom.xml b/pom.xml index 5225774ba6..6e2e3cd39b 100644 --- a/pom.xml +++ b/pom.xml @@ -56,11 +56,11 @@ 0.22 7.0-SNAPSHOT - 3.7.0-SNAPSHOT + 3.7.2 3.4.1 3.7.0-SNAPSHOT - 3.6.1-SNAPSHOT + 3.7.1 4.5.4.Final @@ -1181,6 +1181,33 @@ + + org.codehaus.gmavenplus + gmavenplus-plugin + + + + extract-appserver + + none + execute + + + + + + + + + + + org.apache.ant + ant-nodeps + 1.8.1 + + + org.zanata zanata-maven-plugin @@ -1251,7 +1278,7 @@ - @@ -1277,32 +1304,12 @@ org.codehaus.cargo cargo-maven2-plugin - 1.4.5 + 1.4.14 ${cargo.container} - - - ${cargo.installation} - ${download.dir} - ${cargo.extract.dir} - - - - - - - cargo-install - - none - - install - - - maven-failsafe-plugin @@ -1391,6 +1398,11 @@ 2.0 + + org.codehaus.gmavenplus + gmavenplus-plugin + 1.1 + @@ -1487,6 +1499,7 @@ jboss72x + ${env.EAP6_URL} jboss-eap-6.4 diff --git a/zanata-war/pom.xml b/zanata-war/pom.xml index 5c8d2662f9..cfaca0a6e0 100644 --- a/zanata-war/pom.xml +++ b/zanata-war/pom.xml @@ -56,7 +56,6 @@ org.codehaus.gmavenplus gmavenplus-plugin - 1.1 default @@ -1012,18 +1011,18 @@ - + - org.codehaus.cargo - cargo-maven2-plugin + org.codehaus.gmavenplus + gmavenplus-plugin - cargo-install + extract-appserver prepare-package