title: Downloading all dependencies for Maven test
body: <p>I'm running tests in a Docker container that uses the following <code>Dockerfile</code>:</p>
  <pre><code>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 [&quot;mvn&quot;, &quot;test&quot;]
  </code></pre>
  <p>It does download some dependencies during build process. The problem is when <code>mvn test</code> 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 <code>pom.xml</code>:</p>
  <pre><code>&lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
    xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd&quot;&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;groupId&gt;com.mycompany.app&lt;/groupId&gt;
    &lt;artifactId&gt;my-app&lt;/artifactId&gt;
    &lt;packaging&gt;jar&lt;/packaging&gt;
    &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
    &lt;name&gt;my-app&lt;/name&gt;
    &lt;url&gt;http://maven.apache.org&lt;/url&gt;
    &lt;dependencies&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;junit&lt;/groupId&gt;
        &lt;artifactId&gt;junit&lt;/artifactId&gt;
        &lt;version&gt;3.8.1&lt;/version&gt;
        &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
    &lt;/dependencies&gt;
  &lt;/project&gt;
  </code></pre>