Git Product home page Git Product logo

maven-tiles's Introduction

Tiles Maven Plugin - Version 2.40

Overview

The tiles-maven-plugin is a Maven Plugin that tries to bringing the composition that is available to dependencies to the parent structure as well.

How do I make a Maven Tile?

Tiles are plain Maven pom artifacts which contain parts of a Maven POM; every tile can contain

  • build data, for example the license tags that a company wants to report on all their artifacts

  • build aspects, for example the configurations of a plugin, such as Groovy, Java or Clojure.

  • release aspects, for example the distribution management section

  • references to other tiles

This could, for example, allow you to have build aspects consistent across your organization and open sourced, and the distribution of internal vs external artifacts kept in a single tile. In the current single parent hierarchy, this is all duplicated.

Where can’t I use a Maven Tile?

The following are Repaint project definitions:

  • define: reactor build - pom.xml that contains only modules, no plugins, no dependencies, no dependency management, no plugin management. These are used as shortcuts to get your full project installed or tested.

  • define: multi-module build - pom.xml that contains plugins and/or dependencies, dependency management, plugin management

With those defined:

  • You can use a tile in a reactor or multi-module build where the tile is a module and (a) only used in the other modules or (b) used in the parent with the inherits config turned off (so it is not inherited by the children). This is a side effect of how Maven works and we cannot work around it.

  • We do not prioritize issues raised where you are using a multi-module build. These are the anti-thesis of Repaint.IO’s philosophy of composition over inheritance. If you raise the issue and it seems a reasonable use case we will look at it, but please be aware that it is unlikely to be looked at by us without an explicit reproducible test case.

Composing a Maven Tile

A Maven Tile is made up of a pom.xml and a tile.xml. The pom.xml contains the normal release information. When using tiles, this would be the name/groupId/artifactId/version/description/packaging(tile) and generally only a declaration of the Maven Tiles plugin. Only if you are using a tile (and generally you use at least one - the release tile) will you specify a configuration.

pom.xml
<project>
  <groupId>io.repaint.maven</groupId>
  <artifactId>license-tile</artifactId>
  <version>1.1-SNAPSHOT</version>
  <packaging>tile</packaging>
  <description>Contains consistent license information.</description>
  <modelVersion>4.0.0</modelVersion>

  <build>
    <plugins>
      <plugin>
        <groupId>io.repaint.maven</groupId>
        <artifactId>tiles-maven-plugin</artifactId>
        <version>2.40</version>
        <extensions>true</extensions>
        <configuration>
          <filtering>false</filtering>
          <tiles>
            <tile>io.repaint.tiles:github-release-tile:[1.1, 2)</tile>
          </tiles>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

With the packaging tile, the plugin will look for the attached tile.xml, do some basic validation on it and attach it as an artifact.

When the <filtering> configuration item is specified as true - then standard Maven resource filtering for @project.version@ style references is applied to the tile.xml file prior to install/deploy.

tile.xml
<?xml version="1.0" encoding="UTF-8"?>
<project>
  <modelVersion>4.0.0</modelVersion>
  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>
</project>

A tile can define the tiles plugin if it wishes to cascade tile inclusion, or it can use the extended tile.xml syntax:

tile.xml
<?xml version="1.0" encoding="UTF-8"?>
<project>
  <modelVersion>4.0.0</modelVersion>
  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <tiles>
    <tile>io.repaint.tiles:ratpack-tile:[1,2)</tile>
  </tiles>

</project>

Although this will appear to not validate when editing in an IDE, the tile plugin will strip off the tiles section when processing and use it directly.

Execution Ids

Execution ids within tiles are prepended with the gav parameters of the tile that included the execution, for easier debugging / tracing. If this is not desired, adding a configuration attribute tiles-keep-id="true" or entry <tiles-keep-id>true<tiles-keep-id> will keep the original id. If you are using the Kotlin Maven plugin, you will need to use this or it will not work.

tile.xml
<?xml version="1.0" encoding="UTF-8"?>
<project>
  <modelVersion>4.0.0</modelVersion>
  <build>
    <plugins>
      <plugin>
        <groupId>test</groupId>
        <artifactId>test</artifactId>
        <version>1.0</version>
        <executions>
          <execution>
            <id>1</id>
          </execution>
          <execution>
            <id>2</id>
            <configuration tiles-keep-id="true" />
          </execution>
          <execution>
            <id>3</id>
            <configuration>
              <tiles-keep-id>true</tiles-keep-id>
            </configuration>
         </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>test</id>
      <build>
        <plugins>
          <plugin>
            <groupId>test</groupId>
            <artifactId>test</artifactId>
            <version>1.0</version>
            <executions>
              <execution>
                <id>4</id>
              </execution>
              <execution>
                <id>5</id>
                <configuration tiles-keep-id="true" />
              </execution>
              <execution>
                <id>6</id>
                <configuration>
                  <tiles-keep-id>true</tiles-keep-id>
                </configuration>
             </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>

In the above tile, executions with ids 1 and 4 will have their ids changed to io.repaint.tiles:execution-id-replacing-tile:1.1-SNAPSHOT::1 and io.repaint.tiles:execution-id-replacing-tile:1.1-SNAPSHOT::4 respectively, while executions with ids 2, 3, 5 and 6 will retain their original execution id.

Build Smells

When migrating from a parent structure, it is worthwhile to take the opportunity to reduce your build smells. You can do this gradually or in one go, depending on how your builds are done. By default, the plugin will strip all bad smells. The following is an explanation of what is stripped and why those smells are bad. Richard and Mark will be putting together a short book with tutorials for a better approach to building using Maven, but this is the short explanation. Note, these are only cleaned from the tile.xml, not from your pom.xml.

  • dependencymanagement - this was always a poor substitute for composite poms. Composite poms - aka a pom only release artifact that stores all related dependencies together. This allows your project to pull in only those dependencies that it actually requires for release, and allow them to be directly overridden. Dependency management is only for declaring the version of an artifact, and not that it is a dependency - it is better and more composable to declare this specifically in a composite pom instead. Use version ranges so changes flow through.

  • pluginrepositories and repositories - see Repositories in POMs is a bad idea - this has always been a bad idea. Get rid of it as soon as possible.

  • dependencies - putting them in a parent or tile prevents your user from exclusion, again composites are a much, much better idea here. Just don’t use this section anywhere other than your actual artifact or composite poms.

