deliveredtechnologies / terraform-maven

Terraform Maven Plugin
Apache License 2.0
42 stars 13 forks source link

Maven Reactor Build > tf-maven-plugin triggers entire reactor *for each* goal *for each* submodule #224

Open tomred-net opened 4 years ago

tomred-net commented 4 years ago

When tf-maven-plugin is included in a module of a maven project, at the stage of the multi-module build tf-maven-plugin triggers the entire reactor for each state. I have provided an example below.

mvn package > 
Parent
\_ Module 1 (no tf-maven-plugin)
\_ Module 2 (no tf-maven-plugin)
\_ Module 3 (tf-maven-plugin) <- tf-maven-plugin triggers an entire reactor build for each goal
  \_ Parent (build again)
    \_ Module 1 (build again)
    \_ Module 2 (build again)
    \_ Module 3 (this is all that should have been built)

This approach is wasteful and time consuming. For example if clean goal is used the tf-maven-plugin will destroy the target directory of the other already completed modules. If more than one goal is provided then tf-maven-plugin repeats the build of the entire reactor for each goal. tf-maven-plugin doesn't impact the module alone but has a material impact on the other projects when operated as part of a reactor.

The resulting zip file is placed in the Parent target directory rather then in the desired module /target directory.

This plugin has some great features, I love your work but the plugin doesn't align well with the maven lifecycle in its present form.

Clayton7510 commented 4 years ago

Admittedly, we haven't done much testing with multi-module setups. However, we can definitely add a multi-module example and test against it. Thanks for raising this.

tomred-net commented 4 years ago

I'll put together a scenario and attach it here to demonstrate the issue.