Flatten Maven Plugin

Simplify Maven project descriptor for publication

License

License

Apache-2.0
Categories

Categories

Maven Build Tools
GroupId

GroupId

com.carrotgarden.maven
ArtifactId

ArtifactId

flatten-maven-plugin
Last Version

Last Version

1.7.20200503171255
Release Date

Release Date

Type

Type

maven-plugin
Description

Description

Flatten Maven Plugin
Simplify Maven project descriptor for publication
Project URL

Project URL

https://github.com/random-maven/flatten-maven-plugin
Project Organization

Project Organization

CarrotGarden
Source Code Management

Source Code Management

https://github.com/random-maven/flatten-maven-plugin

Download flatten-maven-plugin

How to add to project

<plugin>
    <groupId>com.carrotgarden.maven</groupId>
    <artifactId>flatten-maven-plugin</artifactId>
    <version>1.7.20200503171255</version>
</plugin>

Dependencies

compile (7)

Group / Artifact Type Version
org.sonatype.plexus : plexus-build-api jar 0.0.7
org.apache.maven.shared : maven-dependency-analyzer jar 1.11.1
org.apache.maven : maven-plugin-api jar 3.5.4
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.5.2
org.apache.maven.plugins : maven-dependency-plugin jar 3.0.2
org.apache.maven : maven-core jar 3.5.4
org.apache.maven : maven-compat jar 3.5.4

Project Modules

There are no modules declared in this project.

Flatten Maven Plugin

Project License Travis Status Appvey Status Lines of Code

Production Release Development Release
Install
Central Bintray

Similar plugins

Plugin features

  • replaces published identity
  • resolves dependency version ranges
  • excludes dependencies based on scope
  • optionally includes transitive dependencies
  • removes pom.xml members based on xml tag names
  • switches project pom.xml with generated pom.xml.flatten

Maven goals

Plugin demo

Compare results

Usage examples

Test projects

flatten:flatten - produce deployment pom.xml.flatten

mvn clean package -P flatten
        <profile>
            <id>flatten</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.carrotgarden.maven</groupId>
                        <artifactId>flatten-maven-plugin</artifactId>
                        <configuration>

                            <!-- Control dependency resolution. -->
                            <performDependencyResolve>true</performDependencyResolve>
                            <includeScope>runtime</includeScope>
                            <excludeTransitive>false</excludeTransitive>

                            <!-- Remove these pom.xml members. -->
                            <performRemoveMembers>true</performRemoveMembers>
                            <memberRemoveList>
                                <member>parent</member>
                                <member>properties</member>
                                <member>distributionManagement</member>
                                <member>dependencyManagement</member>
                                <member>repositories</member>
                                <member>pluginRepositories</member>
                                <member>build</member>
                                <member>profiles</member>
                                <member>reporting</member>
                            </memberRemoveList>

                            <!-- Change published artifact identity. -->
                            <performOverrideIdentity>true</performOverrideIdentity>
                            <overrideArtifactId>${project.artifactId}</overrideArtifactId>

                            <!-- Switch project from pom.xml to pom.xml.flatten. -->
                            <performSwitchPomXml>true</performSwitchPomXml>
                            <packagingSwitchList>
                                <packaging>jar</packaging>
                            </packagingSwitchList>

                        </configuration>
                        <executions>
                            <!-- Activate "flatten:flatten" during "prepare-package" -->
                            <execution>
                                <goals>
                                    <goal>flatten</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

Build yourself

cd /tmp
git clone [email protected]:random-maven/flatten-maven-plugin.git
cd flatten-maven-plugin
./mvnw.sh clean install -B -P skip-test
com.carrotgarden.maven

Versions

Version
1.7.20200503171255
1.6.20190428102750
1.5.20190427220340
1.4.20180402132337
1.3.20180210195103
1.2.20171206225205
1.1.20171204015648
1.0.20171129163300