Almost made a build smell: - pluginmanagement - plugin management is used in parents to define all of the necessary options for a plugin but not have that plugin actually run during the release of the parent artifact, and also give the child the option of running it. The reason this is bad is that it is mostly not necessary. You should split your plugins up into tiles so that they be pulled into a build as a standalone set of functionality that will always run and be properly configured. Since they will reside in the tile.xml file, they will not be run when the tile is released. However, some plugins are never run automatically - release and enforcer are two examples. These make sense to stay in pluginManagement.

If you need to use them, add them to your configuration section:

pom.xml
<build>
  <modelVersion>4.0.0</modelVersion>
  <plugins>
    <plugin>
      <groupId>io.repaint.maven</groupId>
      <artifactId>tiles-maven-plugin</artifactId>
      <version>2.15</version>
      <configuration>
        <buildSmells>dependencymanagement, dependencies, repositories, pluginrepositories</buildSmells>
        <tiles>
           <tile>groupid:antrun1-tile:1.1-SNAPSHOT</tile>
           <tile>groupid:antrun2-tile:1.1-SNAPSHOT</tile>
        </tiles>
      </configuration>
    </plugin>
  </plugins>
</build>

Composing Build functionality

As a use case, an example of how it will be used for my projects.

Richard will have:

  • java8-tile - for those projects that are on Java 8

  • java11-tile - for those projects that are on Java LTS (11)

  • groovy-tile - which defines the build structure necessary to build a Groovy project, including GMavenPlus, GroovyDoc and Source plugins

  • java-tile - for Java only projects which include all the Javadoc and Source plugins

  • s3-tile - for our Servlet3 modules, which includes Sass, JSP compilation and Karma plugins and depends on the groovy-tile

  • github-release-tile - for artifacts that release to Github (open source)

  • nexus-release-tile - for artifacts that release to our local Nexus (not open source)

This allows me to open source all my tiles except for the nexus tile, and then decide in the final artifact where I will release it.

Using Snapshots of Tiles

-SNAPSHOT versions of tiles work when installed into your local ~/.m2/repository, however - if you wish to use a published SNAPSHOT - you will need to declare a <repository> in your pom.xml that support SNAPSHOTs. Review the introduction to repositories section on the Apache Maven website.

If you don’t wish to include <repository> definitions in your project source, declaring them in an activated <profile> in your ~/.m2/settings.xml file is a viable alternative.

Note
This introduces an element of inconsistentcy/non-reproducability to your build and should be done with care.

Parent structure

Tiles will always be applied as parents of the project that is built. Any orignal parent of that project will be added as the parent of the last applied tile. So if you apply Tiles T1 and T2 to a project X with a parent P, the resulting hierarchy will be X - T1 - T2 - P. Thus (see section Additional Notes), the definitions in the parent can be overwritten by a tile, but not the other way around.

However, there are situations where you want to define your tiles in a parent, e.g. when you have a lot of artifacts that are built in the same way. In this case you would want a structure like this: X - P - T1 - T2. While you’d maybe expect it to work this way if the tiles are included in P, due to the way Maven works there’s no way to know where a configuration comes from. To still enable this use case you can manually choose a parent where the tiles will be applied (in this case before P) resulting in the desired structure:

pom.xml
<parent>
  <groupId>group</groupId>
  <artifactId>P</artifactId>
  <version>1.0.0</version>
</parent>
<artifactId>X</artifactId>
...
<build>
  <plugins>
    <plugin>
      <groupId>io.repaint.maven</groupId>
      <artifactId>tiles-maven-plugin</artifactId>
      <version>2.37</version>
      <configuration>
        <applyBefore>group:P</applyBefore>
        <tiles>
          <tile>group:T1:1.0.0</tile>
          <tile>group:T2:1.0.0</tile>
        </tiles>
      </configuration>
    </plugin>
  </plugins>
</build>

Tile Ordering

In v2.19 and earlier, all tiles declared inside tiles are loaded after all tiles declared in the project. This meant that all tiles declared inside tiles became ancestors to all tiles declared in the project.

In v2.20+, tile ordering has changed. All tiles are now loaded in order of when they are declared, recursively tracing from tiles declared in a project down to the tiles declared within tiles.

Suppose your project declares tiles T1 and T2 and the T1 tile declares tile T3. Earlier versions will load these in the order T1, T2, and then T3. Using the notation used earlier on this page, this results in the Maven project ancestry of X - T3 - T2 - T1 - P. Later versions will load them in the order T1, T3, and then T2. This results in the Maven project ancestry of X - T2 - T3 - T1 - P.

In some cases, your project and tile hierarchy will include duplicate declaration of one tile. In these cases, the tile is only included once. The latest declaration is used, resulting it showing up in the Maven project ancestry as the one closest to the parent P. This guarantees it will be an ancestor to all tiles that included it.

Mojos

There are two mojos in the plugin, attach-tile and validate. attach-tile is only used by the deploy/install process and attaches the tile.xml. validate is for your use to ensure your tile is valid before releasing it - this ensures it can be read and any errors or warnings about content will appear.

Additional Notes

Some interesting notes:

  • Tiles support version ranges, so use them. [1.1, 2) allows you to update and release new versions of tiles and have them propagate out. Maven 3.2.2 allows this with the version ranges in parents, but it isn’t a good solution because of single inheritance.

  • You can include as many tiles as you like in a pom and tiles can refer to other tiles. The plugin will search through the poms, telling you which ones it is picking up and then load their configurations in reverse order. This means the poms closer to your artifact get their definitions being the most important ones. If you have duplicate plugins, the one closest to your pom wins.

  • String interpolation for properties works. The plugin first walks the tree of tiles collecting all properties, merges them together (closest wins), and then reloads the poms and interpolates them. This means all string replacement in plugins and dependencies works as expected.

  • Plugin execution is merged - if you have the same plugin in two different tiles define two different executions, they will merge.

  • The plugin works fine with alternative packaging. It has been tested with war, grails-plugin and grails-app.

Final Notes

Tiles-Maven works best when you and your team own the tiles. I don’t recommend relying on open source tiles, always create your own versions and always lock down versions of third party tiles, just like you would third party dependencies.

Read More

maven-tiles's People

Contributors

