-
Notifications
You must be signed in to change notification settings - Fork 657
Open
Description
Up to 0.46.0, I was able to easily build a docker image containing a set of jar based on my main jar + its transitive dependencies, excluding some of these transitive dependencies (because they are present in base image already) using 'provided' scope like this :
<dependencies>
<dependency>
<groupId>some.other.group</groupId>
<artifactId>some-jar-to-exclude-from-image</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>my.group</groupId>
<artifactId>my-jar</artifactId>
</dependency>
</dependencies>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<executions>
<execution>
<id>build</id>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
<configuration>
<images>
<image>
<name>${docker.image.name}:${docker.image.version}</name>
<build>
<from>${base.image.name}:${baseimage.version}</from>
<assemblies>
<assembly>
<descriptorRef>artifact-with-dependencies</descriptorRef>
<targetDir>/opt/share/java</targetDir>
</assembly>
</assemblies>
</build>
</image>
</images>
</configuration>
</execution>
...
As a result, image contained my-jar and any of its dependencies EXCLUDING some-jar-to-exclude-from-image and it's own dependencies (they are coming from the base image, of course).
starting with 0.47.0, all jars are pulled into the image, regardless of what I declared as "provided" in dependencies.
using maven 3.9.11
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels