Git Product home page Git Product logo

flatten-maven-plugin's People

Contributors

andpab avatar andye2004 avatar ca-stefan-cordes avatar cboehme avatar cknoblauch avatar cstamas avatar dependabot[bot] avatar famod avatar gdelafosse avatar gnodet avatar hboutemy avatar hgschmie avatar hohwille avatar khmarbaise avatar lafoletc avatar lasselindqvist avatar matteobaccan avatar olamy avatar pzygielo avatar rfscholte avatar robertobatts avatar robertpatrick avatar salehsquared avatar saturnism avatar slachiewicz avatar slawekjaranowski avatar stephaniewang526 avatar sullis avatar suztomo avatar yangnuoyu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flatten-maven-plugin's Issues

pomElements co-filtering

  1. when using flatten with:
<pomElements>
   <build>keep</build>
   <profiles>keep</profiles>
   <pluginManagement>resolve</pluginManagement>
  1. flatten will resolve and keep all inherited from parent(s) plugins,
    regardless of what is actually used by other sections
    such as <build> and <profiles> of the pom

  2. expected behavior is to filter out non-relevant plugins,
    otherwise resulting pom is littered with spurious entries

<repository> from profile activated via .mvn/maven.config not included in flattened POM

As of jenkinsci/workflow-basic-steps-plugin@f9f8b16 if you mvn compile using Maven 3.5.3 you will see a target/copyartifact-1.41-SNAPSHOT.pom which includes

<repositories>
  <repository>
    <id>repo.jenkins-ci.org</id>
    <url>https://repo.jenkins-ci.org/public/</url>
  </repository>
</repositories>

This is missing another repository definition defined in a profile in the parent POM which is activated unconditionally in the child POM based on an entry in .mvn/maven.config. Indeed some of the <dependencies> (in this example workflow-step-api and workflow-api) are found only in that repository.

My intuitive understanding of a flattened POM is that it should include everything another module might need to know in order to consume this artifact; repositories is included because transitive dependencies might be needed. So if a downstream module attempted to depend on this version of workflow-basic-steps, it would by default have dependencies on workflow-step-api and workflow-api, but might not be able to retrieve them unless it itself declared that <repository> (or a ~/.m2/settings.xml did the same).

Cleanup Pom file

Use the versions of plugins etc. from parent instead of overwriting them.

Consider changing default for flattenedPomFilename

Initially the flattened POM was written to target/pom.xml however this was causing bugs because this implicitly changed the ${basedir} causing severe problems.
Therefore we changed this to .flattened.pom in ${basedir} and added the separate clean mojo.
Thanks to @strpbrk we got the solution to the root of the initial problem with #30.
As this is now solved and fixed, we could go back to the original approach to write the flattened pom to the target folder. This would avoid the additional burden to extend the clean lifecycle and would fit more natural into maven conventions.
I do not see big impacts for existing projects using flatten-maven-plugin and everybody could still use the flattenedPomFilename to configure the old behavior. Therefore we would not delete the clean mojo.

dependency calculation inconsistent

In some more complex scenarios with depdencies using depdencyManagement via BOMs (e.g. from spring boot) I discovered that activating flatten-maven-plugin causes wrong version numbers to be calculated. One OSS example is oasp/oasp4j#140 and I found more cases even with the most recent version of flatten-maven-plugin.
I am still trying to build a minimum isolated project reproducing the bug.

Further I assume that we need to revisit createEffectivePom method and see how we need to configure modelBuilder properly or if we need to replace it with a totally different approach.

child pom not installed

both parent and child here refere to projects with packaging=pom

  1. when this plugin is used in parent pom,
    it both produces pom.flat.xml and does install it into the repository

  2. when this plugin is used in a child pom,
    it does produce pom.flat.xml BUT installs the original pom.xml into the repository

Variable substitution during install phase does not consider environment variable

Consider the command: mvn clean flatten:flatten install -Dbuild.version=1.0.0-RELEASE

The parent pom.xml file has a section with dynamic version based on environment variable:

    <version>${build.version}</version>
    <properties>
       <build.version>0.1-SNAPSHOT</build.version>
    </properties>

When running flatten, the ${build.version} is not replaced with the environment variable, but instead replaced with the value of the fallback property <build.version> declared in the parent pom. The versions of the child poms now show <version>0.1-SNAPSHOT</version>

Version configuration is missing

I am using a hack to create some artifacts. Everything is working nice but flatten plugin is evaluating maven.build.timestamp again before fixing version. This is pretty bad because the version inside pom and name of the artifact is not same and this is causing an error on my side. Is there any workaround for this issue?

   <version>${timestamp}</version>

   <properties>  
       <maven.build.timestamp.format>YYMMddHHmmss</maven.build.timestamp.format>
      <timestamp>${maven.build.timestamp}</timestamp>
   </properties>

Edit: I have fiddle with this plugin and noticed that version is missing in FlattenDescriptor.

Project names are added to URL

The flatten plugin attachs the name of child artifacts to all URLs, which are defined in the parent POM. <url>http://www.tinylog.org/</url> in my parent POM becomes <url>http://www.tinylog.org/slf4j-binding/</url> in the flatten POM of my slf4j-binding artifact, for example. I would like to keep URLs exactly as defined in my parent POM.

License header shouldn't be auto added

I'm not sure why in my internal project after flatting Apache license is added, this is confusing because source pom.xml does not contains any license defined.

  <licenses>
    <license>
      <name>Apache License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0</url>
    </license>
  </licenses>

Allow removing elements such as dependencies via pomElement list

I have a situation where I am using the Maven assembly plugin to build a zip installer for my software. At a certain point in my continuous delivery pipeline, I am only promoting the zip installer artifact and its associated POM. All of the artifacts used to construct the zip file are declared as dependencies in the original POM but once the ZIP file is published, it no longer technically depends on these artifacts since it includes them inside the zip file. My downstream jobs are using the maven-dependency-plugin's unpack goal to unzip the zip file for my acceptance tests. Unfortunately, these downstream jobs that are pulling the zip file from the repo are also unnecessarily downloading all of the individual artifacts into the local Maven repo due to the dependencies listed in the zip file's POM.

As such, I would like to be able to do the following and remove the dependencies section altogether:

    <configuration>
      <updatePomFile>true</updatePomFile>
      <pomElements>
        <dependencies>flatten</dependencies>
        <repositories>flatten</repositories>
      </pomElements>
    </configuration>

I tried this and, as I sort of expected, it does not remove the dependencies section from the flattened POM. Would it be possible to add this feature? I understand that this is a somewhat unusual request but it would really help me out.

property not resolved in all POMs

Hello,

I am running the maven flatten plugin on a multi-module project, with the version on each POM set with a property found in the root POM. 310 of the .pom files in my local repository have the right version. 99 POMs still have an unresolved property as their version. The flatten plugin is replacing these POMs, too, just not resolving the variable. Please help point me in the right direction.

Thanks,
Brandt

Composite ${revision} variable in multi-module project fails for dependency

I have attached a simple maven project which illustrates my issue.

I am defining my project version like this: <version>${revision}</version> as suggested here: https://maven.apache.org/maven-ci-friendly.html.

However, my revision property itself is setup like this:

<properties>
    <revision>${build.number}-${branch.name}</revision>
</properties>

and I configure defaults for those two variables (build.number and branch.name) via profiles:

<profiles>
        <profile>
            <id>local</id>
            <activation>
                <property>
                    <name>!build.number</name>
                </property>
            </activation>
            <properties>
                <build.number>1</build.number>
            </properties>
        </profile>

        <profile>
            <id>defaultBranch</id>
            <activation>
                <property>
                    <name>!branch.name</name>
                </property>
            </activation>
            <properties>
                <branch.name>DEFAULT</branch.name>
            </properties>
        </profile>
    </profiles>

I have a parent and two child modules, artifactA and artifactB, where artifactB depends on artifactA. I declare the dependency like this in artifactB/pom.xml:

<dependency>
    <groupId>test</groupId>
    <artifactId>artifactA</artifactId>
    <version>${revision}</version>
</dependency>

When I try mvn clean install on the parent, I run into this error:

[ERROR] Failed to execute goal org.codehaus.mojo:flatten-maven-plugin:1.0.0:flatten (flatten) on project artifactB: 1 problem was encountered while building the effective model for test:artifactB:${build.number}-${branch.name}
[ERROR] [ERROR] 'dependencies.dependency.version' for test:artifactA:jar must be a valid version but is '${build.number}-${branch.name}'. @

It seems like ${revision} is being resolved to ${build.number}-${branch.name}, but those two variables are not being resolved thereafter.

This, however, works:
mvn clean install -Dbuild.number=1 -Dbranch.name=DEFAULTX
Which makes me think that the flatten plugin isn't picking up the variables declared via profiles in the parent POM when resolving dependency versions?

multi_module_dependencies.zip

Pom fails validation in nexus staging repository

Even using <configuration> <flattenMode>minimum</flattenMode> </configuration> it seems that mandatory property is removed.
I have this in the parent project, but doesn't appear on the child project flat pom.
Also, is there any config that just replace the variables ${xxx} instead of doing a lot of changes in the original pom?

handling of <version>${revision}</version>

in the continuous release scenario:

when using <version>${revision}</version> based on ${maven.build.timestamp}

flatten will produce different version from the actual artifact

because flatten model builder will evaluate ${maven.build.timestamp}
again, separately form maven core evaluation

perhaps plugin needs a re-design:

  • use only maven core model
  • then produce reduced model by filtering
  • rather then building separate maven model from scratch

fails in eclipse

https://wiki.eclipse.org/M2E_compatible_maven_plugins

  1. any attempt to enable flatten in eclipse:
<pluginExecution>
	<pluginExecutionFilter>
		<groupId>org.codehaus.mojo</groupId>
        	<artifactId>flatten-maven-plugin</artifactId>
		<versionRange>[0,)</versionRange>
		<goals>
			<goal>flatten</goal>
		</goals>
	</pluginExecutionFilter>
	<action>
		<execute>
			<runOnIncremental>false</runOnIncremental>
                        <runOnConfiguration>true></runOnConfiguration>
		</execute>
	</action>
</pluginExecution>
  1. results in plugin error java.lang.NullPointerException:
Description	Resource	Path	Location	Type
Execution flatten of goal org.codehaus.mojo:flatten-maven-plugin:1.0.1:flatten failed. (org.codehaus.mojo:flatten-maven-plugin:1.0.1:flatten:flatten:package)