bmlong137 avatar bvella avatar corcorb avatar crenshaw-dev avatar cstamas avatar dependabot[bot] avatar gawen-pjr avatar gitter-badger avatar gnodet avatar hboutemy avatar herbcso avatar karlvr avatar michaellasmanis avatar notiriel avatar rbygrave avatar rikycaldeira avatar rombert avatar rvowles avatar stefan-riesen avatar talios avatar tzrlk 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

maven-tiles's Issues

Feature request: inject ${project.version} into POM if inherited from parent

Hi there,

I have a feature request: if the POM which you add the maven-tiles plugin to inherits its ${project.version} from its parent, copy it to the POM so that its version isn't inherited from the tile POM.

<project>
  <parent>
    <groupId>com.example.com</groupId>
    <artifactId>parent-artifact</artifactId>
    <version>3</version>
  </parent>
  <artifactId>child-artifact</artifactId>
..
</project>

The point is that child-artifact hasn't explicitly set its version, it inherits it from parent-artifact. Now, when mvn runs, maven-tils injects the tile.xml as the new parent and the version in child-artifact now becomes whatever is defined in the tile's POM. I suggest that maven-tiles sets the version in child-artifact to 3 (if it hasn't specified one) after perfoming the parent POM injection.

I believe this would improve maven-tiles' user friendliness.

Cheers,

-Torstein

Example:

Broken under 3.0.x again :(

It would appear we've once again broken under 3.0.x ( 3.0.4 and 3.0.5 tested ):

Exception in thread "main" java.lang.IllegalAccessError: class io.repaint.maven.tiles.ThunkedInheritanceAssembler$FixedInheritanceAssembler cannot access its superclass org.apache.maven.model.inheritance.DefaultInheritanceAssembler$InheritanceModelMerger
  at java.lang.ClassLoader.defineClass1(Native Method)
  at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
  at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
  at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
  at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
  at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
  at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
  at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:386)
  at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
  at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
  at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
  at io.repaint.maven.tiles.TilesMavenLifecycleParticipant.thunkModelBuilder(TilesMavenLifecycleParticipant.groovy:312)
  at io.repaint.maven.tiles.TilesMavenLifecycleParticipant.orchestrateMerge(TilesMavenLifecycleParticipant.groovy:258)
  at io.repaint.maven.tiles.TilesMavenLifecycleParticipant.afterProjectsRead(TilesMavenLifecycleParticipant.groovy:237)
  at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:274)
  at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
  at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
  at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
  at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
  at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
  at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
  at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)

Document oss.sonatype.com usage

If you creating a "release tile" which you wish to use with oss.sonatype.org, you need to get around their strict POM validation rules. One way of doing this is with the flatten-maven-plugin.

We should document this in the README.

Better definition of 'composite pom'

The readme.md talks about composite poms. It would benefit a great deal from an example of this; it is just a pom that declares some dependencies and is used with <type>pom</type> <scope>import</scope>?

I know that an issue is not a great place to have an argument, so please forgive the following.

I have a raft of projects with a lengthy, identical, list of dependencies. If you want to write a pax-exam test, you need all these dependencies. scope=import is only permitted in dependencyManagement. So it doesn't solve the DRY pain of all those dependencies, it just subtracts out the versions. I was hoping that I could make a tile for this job, but your forbid in a tile. So what do you recommend?

Profiles inside tiles always get applied

I was creating a tile earlier containing a profile, for some optional behaviour, and I noticed that the profile contents was being merged directly into the main pom section, and not retaining its profile-like nature.

Possible to reference tile using relative path?

Hi,

I'm currently evaluating tiles for our big restructuring of our maven project, and so far it seems really good! But there is one feature that I haven't seen in the documentation, and wonder if it is possible or not.

Our tiles will all be part of the same project structure, basically with all the tiles in a tiles-subfolder in the directory of the project. And we would prefer if we didn't have to install the tiles before using them. Is this possible? Ie making the tile plugin use the files on disk (ie not a repository, not even the local on one the machine) directly? For example, using something similar to the tag that can be used in the section of a pom. We plan to have all our tiles as snapshots.

So, basically, we want to be able to do this:

  1. Edit the tile.xml in the tile "tile1"
  2. Run "mvn clean install" on another project, that references "tile1"
  3. See results that reflects the changes performed in step 1

Regards
/Jimi

IntelliJ IDEA 15.0.4 mvn install results in missing ModelBuilder2 injection

2.4 through to 2.7 (inclusive) work fine. The only version affected is 2.8.

Mar 17, 2016 1:22:35 PM org.sonatype.guice.bean.reflect.Logs$JULSink warn
WARNING: Error injecting: io.repaint.maven.tiles.TilesMavenLifecycleParticipant
java.lang.NoClassDefFoundError: org/apache/maven/model/building/ModelSource2
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2663)
    at java.lang.Class.getDeclaredConstructors(Class.java:2012)
    at com.google.inject.spi.InjectionPoint.forConstructorOf(InjectionPoint.java:245)
    at com.google.inject.internal.ConstructorBindingImpl.create(ConstructorBindingImpl.java:98)
    at com.google.inject.internal.InjectorImpl.createUninitializedBinding(InjectorImpl.java:629)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:831)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:758)
    at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:255)
    at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:204)
    at com.google.inject.internal.InjectorImpl.getProviderOrThrow(InjectorImpl.java:954)
    at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:987)
    at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:950)
    at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1000)
    at org.sonatype.guice.bean.reflect.AbstractDeferredClass.get(AbstractDeferredClass.java:45)
    at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:84)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:52)
    at com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInternalFactory.java:70)
    at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:100)
    at org.sonatype.guice.plexus.lifecycles.PlexusLifecycleManager.onProvision(PlexusLifecycleManager.java:138)
    at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:108)
    at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:55)
    at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:68)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:45)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1018)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.Scopes$1$1.get(Scopes.java:59)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
    at com.google.inject.internal.InjectorImpl$3$1.call(InjectorImpl.java:965)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1011)
    at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:961)
    at org.sonatype.guice.bean.locators.LazyBeanEntry.getValue(LazyBeanEntry.java:83)
    at org.sonatype.guice.plexus.locators.LazyPlexusBean.getValue(LazyPlexusBean.java:49)
    at org.sonatype.guice.bean.locators.EntryListAdapter$ValueIterator.next(EntryListAdapter.java:112)
    at java.util.AbstractCollection.addAll(AbstractCollection.java:343)
    at org.apache.maven.DefaultMaven.getLifecycleParticipants(DefaultMaven.java:538)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:270)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Caused by: java.lang.ClassNotFoundException: org.apache.maven.model.building.ModelSource2
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
    ... 56 more

