change tests to use Maven instead of Gradle
This commit is contained in:
@@ -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"]
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
69
test/messaging/pom.xml
Normal file
69
test/messaging/pom.xml
Normal file
@@ -0,0 +1,69 @@
|
||||
<!--
|
||||
© 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.
|
||||
-->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.ibm.mq.container</groupId>
|
||||
<artifactId>test-messaging</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>dev</version>
|
||||
<name>test-messaging</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.ibm.mq</groupId>
|
||||
<artifactId>com.ibm.mq.allclient</artifactId>
|
||||
<version>9.0.5.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.platform</groupId>
|
||||
<artifactId>junit-platform-console-standalone</artifactId>
|
||||
<version>1.2.0</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>install</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}/lib</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
Reference in New Issue
Block a user