Download all dependencies, dependencies of plugins, compilers, etc. With Maven?

I bake a Docker image that launches a Maven task at runtime. It looks something like this:

ADD pom.xml /srv ADD src /srv/src WORKDIR /srv RUN mvn dependencies:go-offline scala:testCompile 

At run time, I run mvn gatling:execute to run the load testing utility.

My POM looks like this:

 <project> <dependencies> <dependency> <groupId>io.gatling</groupId> <artifactId>gatling-core</artifactId> <version>${gatling.version}</version> </dependency> <dependency> <groupId>io.gatling</groupId> <artifactId>gatling-http</artifactId> <version>${gatling.version}</version> </dependency> <dependency> <groupId>io.gatling</groupId> <artifactId>gatling-app</artifactId> <version>${gatling.version}</version> </dependency> <dependency> <groupId>io.gatling.highcharts</groupId> <artifactId>gatling-charts-highcharts</artifactId> <version>${gatling.version}</version> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>net.alchim31.maven</groupId> <artifactId>scala-maven-plugin</artifactId> <version>${scala-maven-plugin.version}</version> </plugin> <plugin> <groupId>io.gatling</groupId> <artifactId>gatling-maven-plugin</artifactId> <version>${gatling-plugin.version}</version> <executions> <execution> <goals> <goal>execute</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </project> 

What I would like is that when I eventually run mvn gatling:execute , I don’t want to load any dependencies, I would like all of them to be baked into the image during assembly.

However, even running mvn dependencies:go-offline scala:testCompile does not put me in order. Running gatling:execute still requires loading additional dependencies.

How can I download absolutely everything Maven needs for my Docker image so that it does not need to load files at runtime?

+7
maven docker gatling
source share
2 answers

You don’t have to run the simulation using the maven plugin, right? You can use maven to pack the jar with all the dependencies and run a gatling runner from it.

+1
source share

You can download all the dependencies using: mvn dependency:copy-dependencies

After that, all the project dependencies will be available in the ./target/dependency/ folder.

0
source share

All Articles