repaint-io / maven-tiles

Injecting maven configurations by composition rather than inheritance
154 stars 32 forks source link

os-maven-plugin extension does not run when defined in a tile #94

Closed peterjanes closed 5 years ago

peterjanes commented 5 years ago

Given this tile.xml:

<project>
  <build>
    <extensions>
      <extension>
        <groupId>kr.motd.maven</groupId>
        <artifactId>os-maven-plugin</artifactId>
        <version>1.6.1</version>
      </extension>
    </extensions>
  </build>
</project>

and a project that imports it

...
      <plugin>
        <groupId>io.repaint.maven</groupId>
        <artifactId>tiles-maven-plugin</artifactId>
        <configuration>
          <tiles>
            <tile>com.example:os-tile:[1.0-SNAPSHOT,2)</tile>
          </tiles>
        </configuration>
      </plugin>
...

the extension isn't invoked.

I suspect this is common to any extensions, and may not be possible to work around; if so, it's probably worth documenting and/or adding as a build smell.

peterjanes commented 5 years ago

In case it's useful, here's os-maven-plugin. Also, mvn help:effective-pom does show os-maven-plugin in <extensions>.

bvella commented 5 years ago

Maven determines extensions from the models it loads, before the tiles extension has the chance to inject the parents. As such, to my knowledge, this is not possible. The extension will show up in the effective pom as this will dump out the flattened model after the tiles plugin injects the parents.

peterjanes commented 5 years ago

I thought as much. Would you like a PR for an extensions smell?

talios commented 5 years ago

@peterjanes if it doesn't work at all ( which has been my experience ) - maybe we should just be failing the build full stop, rather than having a smell that ultimate won't do what you expect/assume.

rvowles commented 5 years ago

Failing the build of the tile? I would go with that, a smell is a bad build practice, something that won't work at all is an error condition.

On Fri, Apr 5, 2019, 11:14 AM Mark Derricutt notifications@github.com wrote:

@peterjanes https://github.com/peterjanes if it doesn't work at all ( which has been my experience ) - maybe we should just be failing the build full stop, rather than having a smell that ultimate won't do what you expect/assume.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/repaint-io/maven-tiles/issues/94#issuecomment-480083086, or mute the thread https://github.com/notifications/unsubscribe-auth/AADZ2Hq7cNhwxR1UoEC20v7nWffR1gS4ks5vdnlOgaJpZM4cMFmI .