---------------------------------------------------
constituent[0]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2015.0.3/plugins/maven/lib/maven3/lib/aether-api-1.13.1.jar
constituent[1]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2015.0.3/plugins/maven/lib/maven3/lib/aether-connector-wagon-1.13.1.jar
constituent[2]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2015.0.3/plugins/maven/lib/maven3/lib/aether-impl-1.13.1.jar
constituent[3]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2015.0.3/plugins/maven/lib/maven3/lib/aether-spi-1.13.1.jar
constituent[4]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2015.0.3/plugins/maven/lib/maven3/lib/aether-util-1.13.1.jar
constituent[5]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2015.0.3/plugins/maven/lib/maven3/lib/commons-cli-1.2.jar
constituent[6]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2015.0.3/plugins/maven/lib/maven3/lib/commons-io-2.2.jar
constituent[7]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2015.0.3/plugins/maven/lib/maven3/lib/commons-lang-2.6.jar
constituent[8]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2015.0.3/plugins/maven/lib/maven3/lib/maven-aether-provider-3.0.5.jar
constituent[9]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2015.0.3/plugins/maven/lib/maven3/lib/maven-artifact-3.0.5.jar
constituent[10]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2015.0.3/plugins/maven/lib/maven3/lib/maven-compat-3.0.5.jar
constituent[11]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2015.0.3/plugins/maven/lib/maven3/lib/maven-core-3.0.5.jar
constituent[12]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2015.0.3/plugins/maven/lib/maven3/lib/maven-embedder-3.0.5.jar
constituent[13]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2015.0.3/plugins/maven/lib/maven3/lib/maven-model-3.0.5.jar
constituent[14]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2015.0.3/plugins/maven/lib/maven3/lib/maven-model-builder-3.0.5.jar
constituent[15]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2015.0.3/plugins/maven/lib/maven3/lib/maven-plugin-api-3.0.5.jar
constituent[16]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2015.0.3/plugins/maven/lib/maven3/lib/maven-repository-metadata-3.0.5.jar
constituent[17]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2015.0.3/plugins/maven/lib/maven3/lib/maven-settings-3.0.5.jar
constituent[18]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2015.0.3/plugins/maven/lib/maven3/lib/maven-settings-builder-3.0.5.jar
constituent[19]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2015.0.3/plugins/maven/lib/maven3/lib/plexus-cipher-1.7.jar
constituent[20]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2015.0.3/plugins/maven/lib/maven3/lib/plexus-component-annotations-1.5.5.jar
constituent[21]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2015.0.3/plugins/maven/lib/maven3/lib/plexus-interpolation-1.14.jar
constituent[22]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2015.0.3/plugins/maven/lib/maven3/lib/plexus-sec-dispatcher-1.3.jar
constituent[23]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2015.0.3/plugins/maven/lib/maven3/lib/plexus-utils-2.0.6.jar
constituent[24]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2015.0.3/plugins/maven/lib/maven3/lib/sisu-guava-0.9.9.jar
constituent[25]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2015.0.3/plugins/maven/lib/maven3/lib/sisu-guice-3.1.0-no_aop.jar
constituent[26]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2015.0.3/plugins/maven/lib/maven3/lib/sisu-inject-bean-2.3.0.jar
constituent[27]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2015.0.3/plugins/maven/lib/maven3/lib/sisu-inject-plexus-2.3.0.jar
constituent[28]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2015.0.3/plugins/maven/lib/maven3/lib/wagon-file-2.8.jar
constituent[29]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2015.0.3/plugins/maven/lib/maven3/lib/wagon-http-2.8-shaded.jar
constituent[30]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2015.0.3/plugins/maven/lib/maven3/lib/wagon-http-shared-2.8.jar
constituent[31]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2015.0.3/plugins/maven/lib/maven3/lib/wagon-provider-api-2.8.jar
---------------------------------------------------
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/maven/model/building/ModelSource2
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2663)
    at java.lang.Class.getDeclaredConstructors(Class.java:2012)
    at com.google.inject.spi.InjectionPoint.forConstructorOf(InjectionPoint.java:245)
    at com.google.inject.internal.ConstructorBindingImpl.create(ConstructorBindingImpl.java:98)
    at com.google.inject.internal.InjectorImpl.createUninitializedBinding(InjectorImpl.java:629)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:831)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:758)
    at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:255)
    at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:204)
    at com.google.inject.internal.InjectorImpl.getProviderOrThrow(InjectorImpl.java:954)
    at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:987)
    at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:950)
    at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1000)
    at org.sonatype.guice.bean.reflect.AbstractDeferredClass.get(AbstractDeferredClass.java:45)
    at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:84)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:52)
    at com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInternalFactory.java:70)
    at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:100)
    at org.sonatype.guice.plexus.lifecycles.PlexusLifecycleManager.onProvision(PlexusLifecycleManager.java:138)
    at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:108)
    at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:55)
    at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:68)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:45)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1018)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.Scopes$1$1.get(Scopes.java:59)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
    at com.google.inject.internal.InjectorImpl$3$1.call(InjectorImpl.java:965)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1011)
    at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:961)
    at org.sonatype.guice.bean.locators.LazyBeanEntry.getValue(LazyBeanEntry.java:83)
    at org.sonatype.guice.plexus.locators.LazyPlexusBean.getValue(LazyPlexusBean.java:49)
    at org.sonatype.guice.bean.locators.EntryListAdapter$ValueIterator.next(EntryListAdapter.java:112)
    at java.util.AbstractCollection.addAll(AbstractCollection.java:343)
    at org.apache.maven.DefaultMaven.getLifecycleParticipants(DefaultMaven.java:538)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:270)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Caused by: java.lang.ClassNotFoundException: org.apache.maven.model.building.ModelSource2
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
    ... 56 more

Document plugin execution id rewriting

Update the README.adoc file with information on the fact that tiles rewrites plugin execution ids to give identification of the tile it was defined in, also add documentation for how disable the behaviour once #12 has been applied.

