Skip to content

random-maven/flatten-maven-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 git@github.com:random-maven/flatten-maven-plugin.git
cd flatten-maven-plugin
./mvnw.sh clean install -B -P skip-test