org.apache.maven.plugin.PluginExecutionException: Execution flatten of goal org.codehaus.mojo:flatten-maven-plugin:1.0.1:flatten failed.
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
	at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:331)
	at org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1362)
	at org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:177)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112)
	at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1360)
	at org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant.build(MojoExecutionBuildParticipant.java:52)
	at org.eclipse.m2e.core.internal.builder.MavenBuilderImpl.build(MavenBuilderImpl.java:137)
	at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:172)
	at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:1)
	at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1$1.call(MavenBuilder.java:115)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:177)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112)
	at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1.call(MavenBuilder.java:105)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:177)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:99)
	at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.execute(MavenBuilder.java:86)
	at org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:200)
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:735)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:206)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:246)
	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:301)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:304)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:360)
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:383)
	at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:142)
	at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:232)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)
Caused by: java.lang.NullPointerException
	at org.codehaus.mojo.flatten.model.resolution.ReactorModelPool.addProjects(ReactorModelPool.java:46)
	at org.codehaus.mojo.flatten.model.resolution.FlattenModelResolver.<init>(FlattenModelResolver.java:70)
	at org.codehaus.mojo.flatten.FlattenMojo.createModelBuildingRequest(FlattenMojo.java:684)
	at org.codehaus.mojo.flatten.FlattenMojo.createFlattenedPom(FlattenMojo.java:447)
	at org.codehaus.mojo.flatten.FlattenMojo.execute(FlattenMojo.java:313)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	... 31 more

cdata is lost on keep

  1. when using custom flatten:
<pomElements>
            <description>keep</description>
           ....
  1. and pom with CDATA:
<description><![CDATA[ .....
  1. then generated pom does not contain CDATA sections any more:
  • the text is there
  • but brackets <![CDATA[ ... ]]> are missing

"flattened" pom.xml does not work anymore with maven 3.3.9

hello,

I'm using the usefull maven plugin flatten within my pom.xml, which is working fine with maven 3.3.3.

maven 3.3.9 fails to use these pom.xml: it's trying to evaluate (and use) the <version> too early, e.g. before using the flatten plugin (in "Using transporter WagonTransporter").

Anyone has a clue about it ? a workaround ?
I've digged a little, but found nothing about it, neither on the web pages of this plugin.

Here my simple test case and maven debug outputs:

parent pom.xml:

$ cat parent/pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <modelVersion>4.0.0</modelVersion>
  <groupId>zzz</groupId>
  <artifactId>parent</artifactId>
  <version>0.0.2</version>
  <packaging>pom</packaging>

  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>flatten-maven-plugin</artifactId>
        <version>1.0.0</version>
        <configuration></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>
    </plugins>
  </build>
</project>

the child pom.xml:

$ cat child/pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <!-- use version from parent (inherited) -->
  <groupId>zzz</groupId>
  <artifactId>child</artifactId>
  <packaging>pom</packaging>

  <parent>
    <groupId>zzz</groupId>
    <artifactId>parent</artifactId>
    <version>${project.version}</version>
    <relativePath>../parent</relativePath>
  </parent>

  <!-- no configuration/build: inherits from parent -->
</project>

Using maven 3.3.9 on child/pom.xml fails:

Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00)
Maven home: C:\tools\apache-maven-3.3.9
Java version: 1.8.0_74, vendor: Oracle Corporation
Java home: C:\Program Files\java\jdk1.8.0_74\jre
Default locale: fr_FR, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "x86", family: "dos"
[DEBUG] Created new class realm maven.api
[DEBUG] Importing foreign packages into class realm maven.api
[DEBUG]   Imported: javax.enterprise.inject.* < plexus.core
[DEBUG]   Imported: javax.enterprise.util.* < plexus.core
[DEBUG]   Imported: javax.inject.* < plexus.core
[DEBUG]   Imported: org.apache.maven.* < plexus.core
[DEBUG]   Imported: org.apache.maven.artifact < plexus.core
[DEBUG]   Imported: org.apache.maven.classrealm < plexus.core
[DEBUG]   Imported: org.apache.maven.cli < plexus.core
[...]
[DEBUG]   Imported: org.eclipse.aether.version < plexus.core
[DEBUG]   Imported: org.slf4j.* < plexus.core
[DEBUG]   Imported: org.slf4j.helpers.* < plexus.core
[DEBUG]   Imported: org.slf4j.spi.* < plexus.core
[DEBUG] Populating class realm maven.api
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from C:\tools\apache-maven-3.3.9\conf\settings.xml
[DEBUG] Reading user settings from C:\work\...\gs.mirror.basic.settings.xml
[DEBUG] Reading global toolchains from C:\tools\apache-maven-3.3.9\conf\toolchains.xml
[DEBUG] Reading user toolchains from C:\Users\pbourgin\.m2\toolchains.xml
[DEBUG] Using local repository at c:\work\maven-repo
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for c:\work\maven-repo
[INFO] Scanning for projects...
[DEBUG] Using transporter WagonTransporter with priority -1.0 for http://internal-nexus/repository/my-Repo-RELEASES/
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for http://internal-nexus/repository/my-Repo-RELEASES/
[INFO] Downloading: http://internal-nexus/repository/my-Repo-RELEASES//zzz/parent/$%7Bproject.version%7D/parent-$%7Bproject.version%7D.pom
[DEBUG] Writing tracking file c:\work\maven-repo\zzz\parent\${project.version}\parent-${project.version}.pom.lastUpdated
[DEBUG] Using transporter WagonTransporter with priority -1.0 for http://internal-nexus/repository/internal
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for http://internal-nexus/repository/internal
[INFO] Downloading: http://internal-nexus/repository/internal/zzz/parent/$%7Bproject.version%7D/parent-$%7Bproject.version%7D.pom
[DEBUG] Writing tracking file c:\work\maven-repo\zzz\parent\${project.version}\parent-${project.version}.pom.lastUpdated
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for zzz:child:[unknown-version]: Could not transfer artifact zzz:parent:pom:${project.version} from/to central-nexus-proxy (http://internal-nexus/repository/internal): Failed to transfer file: http://internal-nexus/repository/internal/zzz/parent/$%7Bproject.version%7D/parent-$%7Bproject.version%7D.pom. Return code is: 500 , ReasonPhrase:Server Error. and 'parent.relativePath' points at wrong local POM @ line 10, column 11

While maven 3.3.3 is fine with child/pom.xml:

Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T13:57:37+02:00)
Maven home: C:\Squash-TA-Toolbox\1.9.0-RC2\apache-maven-3.3.3
Java version: 1.8.0_74, vendor: Oracle Corporation
Java home: C:\Program Files\java\jdk1.8.0_74\jre
Default locale: fr_FR, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "x86", family: "dos"
[DEBUG] Created new class realm maven.api
[DEBUG] Importing foreign packages into class realm maven.api
[DEBUG]   Imported: javax.enterprise.inject.* < plexus.core
[DEBUG]   Imported: javax.enterprise.util.* < plexus.core
[DEBUG]   Imported: javax.inject.* < plexus.core
[DEBUG]   Imported: org.apache.maven.* < plexus.core
[...]
[DEBUG]   Imported: org.eclipse.aether.version < plexus.core
[DEBUG]   Imported: org.slf4j.* < plexus.core
[DEBUG]   Imported: org.slf4j.spi.* < plexus.core
[DEBUG] Populating class realm maven.api
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from C:\Squash-TA-Toolbox\1.9.0-RC2\apache-maven-3.3.3\conf\settings.xml
[DEBUG] Reading user settings from C:\work\...\gs.mirror.basic.settings.xml
[DEBUG] Reading global toolchains from C:\Squash-TA-Toolbox\1.9.0-RC2\apache-maven-3.3.3\conf\toolchains.xml
[DEBUG] Reading user toolchains from C:\Users\PBourgin\.m2\toolchains.xml
[DEBUG] Using local repository at c:\work\maven-repo
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for c:\work\maven-repo
[INFO] Scanning for projects...
[DEBUG] Using mirror central-nexus-proxy (http://internal-nexus/repository/internal) for central (https://repo.maven.apache.org/maven2).
[DEBUG] Extension realms for project zzz:child:pom:0.0.2: (none)
[DEBUG] Looking up lifecyle mappings for packaging pom from ClassRealm[plexus.core, parent: null]
[DEBUG] Extension realms for project zzz:parent:pom:0.0.2: (none)
[DEBUG] Looking up lifecyle mappings for packaging pom from ClassRealm[plexus.core, parent: null]
[DEBUG] === REACTOR BUILD PLAN ================================================
[DEBUG] Project: zzz:child:pom:0.0.2
[DEBUG] Tasks:   [clean, install]
[DEBUG] Style:   Regular
[DEBUG] =======================================================================
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building child 0.0.2
[INFO] ------------------------------------------------------------------------
[...]
[INFO] Installing C:\work\...\flatten-broken-maven-3.3.9\child\pom.xml to c:\work\maven-repo\zzz\child\0.0.2\child-0.0.2.pom
[DEBUG] Writing tracking file c:\work\maven-repo\zzz\child\0.0.2\_remote.repositories
[DEBUG] Installing zzz:child/maven-metadata.xml to c:\work\maven-repo\zzz\child\maven-metadata-local.xml
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.650 s
[INFO] Finished at: 2017-02-15T12:02:46+01:00
[INFO] Final Memory: 7M/17M
[INFO] ------------------------------------------------------------------------

maven.config, dependencyManagement, and systemPath causes flatten goal to fail

I have relatively complex Maven project where in my acceptance tests, I need to specify a dependency with a scope of system to point to an older version of some software that does not supply a Maven POM. As such, I am using the Maven 3.3 capability to define a .mvn/maven.config file where my team (and my Hudson jobs) specify the path to the software installation in their environment. Unfortunately, the flatten plugin is choking on this with the following error:

[ERROR] Failed to execute goal org.codehaus.mojo:flatten-maven-plugin:1.0.0-beta-5:flatten (flatten) on project apps: 1 problem was encountered while building the effective model for test:apps:1.0
[ERROR] [ERROR] 'dependencyManagement.dependencies.dependency.systemPath' for com.oracle.weblogic:weblogic-jar:jar must specify an absolute path but is ${path-to-wls1036}/server/lib/weblogic.jar @

The variable path-to-wls1036 is defined in the .mvn/maven.config file as follows:

-Dpath-to-wls1036=c:\wls1036\wlserver_10.3

If I comment out the flatten plugin, the build is successful. I have a simple test case that demonstrates the problem. Happy to send it in email since github does not allow me to attach the file to the issue...

Add flattenMode for fatjar

This is feature request, what I need is special mode for fatjar, when all dependencies are already inside the jar and should be removed from flatted pom.xml. This is for example useful for spring boot applications.

flatten-maven-plugin is ignoring explicit set properties

Assume a pom.xml with properties like this:

<properties>
      <build.number>manual</build.number>
      <label>build.${build.number}</label>
</properties>

When calling maven with mvn -Dbuild.number=123, I would expect to get the following properties in the flattened-pom

<properties>
      <build.number>123</build.number>
      <label>build.123</label>
</properties>

But what I get is

<properties>
      <build.number>manual</build.number>
      <label>build.123</label>
</properties>

I did not peek into the code, but probably the properties are retrieved with project.getProperties() only, which do reflect explicit set properties for substitutions only, but not in their own definition. So session.getUserProperties() should be used for overwritten properties.

Allow version ranges in parent

Maven 3.5.0 introduces the ability to use version ranges when inheriting from a parent pom (see MNG-2199). The flatten-maven-plugin fails to flatten poms which use this feature.

Possibility to just flatten CI-friendly properties?

Hi

I just found the flatten plugin while trying to adapt the CI-friendly versioning approach. As the maven project we are building is supposed to be used as a library I will have to flatten the version before installing the pom(s). So i tried to integrate the flatten-plugin and, if I did not miss something, there is no possibility to limit the properties that should be flattened. Is this correct?

From what I was able to understand and achieve I saw that all properties are flattened and several cleanup processes ran. I'm searching for a solution where we can fix the versions of the project for redistribution but keep intact any other dynamic resolutions.

Namely only the revision property:

<version>1.0.0.${revision}</version>

But ignoring other dependency versions like:

<properties><spring-version>4.3.6</spring-version></properties>

I think this makes more sense for the case Continuous Deployment, efficiently replacing the maven-release-plugin.

Is this already possible or is there any plan to bring such a feature?

version properties not resolved in imported boms on mvn goal package

I just run a new build of the oasp/oasp4j just executing the mvn package goal rather than the install goal. This leads to a build error in the beanmapping module as the version for

<dependency>
      <groupId>net.sf.m-m-m</groupId>
      <artifactId>mmm-util-entity</artifactId>
</dependency>

could not be resolved. The version is managed in the oasp4j-bom. It seems that the version property ${mmm.util.version} could not be resolved running mvn package. However, running mvn install everything is working.

Flatten Ranges

Currently this plugin doesn't expand version ranges, it just leaves the range in the flattened pom. Is it possible to flatten ranges as well using this plugin?

Example:

Original pom.xml

...
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>[1.0.0,2.0.0]</version>
        </dependency>
...

Flattened pom.xml

...
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>
...

Support version ranges in DependencyManagement

Maven 3.5.1 will add support for version ranges in DependencyManagment sections (see MNG-4464). I think, this requires an update of the flatten-maven-plugin in order to support BOMs which are specified using a version range.

Changing output directory breaks relative paths in pom file

Hi there,

Just a note on changing the output directory for the generated pom file:

I changed this to the /target directory and then noticed some of my tests were no longer being run. After some digging the reason for this was that when this plugin updates the pom file with the flattened version it uses MavenProject:setFile(File). However the pom File's parent directory can be used for resolving relative paths in other plugins, in my case this was the build-helper-maven-plugin, so any relative paths used in this plugin were now relative to my /target directory not the modules base directory and this caused issues trying to add additional test source directories. What made this trickier to track down was the fact that it only broke relative paths that were used in plugins that ran after the flatten plugin had fired.

So thought I'd just suggest a warning in the documentation and potentially logging a warning from the plugin too when the output directory for the generated pom file is changed from its default location.

Cheers,
Hayden

create release 1.0.1

Create the release 1.0.1:

  • prepare and build the release
  • update maven site
  • perform the vote
  • stage to maven central
  • merge 1.0.x into master

Add feature to rewrite artifactId in flattened pom.

This patch intend to allow user to cross-build one project into multiple maven artifacts, each with a different artifactId.

The requirement to build into multiple artifacts from a single codebase is pervasive, particularly for Scala projects that have to be compiled for different Scala binary versions, e.g. Apache Spark Core 2.2.0 should be built into the following 2 artifacts:

org.apache.spark:spark-core_2.11:jar:2.2.0
org.apache.spark:spark-core_2.10:jar:2.2.0

Comparing to sbt, all existing maven plugins have very limited support for this requirement. (See this post for detail). Most makeshift solutions required modifying codebase, or creating an ill-formed pom file.

With this patch, such cross-building can be achieved with a single configuration option:

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>flatten-maven-plugin</artifactId>
       ....
        <configuration>
          <artifactIdOverride>${project.artifactId}_${scala.binary}</artifactIdOverride>
        </configuration>
      </plugin>

For this project and each of its submodules, the above configuration will generate a flatten-pom.xml with its artifactId rewritten based on provided ${scala.binary} maven property/profile.

As far as I know this is the only method for scala cross-building that doesn't require codebase change or declaring multiple submodules.

Will send a pull request shortly, any advice?

Incompatible API error: java.lang.AbstractMethodError: null

I am trying to use the flatten-maven-plugin to flatten the POM for a test Web application and getting an incompatible API method. The plugin configuration is inherited from the project's main POM and other parts of the project are working just fine so I am a bit perplexed as to why this would happen on this particular submodule.

[INFO] --- flatten-maven-plugin:1.0.0-beta-5:flatten (flatten) @ get-listen-addr
ess-app ---
[DEBUG] Configuring mojo org.codehaus.mojo:flatten-maven-plugin:1.0.0-beta-5:fla
tten from plugin realm ClassRealm[plugin>org.codehaus.mojo:flatten-maven-plugin:
1.0.0-beta-5, parent: sun.misc.Launcher$AppClassLoader@70dea4e]
[DEBUG] Configuring mojo 'org.codehaus.mojo:flatten-maven-plugin:1.0.0-beta-5:fl
atten' with basic configurator -->
DEBUG embedBuildProfileDependencies = false
DEBUG flattenedPomFilename = .flattened-pom.xml
DEBUG localRepository = id: local
url: file:///C:/Users/RPATRICK/.m2/repository/
layout: default
snapshots: [enabled => true, update => always]
releases: [enabled => true, update => always]

DEBUG mojoExecution = org.codehaus.mojo:flatten-maven-plugin:1.0.0-beta-
5:flatten {execution: flatten}
DEBUG outputDirectory = C:\rpatrick\work\projects\jcs-las\system-test\ap
ps\get-listen-address-app
DEBUG repositories = flatten
DEBUG pomElements = org.codehaus.mojo.flatten.FlattenDescriptor@6f6a7463

DEBUG project = MavenProject: oracle.jcs.lifecycle:get-listen-address-ap
p:0.2-SNAPSHOT @ C:\rpatrick\work\projects\jcs-las\system-test\apps\get-listen-a
ddress-app\pom.xml
[DEBUG] -- end configuration --
[INFO] Generating flattened POM of project oracle.jcs.lifecycle:get-listen-addre
ss-app:war:0.2-SNAPSHOT...
[DEBUG] Resolving dependencies of oracle.jcs.lifecycle:get-listen-address-app:wa
r:0.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.601 s
[INFO] Finished at: 2015-11-25T20:49:36-06:00
[INFO] Final Memory: 73M/876M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:flatten-maven-plugin:1.0.0-beta
-5:flatten (flatten) on project get-listen-address-app: Execution flatten of goa
l org.codehaus.mojo:flatten-maven-plugin:1.0.0-beta-5:flatten failed: An API inc
ompatibility was encountered while executing org.codehaus.mojo:flatten-maven-plu
gin:1.0.0-beta-5:flatten: java.lang.AbstractMethodError: null
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.codehaus.mojo:flatten-maven-plugin:1.0.0-beta-5
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Users/RPATRICK/.m2/repository/org/codehaus/mojo/flatt
en-maven-plugin/1.0.0-beta-5/flatten-maven-plugin-1.0.0-beta-5.jar
[ERROR] urls[1] = file:/C:/Users/RPATRICK/.m2/repository/org/codehaus/plexus/ple
xus-interpolation/1.14/plexus-interpolation-1.14.jar
[ERROR] urls[2] = file:/C:/Users/RPATRICK/.m2/repository/org/codehaus/plexus/ple
xus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
[ERROR] urls[3] = file:/C:/Users/RPATRICK/.m2/repository/org/sonatype/aether/aet
her-util/1.7/aether-util-1.7.jar
[ERROR] urls[4] = file:/C:/Users/RPATRICK/.m2/repository/org/sonatype/sisu/sisu-
inject-bean/1.4.2/sisu-inject-bean-1.4.2.jar
[ERROR] urls[5] = file:/C:/Users/RPATRICK/.m2/repository/org/sonatype/sisu/sisu-
guice/2.1.7/sisu-guice-2.1.7-noaop.jar
[ERROR] urls[6] = file:/C:/Users/RPATRICK/.m2/repository/org/sonatype/plexus/ple
xus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
[ERROR] urls[7] = file:/C:/Users/RPATRICK/.m2/repository/org/sonatype/plexus/ple
xus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[8] = file:/C:/Users/RPATRICK/.m2/repository/org/codehaus/plexus/ple
xus-utils/3.0.17/plexus-utils-3.0.17.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o
rg.codehaus.mojo:flatten-maven-plugin:1.0.0-beta-5:flatten (flatten) on project
get-listen-address-app: Execution flatten of goal org.codehaus.mojo:flatten-mave
n-plugin:1.0.0-beta-5:flatten failed: An API incompatibility was encountered whi
le executing org.codehaus.mojo:flatten-maven-plugin:1.0.0-beta-5:flatten: java.l

ang.AbstractMethodError: null

realm = plugin>org.codehaus.mojo:flatten-maven-plugin:1.0.0-beta-5
strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
urls[0] = file:/C:/Users/RPATRICK/.m2/repository/org/codehaus/mojo/flatten-maven
-plugin/1.0.0-beta-5/flatten-maven-plugin-1.0.0-beta-5.jar
urls[1] = file:/C:/Users/RPATRICK/.m2/repository/org/codehaus/plexus/plexus-inte
rpolation/1.14/plexus-interpolation-1.14.jar
urls[2] = file:/C:/Users/RPATRICK/.m2/repository/org/codehaus/plexus/plexus-comp
onent-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
urls[3] = file:/C:/Users/RPATRICK/.m2/repository/org/sonatype/aether/aether-util
/1.7/aether-util-1.7.jar
urls[4] = file:/C:/Users/RPATRICK/.m2/repository/org/sonatype/sisu/sisu-inject-b
ean/1.4.2/sisu-inject-bean-1.4.2.jar
urls[5] = file:/C:/Users/RPATRICK/.m2/repository/org/sonatype/sisu/sisu-guice/2.
1.7/sisu-guice-2.1.7-noaop.jar
urls[6] = file:/C:/Users/RPATRICK/.m2/repository/org/sonatype/plexus/plexus-sec-
dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
urls[7] = file:/C:/Users/RPATRICK/.m2/repository/org/sonatype/plexus/plexus-ciph
er/1.4/plexus-cipher-1.4.jar
urls[8] = file:/C:/Users/RPATRICK/.m2/repository/org/codehaus/plexus/plexus-util
s/3.0.17/plexus-utils-3.0.17.jar
Number of foreign imports: 1
import: Entry[import from realm ClassRealm[maven.api, parent: null]]


    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor

.java:224)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThre
adedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
eStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
cher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
a:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
uncher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution flatten o
f goal org.codehaus.mojo:flatten-maven-plugin:1.0.0-beta-5:flatten failed: An AP
I incompatibility was encountered while executing org.codehaus.mojo:flatten-mave

n-plugin:1.0.0-beta-5:flatten: java.lang.AbstractMethodError: null

realm = plugin>org.codehaus.mojo:flatten-maven-plugin:1.0.0-beta-5
strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
urls[0] = file:/C:/Users/RPATRICK/.m2/repository/org/codehaus/mojo/flatten-maven
-plugin/1.0.0-beta-5/flatten-maven-plugin-1.0.0-beta-5.jar
urls[1] = file:/C:/Users/RPATRICK/.m2/repository/org/codehaus/plexus/plexus-inte
rpolation/1.14/plexus-interpolation-1.14.jar
urls[2] = file:/C:/Users/RPATRICK/.m2/repository/org/codehaus/plexus/plexus-comp
onent-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
urls[3] = file:/C:/Users/RPATRICK/.m2/repository/org/sonatype/aether/aether-util
/1.7/aether-util-1.7.jar
urls[4] = file:/C:/Users/RPATRICK/.m2/repository/org/sonatype/sisu/sisu-inject-b
ean/1.4.2/sisu-inject-bean-1.4.2.jar
urls[5] = file:/C:/Users/RPATRICK/.m2/repository/org/sonatype/sisu/sisu-guice/2.
1.7/sisu-guice-2.1.7-noaop.jar
urls[6] = file:/C:/Users/RPATRICK/.m2/repository/org/sonatype/plexus/plexus-sec-
dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
urls[7] = file:/C:/Users/RPATRICK/.m2/repository/org/sonatype/plexus/plexus-ciph
er/1.4/plexus-cipher-1.4.jar
urls[8] = file:/C:/Users/RPATRICK/.m2/repository/org/codehaus/plexus/plexus-util
s/3.0.17/plexus-utils-3.0.17.jar
Number of foreign imports: 1
import: Entry[import from realm ClassRealm[maven.api, parent: null]]


    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default

BuildPluginManager.java:183)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:208)
... 20 more
Caused by: org.apache.maven.plugin.PluginContainerException: An API incompatibil
ity was encountered while executing org.codehaus.mojo:flatten-maven-plugin:1.0.0