Could not find tiles when using snapshot from a repository manager

With snapshot version of a tile, it works fine locally when using maven install command.
But, when deployed to a repository manager (ie Artifactory), Maven never find the tile and seems to not look into the specified snapshot repository. Only the release repository is used instead.
Fyi, It works fine with not snapshot version locally and remotely.

Upgraded from 1.5 to 2.7, my tiles cannot be resolved.

This is my configuration:

  <build>
    <plugins>
      <plugin>
        <groupId>io.repaint.maven</groupId>
        <artifactId>tiles-maven-plugin</artifactId>
        <version>2.7</version>
        <extensions>true</extensions>
        <configuration>
          <tiles>
            <tile>com.jeppesen.jcms:aggregate-tile:tile::[1.0.3, 2.0.0)</tile>
          </tiles>
        </configuration>
      </plugin>
    </plugins>
  </build>

After upgrading from 1.5 to 2.7 I get the following error message:

Failure to find group:artifact:xml:1.2.3 in http://nexusserver/nexus/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of central-mirror has elapsed or updates are forced

This is indeed correct, because my tiles are not of packaging type "xml" but packaging type "tile".
From what I can see on the front page, the packaging for tiles should still be "tile", so what is happening here?

Looking at other versions this seems to be moving around a bit. The last version I get to resolve correctly is 1.8.

In 2.1 it looks like this:

groupid:artifactid:tile:tile-pom:1.2.3

That fails, because the version is not "tile" and the packaging is not "tile-pom"

2.2 and upwards has the same behavior as 2.7.

Cannot deploy tile with composed distributionManagement

When following the README guide for defining a tile using itself a nexus-release-tile, I get an error when trying to deploy the project.

pom.xml :

<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example.maven.tiles</groupId>
  <artifactId>test-tile</artifactId>
  <packaging>tile</packaging>
  <version>1.0-SNAPSHOT</version>

  <build>
    <plugins>
      <plugin>
        <groupId>io.repaint.maven</groupId>
        <artifactId>tiles-maven-plugin</artifactId>
        <version>2.2</version>
        <extensions>true</extensions>
        <configuration>
          <filtering>false</filtering>
          <tiles>
            <tile>com.example.maven.tiles:nexus-release-tile:[1.0, 2)</tile>
          </tiles>
        </configuration>
      </plugin>
    </plugins>
  </build>

</project>

on mvn deploy, I get the following error :

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project test-tile: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1]

But with mvn help:effective-pom, I effectively see the distributionManagement section.

PS : on mvn deploy, the log clearly says that the nexus-release-tile is mixed in the pom.

Tiles should allow plugin in parent/reactive when not inherited

Currently we now prevent you including the tiles plugin your parent pom full stop, but I just hit a scenario (using a release tile) where I wanted the tile there, specifically for the parent/reactor artefact so flagged it as non-inherited.

This still breaks the build tho.

Exception running tiles plugin v2.2

[INFO] Scanning for projects...
---------------------------------------------------
constituent[0]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2014.1.4/plugins/maven/lib/maven3/lib/aether-api-1.13.1.jar
constituent[1]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2014.1.4/plugins/maven/lib/maven3/lib/aether-connector-wagon-1.13.1.jar
constituent[2]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2014.1.4/plugins/maven/lib/maven3/lib/aether-impl-1.13.1.jar
constituent[3]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2014.1.4/plugins/maven/lib/maven3/lib/aether-spi-1.13.1.jar
constituent[4]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2014.1.4/plugins/maven/lib/maven3/lib/aether-util-1.13.1.jar
constituent[5]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2014.1.4/plugins/maven/lib/maven3/lib/commons-cli-1.2.jar
constituent[6]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2014.1.4/plugins/maven/lib/maven3/lib/commons-io-2.2.jar
constituent[7]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2014.1.4/plugins/maven/lib/maven3/lib/commons-lang-2.6.jar
constituent[8]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2014.1.4/plugins/maven/lib/maven3/lib/maven-aether-provider-3.0.5.jar
constituent[9]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2014.1.4/plugins/maven/lib/maven3/lib/maven-artifact-3.0.5.jar
constituent[10]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2014.1.4/plugins/maven/lib/maven3/lib/maven-compat-3.0.5.jar
constituent[11]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2014.1.4/plugins/maven/lib/maven3/lib/maven-core-3.0.5.jar
constituent[12]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2014.1.4/plugins/maven/lib/maven3/lib/maven-embedder-3.0.5.jar
constituent[13]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2014.1.4/plugins/maven/lib/maven3/lib/maven-model-3.0.5.jar
constituent[14]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2014.1.4/plugins/maven/lib/maven3/lib/maven-model-builder-3.0.5.jar
constituent[15]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2014.1.4/plugins/maven/lib/maven3/lib/maven-plugin-api-3.0.5.jar
constituent[16]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2014.1.4/plugins/maven/lib/maven3/lib/maven-repository-metadata-3.0.5.jar
constituent[17]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2014.1.4/plugins/maven/lib/maven3/lib/maven-settings-3.0.5.jar
constituent[18]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2014.1.4/plugins/maven/lib/maven3/lib/maven-settings-builder-3.0.5.jar
constituent[19]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2014.1.4/plugins/maven/lib/maven3/lib/plexus-cipher-1.7.jar
constituent[20]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2014.1.4/plugins/maven/lib/maven3/lib/plexus-component-annotations-1.5.5.jar
constituent[21]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2014.1.4/plugins/maven/lib/maven3/lib/plexus-interpolation-1.14.jar
constituent[22]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2014.1.4/plugins/maven/lib/maven3/lib/plexus-sec-dispatcher-1.3.jar
constituent[23]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2014.1.4/plugins/maven/lib/maven3/lib/plexus-utils-2.0.6.jar
constituent[24]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2014.1.4/plugins/maven/lib/maven3/lib/sisu-guava-0.9.9.jar
constituent[25]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2014.1.4/plugins/maven/lib/maven3/lib/sisu-guice-3.1.0-no_aop.jar
constituent[26]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2014.1.4/plugins/maven/lib/maven3/lib/sisu-inject-bean-2.3.0.jar
constituent[27]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2014.1.4/plugins/maven/lib/maven3/lib/sisu-inject-plexus-2.3.0.jar
constituent[28]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2014.1.4/plugins/maven/lib/maven3/lib/wagon-file-2.8.jar
constituent[29]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2014.1.4/plugins/maven/lib/maven3/lib/wagon-http-2.8-shaded.jar
constituent[30]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2014.1.4/plugins/maven/lib/maven3/lib/wagon-http-shared-2.8.jar
constituent[31]: file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2014.1.4/plugins/maven/lib/maven3/lib/wagon-provider-api-2.8.jar
---------------------------------------------------
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.maven.execution.MavenSession.getAllProjects()Ljava/util/List;
    at io.repaint.maven.tiles.TilesMavenLifecycleParticipant.afterProjectsRead(TilesMavenLifecycleParticipant.groovy:223)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:274)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)

java.lang.IllegalAccessError: org/apache/maven/project/DefaultModelBuildingListener

IntelliJ 15 seems to trigger with this error occasionally on one of our projects when configured to use the upcoming Maven 3.3.8 release, tho I've seen it on a few earlier releases.

Even tho IntelliJ is configured to use the external Maven release, the stacktrace points to using the internal Maven30Server still...

2015-11-09 10:51:09,594 [ 138592]   INFO -      #org.jetbrains.idea.maven - org/apache/maven/project/DefaultModelBuildingListener 
java.lang.IllegalAccessError: org/apache/maven/project/DefaultModelBuildingListener
  at io.repaint.maven.tiles.TilesMavenLifecycleParticipant.thunkModelBuilder(TilesMavenLifecycleParticipant.groovy:287)
  at io.repaint.maven.tiles.TilesMavenLifecycleParticipant.orchestrateMerge(TilesMavenLifecycleParticipant.groovy:268)
  at io.repaint.maven.tiles.TilesMavenLifecycleParticipant.afterProjectsRead(TilesMavenLifecycleParticipant.groovy:245)
  at org.jetbrains.idea.maven.server.Maven30ServerEmbedderImpl.loadExtensions(Maven30ServerEmbedderImpl.java:737)
  at org.jetbrains.idea.maven.server.Maven30ServerEmbedderImpl.access$300(Maven30ServerEmbedderImpl.java:104)
  at org.jetbrains.idea.maven.server.Maven30ServerEmbedderImpl$2.run(Maven30ServerEmbedderImpl.java:621)
  at org.jetbrains.idea.maven.server.Maven30ServerEmbedderImpl.executeWithMavenSession(Maven30ServerEmbedderImpl.java:568)
  at org.jetbrains.idea.maven.server.Maven30ServerEmbedderImpl.doResolveProject(Maven30ServerEmbedderImpl.java:586)
  at org.jetbrains.idea.maven.server.Maven30ServerEmbedderImpl.resolveProject(Maven30ServerEmbedderImpl.java:532)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:323)
  at sun.rmi.transport.Transport$1.run(Transport.java:200)
  at sun.rmi.transport.Transport$1.run(Transport.java:197)
  at java.security.AccessController.doPrivileged(Native Method)
  at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
  at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
  at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
  at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
  at java.security.AccessController.doPrivileged(Native Method)
  at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  at java.lang.Thread.run(Thread.java:745)
2015-11-09 10:51:09,625 [ 138623]   INFO -      #org.jetbrains.idea.maven - [WARNING] tiles-maven-plugin in project smx3:smx3.templates:14.1.121-SNAPSHOT requested for same tile dependency com.smxemail.tiles:com.smxemail.tiles.release:[2.0.0,3.0.0) 

Using tiles in a multi-module project issues warnings over duplicate tile usage

Under tiles-maven-plugin 2.2 using a multi-module project, maven reports a warning for duplicate tiles.

[WARNING] tiles-maven-plugin in project smx3:smx3.agreement:14.1.74-SNAPSHOT requested for same tile dependency com.smxemail.tiles:com.smxemail.tiles.enforcements:[1.0.0,2.0.0)
[WARNING] tiles-maven-plugin in project smx3:smx3.agreement:14.1.74-SNAPSHOT requested for same tile dependency com.smxemail.tiles:com.smxemail.tiles.osgiservices:[1.0.0,2.0.0)

The builds all seem to build fine however...

Does not work with dependency:go-offline

The tiles plugin does not seem to resolve version ranges correctly when used together with the go-offline goal for the dependency plugin.

I created a pom like this:

<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>myCompany</groupId>
  <artifactId>myArtifact</artifactId>
  <version>1.0.0-SNAPSHOT</version>
  <packaging>pom</packaging>

  <build>
    <plugins>
      <plugin>
        <groupId>io.repaint.maven</groupId>
        <artifactId>tiles-maven-plugin</artifactId>
        <version>1.8</version>
        <extensions>true</extensions>
      </plugin>
    </plugins>
  </build>
</project>

Then I ran
mvn dependency:go-offline

[INFO] Plugin Resolved: tiles-maven-plugin-1.8.jar Downloading: http://my-server/nexus/content/groups/public/org/apache/maven/shared/maven-filtering/%5B1.3,1.3%5D/maven-filtering-%5B1.3,1.3%5D.jar [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 8.241 s [INFO] Finished at: 2015-10-21T19:57:26+02:00 [INFO] Final Memory: 22M/699M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:resolve-plugins (resolve-plugins) on project myArtifact: Nested: Could not find artifact org.apache.maven.shared:maven-filtering:jar:[1.3,1.3] in central-mirror (http://my-server/nexus/content/groups/public)

Add support for filtered tiles

It would be good to (optionally) support filter of the tile.xml file, so that properties of the Maven Project can be embedded in the deployed tile - such as @project.version@.

This will be especially handy when using the attach-tile goal along side an existing maven plugin project, where the tile wants to refer to the plugin version being released.

Unable to publish to oss.sonatype.org under 2.8

It seems some change between 2.7 and 2.8 has broken the usage of the flatten-maven-plugin when publishing to oss.sonatype.org:

Invalid POM: /com/theoryinpractise/halbuilder-styleguide-tile/1.0.4/halbuilder-styleguide-tile-1.0.4.pom: License information missing, SCM URL missing, Developer information missing

Tiles not imported when groupId or version is not defined

