I have a multi-module Maven project where some modules have to be built as a Docker image. I tried to put all of the configuration in the parent POM like so:
Parent POM:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.3.5</version>
<configuration>
<baseImage>java</baseImage>
<imageName>${project.artifactId}</imageName>
<entryPoint>["java", "-jar", "/${project.build.finalName}.jar"]</entryPoint>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}/${project.build.finalName}-executable</directory>
<include>${project.build.finalName}.jar</include>
<include>lib/*.jar</include>
</resource>
</resources>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
Child POM:
<build>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
But when I run mvn docker:build
on the child project I get an error because the project.build.directory
property was resolved to the target directory of the parent POM, instead of the child's target directory.
Is it possible to delay the expansion of the properties in the parent POM? Or to reference the project.*
properties of the child from the parent POM?