I'm running tests in a Docker container that uses the following Dockerfile
:
FROM maven:3.5.3-jdk-8
ENV APP_DIR=/app
RUN mkdir -p $APP_DIR
WORKDIR $APP_DIR
COPY pom.xml .
RUN mvn -B dependency:resolve -Dclassifier=test
COPY . $APP_DIR
RUN mvn -B test-compile compile
ENTRYPOINT ["mvn", "test"]
It does download some dependencies during build process. The problem is when mvn test
is running in the Docker container, it downloads some dependencies related to the Surefire plugin. What Maven command could be used to download them during the build? The project is just a basic app created with a wizard with the following pom.xml
:
<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.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>my-app</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>