When using a parent, groupId and version can be missing in a child module if this module has the same parent pom value for this attributes.
But when using tiles plugin, this feature doesn't work because of this code (src/main/groovy/io/repaint/maven/tiles/TilesMavenLifecycleParticipant.groovy @ line 296) :

                if (model.artifactId == project.artifactId && model.groupId == project.groupId
                        && model.version == project.version && model.packaging == project.packaging) {
                    injectTilesIntoParentStructure(tiles, model, request)
                }

The workaround is obviously to redefine groupId and version in the child module but this isn't documented (or i missed it?) and no log are emitted making very difficult to kown why tile doesn't work.

Need to be able to tag tiles to not cascade

When using a release tile, particularly, you generally don't want that tile to cascade as then folds itself into the entire build system. You could use a Central release tile but wish to use that tile in a local build which requires a different release mechanism.

....

should be supported. "cascade" should only be used when parsing an imported tile.

NetBeans frets and isn't quite there

NetBeans recognizes there is a custom build component and frets, but as long as dependencies are not in your tiles, it just doesn't discover the plugins and present them to you. It does build with tiles fine, so development is not affected.

Not getting any traction at all

So, I created a tile. tile.xml:

<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
    <properties>
        <bt-rli-je-version>7.12.100</bt-rli-je-version>
        <bt-rbl-je-version>7.12.100</bt-rbl-je-version>
        <bt-rex-je-version>7.11.1.102</bt-rex-je-version>
        <bt-res-version>0.9.2.100</bt-res-version>
        <bt-tcat-version>0.2.2</bt-tcat-version>
        <bt-tcat-model-version>0.2.0</bt-tcat-model-version>
    </properties>
</project>

I've installed this artifact.

In the top pom of a multi-module project, I have:

<build>
 <plugins>
            <plugin>
                <groupId>io.repaint.maven</groupId>
                <artifactId>tiles-maven-plugin</artifactId>
                <version>1.8</version>
                <extensions>true</extensions>
                <configuration>
                    <tiles>
                        <tile>com.basistech.tiles:platform-versions-tile:0.0.1-SNAPSHOT</tile>
                    </tiles>
                </configuration>
            </plugin>
</plugins>
...
</build>

The properties in the tile.xml are not seen by Maven when I try to use them with Maven 3.0.4. I assume that I'm missing something trivial here, but, what? mvn -X is not showing any signs of life. I am trying to use these properties as dependency versions.

I note that the examples I can find are all using older versions than 1.8 of the plugin; is there an example out there today I can clone and play with?

Tiles need to be injected somehow per-artifact

One issue I've been hitting lately, and usually only affects the command line usage, but has recently started rearing its head in IntelliJ again is that the fact we're injecting and mutating the parents of tiles in a global namespace manner.

For single module projects this works fine, but the moment you use a reactor, or have multiple POMs configured in a single IntelliJ project the problem of circularly parents arrises.

tiles

This can be mitigated by always keeping your tiles ALWAYS in the same order, but this also only works if only always have the same tiles as well, the moment you omit one you risk changing the ordering.

This is primarily only a problem in IntelliJ ( unless your doing a reactor/multi-module build ) it only affects code completion/resolution ( but that in turn can prevent one from running tests or debugging as IntelliJ can no longer compile code ).

Interpolate tile GAV with tile plugin executions

If order to make understanding projects that use tiles a little easier, interpolate the tile's GAV into the execution ID of any tile plugin/execution.

I.e.

[INFO] --- maven-enforcer-plugin:1.3.1:enforce (com.smxemail.tiles:com.smxemail.tiles.enforcements:1.0.2::enforce-versions) @ smx3.agreement ---

dependency:tree and dependency:list show no deps for projects using tiles

Using the dependency:tree and dependency:list plugins/goals show no dependencies for projects using tiles:

git:develop·@smx3.rest> mvn dependency:tree                                                                                                                          amrk@Marks-MacBook-Pro
[INFO] Scanning for projects...
[INFO] model: 'smx3:smx3.rest:2.0.1-SNAPSHOT' has tile 'com.smxemail.tiles:com.smxemail.tiles.enforcements:1.0.1-SNAPSHOT' as new parent.
model: 'com.smxemail.tiles:com.smxemail.tiles.enforcements:1.0.1-SNAPSHOT' has tile 'com.smxemail.tiles:com.smxemail.tiles.osgiapi:1.0.5' as new parent.
model: 'com.smxemail.tiles:com.smxemail.tiles.osgiapi:1.0.5' has tile 'com.smxemail.tiles:com.smxemail.tiles.karaffeature:1.0.1' as new parent.
model: 'com.smxemail.tiles:com.smxemail.tiles.karaffeature:1.0.1' has original pom 'com.smxemail:com.smxemail.parent:2.1.7' as new parent.
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building smx3.rest 2.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.9:tree (default-cli) @ smx3.rest ---
[INFO] smx3:smx3.rest:jar:2.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.059 s
[INFO] Finished at: 2014-09-29T10:38:57+13:00
[INFO] Final Memory: 20M/310M
[INFO] ------------------------------------------------------------------------

Version 1.3 of plugin returns dependency list/tree as expected. So it looks like it may be related to our parent rewriting in 1.4.

Publishing tiles broken in 2.1

With the change to use the tile artifact type in 2.1, it appears we (I) was premature in actually releasing it. Since ones tile project is of the packaging tile, and we only attach artifacts ( rather than set a primary artifact) the maven-install-plugin calls "install project" on the attached artifact, which in turn forces it to deploy as a .pom file - which then can't be downloaded unless :pom: explicitly specified.

We should actually set the the projects primary artifact, rather than just attach an additional file.

Collateral effects for site:stage

In a multimodule Maven project the site is generated fine (mvn site) but when we run the site:stage goal the modules are created under the tile.artifactId/module.artifactId.
The versions 1.7, 1.8 and 1.9-SNAPSHOT are affected.

Supposse the following multimodule Maven project:

myproject
|- pom.xml
|- module1
|  |- pom.xml
|- module2
|  |- pom.xml

And suppose myproject/pom.xml is configured as:

<plugin>
    <groupId>io.repaint.maven</groupId>
    <artifactId>tiles-maven-plugin</artifactId>
    <extensions>true</extensions>
    <configuration>
        <tiles>
            <tile>mytile.group:my-aggregated-tile:1.0.0-SNAPSHOT</tile>
        </tiles>
    </configuration>
</plugin>