-beta-5:flatten: java.lang.AbstractMethodError: null

realm = plugin>org.codehaus.mojo:flatten-maven-plugin:1.0.0-beta-5
strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
urls[0] = file:/C:/Users/RPATRICK/.m2/repository/org/codehaus/mojo/flatten-maven
-plugin/1.0.0-beta-5/flatten-maven-plugin-1.0.0-beta-5.jar
urls[1] = file:/C:/Users/RPATRICK/.m2/repository/org/codehaus/plexus/plexus-inte
rpolation/1.14/plexus-interpolation-1.14.jar
urls[2] = file:/C:/Users/RPATRICK/.m2/repository/org/codehaus/plexus/plexus-comp
onent-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
urls[3] = file:/C:/Users/RPATRICK/.m2/repository/org/sonatype/aether/aether-util
/1.7/aether-util-1.7.jar
urls[4] = file:/C:/Users/RPATRICK/.m2/repository/org/sonatype/sisu/sisu-inject-b
ean/1.4.2/sisu-inject-bean-1.4.2.jar
urls[5] = file:/C:/Users/RPATRICK/.m2/repository/org/sonatype/sisu/sisu-guice/2.
1.7/sisu-guice-2.1.7-noaop.jar
urls[6] = file:/C:/Users/RPATRICK/.m2/repository/org/sonatype/plexus/plexus-sec-
dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
urls[7] = file:/C:/Users/RPATRICK/.m2/repository/org/sonatype/plexus/plexus-ciph
er/1.4/plexus-cipher-1.4.jar
urls[8] = file:/C:/Users/RPATRICK/.m2/repository/org/codehaus/plexus/plexus-util
s/3.0.17/plexus-utils-3.0.17.jar
Number of foreign imports: 1
import: Entry[import from realm ClassRealm[maven.api, parent: null]]


    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default

