mojohaus / flatten-maven-plugin

Flatten Maven Plugin

Home Page:https://www.mojohaus.org/flatten-maven-plugin/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Relative paths in profile activation are changed to absolute path

Thomas-WB opened this issue · comments

Since we upgraded to Maven 3.8.5 from Maven 3.8.1 we have the following issue:

e.g.

<profile>
    <id>something</id>
    <activation>
        <file>
            <exists>src/main/webapp/WEB-INF/web.xml</exists>
        </file>
    </activation>
...
</profile>

is converted by our build system to

<profile>
    <id>something</id>
    <activation>
        <file>
            <exists>/builds/my-team/someproject/src/main/webapp/WEB-INF/web.xml</exists>
        </file>
    </activation>
...
</profile>

Therefore downstream projects cannot use our profile any more.

This happens also with flatten mode "clean".

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>flatten-maven-plugin</artifactId>
    <version>1.2.7</version>
    <configuration>
        <updatePomFile>true</updatePomFile>
        <outputDirectory>target</outputDirectory>
        <flattenMode>clean</flattenMode>
    </configuration>
    <executions>
        <execution>
            <id>flatten</id>
            <phase>process-resources</phase>
            <goals>
                <goal>flatten</goal>
            </goals>
        </execution>
        <execution>
            <id>flatten.clean</id>
            <phase>clean</phase>
            <goals>
                <goal>clean</goal>
            </goals>
        </execution>
    </executions>
</plugin>
commented

I can confirm this bug, the last working maven version without the issue is 3.8.4

Is it not similar / connected https://issues.apache.org/jira/browse/MNG-6802

Disclosure: I didn't analyze deeper, I only link similar for me issue.

It seems that this Maven fix changed the behavior of the flatten-plugin. Therefore our workaround is broken since Maven 3.8.5

<pomElements>
    <!-- some other configs -->
    <profiles>expand</profiles>
</pomElements>

With the new Maven version, it really does the expand. So setting the config to interpolate or using the predefined mode resolveCiFriendliesOnly works as excepted.

IMHO this issue can be closed.

Thank you very much!