And the tile is:

<reporting>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <reportSets>
                <reportSet>
                    <id>non-aggregate</id>
                    <reports>
                        <report>javadoc</report>
                        <report>test-javadoc</report>
                    </reports>
                </reportSet>
                <reportSet>
                    <id>aggregate</id>
                    <reports>
                        <report>aggregate</report>
                    </reports>
                </reportSet>
            </reportSets>
        </plugin>
    </plugins>
</reporting>

The expected staged site is as follows:

myproject
|- target
|  |- staging
|  |  |- index.html
|  |  |- module1
|  |  |  |- index.html
|  |  |- module2
|  |  |  |- index.html

But we get:

myproject
|- target
|  |- staging
|  |  |- index.html
|  |  |- my-aggregated-tile
|  |  |  |- module1
|  |  |  |  |- index.html
|  |  |  |- module2
|  |  |  |  |- index.html

maven-tiles does nothing in large project

I've been trying to get maven-tiles working across several projects. In a project with no parent and no modules it works very nicely. But applying the same plugin config to either the parent or a child of a multi-module component maven-tiles does not have any effect (nor does it print its reassuring 'tiles-maven-plugin: Injecting 3 tiles as intermediary parent artifact's...').

I took from #22 that something should work. Even if I have to copy the maven-tiles plugin config into each sub-module we'd still get heaps out of this plugin.

I've tried with maven-tiles 1.8 on maven 3.0.5, and 3.3.3.

            <plugin>
                <extensions>true</extensions>
                <groupId>io.repaint.maven</groupId>
                <artifactId>tiles-maven-plugin</artifactId>
                <version>1.8</version>
                <inherited>true</inherited>
                <configuration>
                    <tiles>
                        <tile>nz.co.eroad:checkstyle-level2-tile:1.0.0</tile>
                    </tiles>
                </configuration>
            </plugin>

distributionManagement is not copied with tiles

When extracting a release tile containing scm and distributionManagement sections, I discovered the current tiles-maven-plugin does not merge across the distributionManagement section into the final pom.

Tile execution id rewritting should be disableable

In one variant of our tiles we define a execution solely for the purposes of disabling the current behavior. However - now that the maven-tiles-plugin prepends the tile GAV to the execution id, this no longer over-writes the default execution.

So we need a way to disable that, on a case-by-case basis - as part of the tile definition.

mixin fails on spring boot projects

I'm attempting to use this plugin on a spring boot project and I'm getting this exception when it runs:

org.apache.maven.InternalErrorException: Internal error: java.lang.IllegalArgumentException: no model resolver provided, cannot resolve parent POM org.springframework.data.build:spring-data-build:1.5.2.RELEASE for POM org.springframework.data:spring-data-releasetrain:Evans-SR2

A similar issue seems to have been ran into by another plugin doing some different maven hackery:

https://jira.codehaus.org/browse/MOJO-2032

Some comments on that issue seem to indicate the issue is related to the scope=import dependencies in the dependencyManagement section of spring-boot-dependencies.

NPE thrown by IntelliJ when the session returns null project

java.lang.NullPointerException
        at org.jetbrains.idea.maven.model.MavenProjectProblem.hashCode(MavenProjectProblem.java:92)
        at java.util.HashMap.hash(HashMap.java:338)
        at java.util.HashMap.put(HashMap.java:611)
        at java.util.HashSet.add(HashSet.java:219)
        at org.jetbrains.idea.maven.server.Maven32ServerEmbedderImpl.validate(Maven32ServerEmbedderImpl.java:935)
        at org.jetbrains.idea.maven.server.Maven32ServerEmbedderImpl.createExecutionResult(Maven32ServerEmbedderImpl.java:862)
        at org.jetbrains.idea.maven.server.Maven32ServerEmbedderImpl.resolveProject(Maven32ServerEmbedderImpl.java:549)
        at sun.reflect.GeneratedMethodAccessor74.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

Unable to attach-tile to an existing project

I had thought we had the ability to attach a tile to an existing project, but it seems that io.repaint.maven.tiles.AttachTileMojo#execute includes an assertion that the projects <packaging> is tile.

We should probably just remove this assertion as the attach-tile goal is triggered by the custom lifecycle already - if you include the plugin and configure an execution it should just work.

Eclipse ignores tiles

The Eclipse m2e plugin does not recognize lifecycle participants. It is not clear how to get it to do so - most of the configuration options for m2e involve telling it about items that need to be watched for when it is building incrementally.

Tiles does not affect the incremental build, only the full refresh (when the Maven | Update is requested) then there appears to be no documentation on how this could work. It may require a full Eclipse plugin with OSGi - which would be @talios 's territory.

Packaging causing some pain

You cannot specify a packaging Maven doesn't inherently understand because it attempts to resolve everything first time through.

This is a reminder to see if we can override the packaging when we attempt to resolve the model the second time. Such as with a setting

Including multiple tiles based artifacts in IntellIJ causes resolution issues

I'm hitting an annoying situation where I have 10+ modules included in my IDEA project, each use a selection of 3-4 tiles ( the same ones ) but it different orders.

Since IntelliJ runs everything in the same maven session, the same ModelCache is being used, and since we mutate the parents of artifacts to build the artifact chain, this causes all manner of oddities in IntelliJ ( most evident if you include dependencies in any of your tiles ).

I wonder if we can somehow cache multiple copies of the effective-tile ( i.e. a per-project tile ).

Unable to use tiles with the flatten-maven-plugin

When using the flatten-maven-plugin, tiles cannot be used as the plugin requires a "pom" packaging parent as it's resolving the tiles PROJECT pom, not the TILE itself.

[ERROR] Invalid packaging for parent POM com.theoryinpractise:halbuilder-release-tile:
1.0.4-SNAPSHOT, must be "pom" but is "tile" @ com.theoryinpractise:halbuilder-release-tile:
1.0.4-SNAPSHOT

It's possible we could get around this by injecting the parent with the tile classifer/type so the artifact gets resolved rather than the project pom.

MavenSession#getAllProjects method not found

Looks like MavenSession#getAllProjects is a not a blessed method and even carries a comment of:

/** This is a provisional method and may be removed */

It looks like this was actually removed in the upcoming Maven 3.3.7 release, and also not available in the version of Maven IntelliJ IDEA ships with by default.

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.