From dae2a65e8b5675a3070c82cc902d7882a969067a Mon Sep 17 00:00:00 2001 From: Arthur Barr Date: Wed, 13 Jun 2018 14:13:43 +0100 Subject: [PATCH] change tests to use Maven instead of Gradle --- test/messaging/Dockerfile | 24 ++++++------- test/messaging/build.gradle | 39 --------------------- test/messaging/pom.xml | 69 +++++++++++++++++++++++++++++++++++++ 3 files changed, 80 insertions(+), 52 deletions(-) delete mode 100644 test/messaging/build.gradle create mode 100644 test/messaging/pom.xml diff --git a/test/messaging/Dockerfile b/test/messaging/Dockerfile index c18934f..6a2d8f2 100644 --- a/test/messaging/Dockerfile +++ b/test/messaging/Dockerfile @@ -13,26 +13,24 @@ # limitations under the License. ############################################################################### -# Application build environment (Gradle) +# Application build environment (Maven) ############################################################################### -FROM gradle as builder -ENV GRADLE_OPTS="-Dorg.gradle.daemon=false" -# Change where Gradle stores its cache, so that it's not under a volume -# (and therefore gets cached by Docker) -ENV GRADLE_USER_HOME=/home/gradle/gradle -RUN mkdir -p $GRADLE_USER_HOME -COPY --chown=gradle build.gradle /app/ -WORKDIR /app +FROM maven:3-ibmjava as builder +COPY pom.xml /usr/src/mymaven/ +WORKDIR /usr/src/mymaven # Download dependencies separately, so Docker caches them -RUN gradle download +RUN mvn dependency:go-offline install # Copy source -COPY --chown=gradle src /app/src +COPY src /usr/src/mymaven/src # Run the main build -RUN gradle install +RUN mvn --offline install +# Print a list of all the files (useful for debugging) +RUN find /usr/src/mymaven ############################################################################### # Application runtime (JRE only, no build environment) ############################################################################### FROM ibmjava:sfj -COPY --from=builder /app/lib/*.jar /opt/app/ +COPY --from=builder /usr/src/mymaven/target/*.jar /opt/app/ +COPY --from=builder /usr/src/mymaven/target/lib/*.jar /opt/app/ ENTRYPOINT ["java", "-classpath", "/opt/app/*", "org.junit.platform.console.ConsoleLauncher", "-p", "com.ibm.mqcontainer.test", "--details", "verbose"] diff --git a/test/messaging/build.gradle b/test/messaging/build.gradle deleted file mode 100644 index 6fed6eb..0000000 --- a/test/messaging/build.gradle +++ /dev/null @@ -1,39 +0,0 @@ -// © Copyright IBM Corporation 2018 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -apply plugin: 'java' - -repositories { - mavenCentral() -} - -dependencies { - compile group: 'com.ibm.mq', name: 'com.ibm.mq.allclient', version: '9.0.5.0' - compile "org.junit.jupiter:junit-jupiter-api:5.0.3" - runtime "org.junit.jupiter:junit-jupiter-engine:5.0.3" - runtime "org.junit.platform:junit-platform-console-standalone:1.0.3" -} - -task download(type: Exec) { - configurations.runtime.files - commandLine 'echo', 'Downloaded all dependencies' -} - -// Copy all dependencies to the lib directory -task install(type: Copy) { - dependsOn build - from configurations.runtime - from jar - into "${project.projectDir}/lib" -} \ No newline at end of file diff --git a/test/messaging/pom.xml b/test/messaging/pom.xml new file mode 100644 index 0000000..6644de3 --- /dev/null +++ b/test/messaging/pom.xml @@ -0,0 +1,69 @@ + + + 4.0.0 + com.ibm.mq.container + test-messaging + jar + dev + test-messaging + http://maven.apache.org + + + com.ibm.mq + com.ibm.mq.allclient + 9.0.5.0 + compile + + + org.junit.jupiter + junit-jupiter-api + 5.2.0 + compile + + + org.junit.jupiter + junit-jupiter-engine + 5.2.0 + runtime + + + org.junit.platform + junit-platform-console-standalone + 1.2.0 + runtime + + + + + + maven-dependency-plugin + + + install + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + +