repaint-io / maven-tiles

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

Collateral effects for site:stage #20

Closed rrialq closed 8 years ago

rrialq commented 9 years ago

In a multimodule Maven project the site is generated fine (mvn site) but when we run the site:stage goal the modules are created under the tile.artifactId/module.artifactId. The versions 1.7, 1.8 and 1.9-SNAPSHOT are affected.

Supposse the following multimodule Maven project:

myproject
|- pom.xml
|- module1
|  |- pom.xml
|- module2
|  |- pom.xml

And suppose myproject/pom.xml is configured as:

<plugin>
    <groupId>io.repaint.maven</groupId>
    <artifactId>tiles-maven-plugin</artifactId>
    <extensions>true</extensions>
    <configuration>
        <tiles>
            <tile>mytile.group:my-aggregated-tile:1.0.0-SNAPSHOT</tile>
        </tiles>
    </configuration>
</plugin>

And the tile is:

<reporting>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <reportSets>
                <reportSet>
                    <id>non-aggregate</id>
                    <reports>
                        <report>javadoc</report>
                        <report>test-javadoc</report>
                    </reports>
                </reportSet>
                <reportSet>
                    <id>aggregate</id>
                    <reports>
                        <report>aggregate</report>
                    </reports>
                </reportSet>
            </reportSets>
        </plugin>
    </plugins>
</reporting>

The expected staged site is as follows:

myproject
|- target
|  |- staging
|  |  |- index.html
|  |  |- module1
|  |  |  |- index.html
|  |  |- module2
|  |  |  |- index.html

But we get:

myproject
|- target
|  |- staging
|  |  |- index.html
|  |  |- my-aggregated-tile
|  |  |  |- module1
|  |  |  |  |- index.html
|  |  |  |- module2
|  |  |  |  |- index.html
rrialq commented 9 years ago

A workaround may be duplicate distributionManagement in each module, appending the path related to it.

rvowles commented 9 years ago

Multi module builds (vs reactor builds) are antithetical to the repaint ideology, so while we are happy for you to determine a fix and we can pull it in, it isn't something we will look specifically at solving. On 20/11/2014 10:41 pm, "rrialq" notifications@github.com wrote:

A workaround may be duplicate distributionManagement in each module, appending the path related to it.

— Reply to this email directly or view it on GitHub https://github.com/repaint-io/maven-tiles/issues/20#issuecomment-63782978 .

rvowles commented 9 years ago

We have an example of a single project using site which doesn't work either.

talios commented 9 years ago

On 21 Nov 2014, at 9:03, Richard Vowles wrote:

Multi module builds (vs reactor builds) are antithetical to the repaint ideology, so while we are happy for you to determine a fix and we can pull it in, it isn't something we will look specifically at solving.

Following up on this, there's an open review [1] that resolves this via the opinionated ruling that tiles simply won't run if you have submodules.

Now, here me out - the rational here ( beyond being opinionated against multi-modules ), including tiles in the parent pom has the unfortunately consequence of tripping up Apache Maven when used with the -pl, -am and -amd options ( selective building of modules within a reactor/multi-module setup ), this is due to the reactor build no longer including the parent pom which triggers maven into using the parent pom for interpolation, but does NOT trigger the tiles lifecycle against it.

Taking this further - the notion with tiles is that we're mixing the tiles into the target module, rather than relying on the parent so for that, it's makes sense for the opinionated block ( since tiles support version ranges you won't need to update each module all the time so not so much of an issue ). This also drives home the fact that different modules can mix in different sets of tiles - i.e. your web-project-tile, or service-module-tile which can improve the separation of concern between modules.

Mark

[1] https://review.gerrithub.io/216825

Mark Derricutt http://www.theoryinpractice.net http://www.chaliceofblood.net http://plus.google.com/+MarkDerricutt http://twitter.com/talios http://facebook.com/mderricutt

talios commented 8 years ago

Given the changes to multi-module builds in tiles-maven-plugin for some time, and the changes for using a release tile ( I often template the distribution URLs with ${project.artifactId} so that usages of it get the correct URLs ) I think we can close this.

@rvowles @rrialq - agree?

rvowles commented 8 years ago

yup