BuildPluginManager.java:181)
... 21 more
Caused by: java.lang.AbstractMethodError
at org.apache.maven.model.interpolation.ProblemDetectingValueSource.getV
alue(ProblemDetectingValueSource.java:68)
at org.codehaus.plexus.interpolation.StringSearchInterpolator.interpolat
e(StringSearchInterpolator.java:198)
at org.codehaus.plexus.interpolation.StringSearchInterpolator.interpolat
e(StringSearchInterpolator.java:122)
at org.apache.maven.model.interpolation.AbstractStringBasedModelInterpol
ator.interpolateInternal(AbstractStringBasedModelInterpolator.java:227)
at org.apache.maven.model.interpolation.StringSearchModelInterpolator$In
terpolateObjectAction.interpolate(StringSearchModelInterpolator.java:141)
at org.apache.maven.model.interpolation.StringSearchModelInterpolator$In
terpolateObjectAction.access$300(StringSearchModelInterpolator.java:95)
at org.apache.maven.model.interpolation.StringSearchModelInterpolator$In
terpolateObjectAction$StringField.doInterpolate(StringSearchModelInterpolator.ja
va:349)
at org.apache.maven.model.interpolation.StringSearchModelInterpolator$In
terpolateObjectAction$CacheField.interpolate(StringSearchModelInterpolator.java:
301)
at org.apache.maven.model.interpolation.StringSearchModelInterpolator$In
terpolateObjectAction$CacheItem.interpolate(StringSearchModelInterpolator.java:2
74)
at org.apache.maven.model.interpolation.StringSearchModelInterpolator$In
terpolateObjectAction.traverseObjectWithParents(StringSearchModelInterpolator.ja
va:158)
at org.apache.maven.model.interpolation.StringSearchModelInterpolator$In
terpolateObjectAction.run(StringSearchModelInterpolator.java:132)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.maven.model.interpolation.StringSearchModelInterpolator.in
terpolateObject(StringSearchModelInterpolator.java:78)
at org.apache.maven.model.interpolation.StringSearchModelInterpolator.in
terpolateModel(StringSearchModelInterpolator.java:61)
at org.codehaus.mojo.flatten.FlattenMojo.createResolvedPom(FlattenMojo.j
ava:439)
at org.codehaus.mojo.flatten.FlattenMojo.createFlattenedPom(FlattenMojo.
java:417)
at org.codehaus.mojo.flatten.FlattenMojo.execute(FlattenMojo.java:265)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default
BuildPluginManager.java:134)
... 21 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContaine
rException

