Skip to content

docker-maven-plugin >= 0.47.0 regression for artifact-with-dependencies (type:jar) #1894

@laurent-gougeon

Description

@laurent-gougeon

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions