docker-maven-plugin
docker-maven-plugin copied to clipboard
Option to suppress missing maven assembly warning
Description
I'm building a docker image with some custom S3 assets, none of which are delivered via maven and so every time I build it a warning is printed:
[WARNING] DOCKER> Dockerfile /.../docker/s3/Dockerfile does not contain an ADD or COPY directive to include assembly created at maven. Ignoring assembly.
Since this is working as intended I want to be able to suppress that warning. Is there a way to do that? If not, that would be a great feature.
Info
- d-m-p version : 0.25
- Maven version (
mvn -v
) : 3.5.3 - Docker version : 18.05.0-ce,
My build does contain an ADD command for the assembly delivered by maven (though it's moved to / by setting an assembly "name") and the plugin still emits the warning.
abbreviated effective pom.xml:
32 <groupId>mygroup.images</groupId>
33 <artifactId>build-compiler</artifactId>
34 <version>1.0.0-SNAPSHOT</version>
35 <packaging>jar</packaging>
2128 <dependencies>
2129 <dependency>
2130 <groupId>mygroup.images</groupId>
2131 <artifactId>common-resources</artifactId>
2132 <version>1.0.0-SNAPSHOT</version>
2133 <type>tar</type>
2134 <scope>compile</scope>
2135 </dependency>
2136 </dependencies>
2242 <build>
3260 <plugins>
3690 <plugin>
3691 <groupId>io.fabric8</groupId>
3692 <artifactId>docker-maven-plugin</artifactId>
3693 <version>0.33.0</version>
3694 <extensions>true</extensions>
3702 <configuration>
3703 <sourceDirectory>.</sourceDirectory>
3709 <images>
3710 <image>
3712 <build>
3713 <contextDir>.</contextDir>
3718 <assembly>
3719 <name>/</name>
3720 <descriptorRef>artifact-with-dependencies</descriptorRef>
3721 </assembly>
Dockerfile:
9 WORKDIR /tmp
10 ADD common-resources-${project.version}.tar ./
maven build output:
[INFO] --- docker-maven-plugin:0.33.0:build (docker-build) @ build-compiler ---
[INFO] Copying files to .../modules/images/build-compiler/target/docker/build-compiler/latest/build/
[WARNING] DOCKER> Dockerfile .../modules/images/build-compiler/././Dockerfile does not contain an ADD or COPY directive to include assembly created at /. Ignoring assembly.
[INFO] Building tar: .../modules/images/build-compiler/target/docker/build-compiler/latest/tmp/docker-build.tar.gz
[INFO] DOCKER> [build-compiler:latest]: Created docker-build.tar.gz in 156 milliseconds
I thought that perhaps the warning is not referring to my "common-resources" dependency but the "jar" artifact of the current build-compiler pom itself. The working directory prepared by the plugin:
target/docker/build-compiler/latest/build:
total 112
-rw-r--r-- 1 myname mygroup 1300 31 Mar 08:47 Dockerfile
-rw-r--r-- 1 myname mygroup 2292 31 Mar 08:47 build-compiler-1.0.0-SNAPSHOT.jar
-rw-r--r-- 1 myname mygroup 47104 31 Mar 08:47 common-resources-1.0.0-SNAPSHOT.tar
Updating the Dockerfile with ADD build-compiler-${project.version}.jar
does not help though, the WARNING remains.
I changed the assembly name (line 3179) from /
to deps
and used that path instead; This solves the issue and the warning is no more. The warning is also eliminated by removing <name>
altogether and falling back to the default value maven
.
This is probably a lesser side-effect of the issue mentioned in the docs at https://dmp.fabric8.io/#build-assembly-descriptor-refs under the heading: Maven peculiarities when including the artifact