In some project, plugin is useless and does not create flatten-pom.xml

In this project:

https://github.com/tribbloid/factorie/tree/scala-2.10

I have declared flatten-maven-plugin exactly as in example:

...
            <configuration>
              <recompileMode>incremental</recompileMode>
              <useZincServer>false</useZincServer>
              <scalaVersion>${scala.majorVersion}${scala.minorVersion}</scalaVersion>
            </configuration>
          </plugin>

          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <!--TODO: USELESS! WTF?-->
            <artifactId>flatten-maven-plugin</artifactId>
            <version>1.0.1</version>
            <executions>
              <!-- enable flattening -->
              <execution>
                <id>flatten</id>
                <phase>process-resources</phase>
                <goals>
                  <goal>flatten</goal>
                </goals>
              </execution>
              <!-- ensure proper cleanup -->
              <execution>
                <id>flatten.clean</id>
                <phase>clean</phase>
                <goals>
                  <goal>clean</goal>
                </goals>
              </execution>
            </executions>

          </plugin>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>2.2.1</version>
...

But after executing mvn install, no flatten-pom.xml was generated. The installed artifact still has numerous unflattened property references.

Please fix it in the next release.

Make flattenMode available from the CLI

As per the title really, please can the flattenMode be made available via the CLI. I want to be able to use this from a generic CI script without having to have the definition in the POM file itself, nor having to create parent POM.

