Andy
Andy

Reputation: 13

How to run goals in aggregate pom after all of the child poms in maven

I have two child projects that generate jar files. I also have an aggregate pom.xml to build them in the package phase, which works. I now would like to have a goal that runs after the child projects have been packaged to generate a dockerfile using the dockerfile-maven-plugin from spotify.

Is it possible to configure the aggregate pom with the dockerfile plugin in such a way that it will run only when the jars are fully built?

Upvotes: 1

Views: 156

Answers (1)

khmarbaise
khmarbaise

Reputation: 97487

The simple thing is to have a multi module build which looks like this:

+-- pom.xml (root)
+--- child1
!       +-- pom.xml
+--- child2
!       +-- pom.xml
+--- aggregate-child
        +-- pom.xml

In the aggregate-child you define all the childs you would like to package as dependencies and in that you can also define the docker-maven-plugin to create the image.

Based on that structure you can call Maven from the root via mvn clean package.

Upvotes: 2

Related Questions