Skip to content

Commit 6c62863

Browse files
Clarify example in usage about updatePomFile behavior
1 parent fc35f4c commit 6c62863

3 files changed

Lines changed: 17 additions & 22 deletions

File tree

README.md

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,7 @@ This is the [flatten-maven-plugin](http://www.mojohaus.org/flatten-maven-plugin/
1010

1111
This plugin generates a flattened version of your pom.xml and makes maven to install and deploy this one instead of the original pom.xml.
1212

13-
```
14-
<build>
15-
<plugins>
16-
<plugin>
17-
<groupId>org.codehaus.mojo</groupId>
18-
<artifactId>flatten-maven-plugin</artifactId>
19-
<!--<version>INSERT LATEST VERSION HERE</version>-->
20-
<executions>
21-
<execution>
22-
<goals>
23-
<goal>flatten</goal>
24-
</goals>
25-
</execution>
26-
</executions>
27-
<configuration>
28-
<!-- See usage on maven site from link above for details -->
29-
</configuration>
30-
</plugin>
31-
</plugins>
32-
</build>
33-
```
13+
Please refer to the [Usage page](https://www.mojohaus.org/flatten-maven-plugin/usage.html) for simple example.
3414

3515
## Releasing
3616

src/main/java/org/codehaus/mojo/flatten/FlattenMojo.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1310,7 +1310,12 @@ public boolean isUpdatePomFile() {
13101310
if (this.flattenMode == FlattenMode.bom) {
13111311
return true;
13121312
}
1313-
return !this.project.getPackaging().equals("pom");
1313+
if (this.project.getPackaging().equals("pom")) {
1314+
getLog().info("Project POM file not updated to point to the flattened POM due to 'pom' packaging");
1315+
return false;
1316+
} else {
1317+
return true;
1318+
}
13141319
} else {
13151320
return this.updatePomFile;
13161321
}

src/site/xdoc/usage.xml.vm

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@
3939
</plugins>
4040
</build>
4141
]]></source>
42+
43+
<subsection name="NOTICE">
44+
<p>The generated flattened POM will be set as POM file to the current project only for projects with packaging other than <code>pom</code>.
45+
You may want to also do this for <code>pom</code> packaging projects by setting the parameter <code>updatePomFile</code> to <code>true</code>.</p>
46+
47+
<p>If <code>flattenMode</code> is set to <code>bom</code> the generated flattened POM will be set as a project POM file also for <code>pom</code> packaging.</p>
48+
49+
<p>Setting generated flattened POM as a project POM file will allow to install/deploy the generated POM instead of actual project POM file.</p>
50+
</subsection>
51+
4252
<subsection name="Keep developer information">
4353
If you want to keep additional development information in your POM you can configure predefined modes via the <code>flattenMode</code> parameter.
4454
For typical open-source-projects you can choose "oss". To keep all additional POM elements and flatten only to a bare minimum use "resolveCiFriendliesOnly".

0 commit comments

Comments
 (0)