Thanks, Andy.

merge broke working ITs

I just activated travis. As I did not realize it was inactive before, I blindly merged PRs.
I have to analyse and fix this now on the development line...
Next time travis should prevent this (esp. after ITs are all green hopefully soon).

nexus staging plugin ends up in flattened pom.

My flattened pom ends up with the following. Is there a way to avoid this? It's not interesting to the flat consumer

<build>
    <plugins>
      <plugin>
        <groupId>org.sonatype.plugins</groupId>
        <artifactId>nexus-staging-maven-plugin</artifactId>
        <version>1.6.5</version>
        <extensions>true</extensions>
      </plugin>
    </plugins>
  </build>

os-dependent classifiers are flattened

Hi all,

I came to this plugin through https://maven.apache.org/maven-ci-friendly.html as I wanted to simplify our build process.

However, I noticed that some of the properties are not flattened correctly. Namely, dependencies with <classifier> set to ${os.detected.name} are being flattened to values present on the build system, instead of being left as-is. Is there a way to prevent this behaviour?

If I use <flattenMode>minimum</flattenMode> (or bom), then dependency's classifier in the parent pom is left as-is, but not in the children pom, where it is flattened.

Thanks!

Flattening variables defined from external file using properties-maven-plugin

I tried without success to flatten the revision tag using a variable defined into an external file and loaded through the properties-maven-plugin.

Output of message using echo-maven-plugin (com.github.ekryd.echo-maven-plugin) is working as expecting with variable coming form the external file being replaced as expected.

I tested different approach after looking at the source code.
It seems that external properties are available into the resolvedPom (project model).
But to use them we have to define the flatten descriptor to resolve.

So i tried this :

<pomElements>
   <version>resolve</version>
   <properties>resolve</properties>
</pomElements>

However, the flattened pom still use ${revision} and does not replace the value defined into the properties.

On resolve ( or any relevant new keyword) , would it be possible to look at the properties and replace any ${} by its value ?

I tried using java properties ( -D on command line) and replacement if working fine but performed by maven itself and before the start of its lifecycle !!

Please help me in case a workaround is available using Maven 3.5.2 , properties plugin 1.0.0 and flatten 1.0.1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.