Skip to content
This repository has been archived by the owner on Feb 3, 2025. It is now read-only.

Commit

Permalink
https://github.com/repaint-io/maven-tiles/issues/53
Browse files Browse the repository at this point in the history
illustration of issue with profiles
  • Loading branch information
Sparg, Timothy, Vodacom South Africa (External) authored and Sparg, Timothy, Vodacom South Africa (External) committed Jan 6, 2018
1 parent d1dc5ba commit 66e0f9c
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ target
!.gitignore
!.gitattributes
!.gitkeep

#Intelij
*.iml
29 changes: 29 additions & 0 deletions profileissue/profiletileusage/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>io.repaint.maven</groupId>
<artifactId>profile-tile-usage</artifactId>
<version>1.0.0-SNAPSHOT</version>


<build>
<plugins>
<plugin>
<groupId>io.repaint.maven</groupId>
<artifactId>tiles-maven-plugin</artifactId>
<version>2.11-SNAPSHOT</version>
<extensions>true</extensions>
<configuration>
<filtering>true</filtering>
<tiles>
<tile>io.repaint.maven:profile-issue-tile:1.0.0-SNAPSHOT</tile>
</tiles>
</configuration>
</plugin>
</plugins>
</build>

</project>
26 changes: 26 additions & 0 deletions profileissue/tile/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>io.repaint.maven</groupId>
<artifactId>profile-issue-tile</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>tile</packaging>

<build>
<plugins>
<plugin>
<groupId>io.repaint.maven</groupId>
<artifactId>tiles-maven-plugin</artifactId>
<version>2.11-SNAPSHOT</version>
<extensions>true</extensions>
<configuration>
<filtering>true</filtering>
</configuration>
</plugin>
</plugins>
</build>

</project>
69 changes: 69 additions & 0 deletions profileissue/tile/tile.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<properties>
<a.chop>dontbe</a.chop>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>print-antrun1</id>
<phase>validate</phase>
<configuration>
<target>
<echo message="@@@@@@@@@@@@ HELLO! Iam a AntRun 1 Tile"/>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<activation>
<activeByDefault/>
</activation>
<id>ant-run-in-profile</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>print-antrun1</id>
<phase>validate</phase>
<configuration>
<target>
<echo message="@@@@@@@@@@@@ HELLO! Iam a AntRun 1 Tile in a *profile*"/>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>


Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,9 @@ public class TilesMavenLifecycleParticipant extends AbstractMavenLifecyclePartic
throw new MavenExecutionException("Cannot apply tiles, the expected parent ${applyBeforeParent} is not found.",
project.file)
}
copyModel(project, finalModel.effectiveModel)
//FIXME hack to illustrate resolution of profile issue
// copyModel(project, finalModel.effectiveModel)
copyModel(project, finalModel.effectiveModel,tiles)
} finally {
// restore original ModelProcessor
((DefaultModelBuilder)modelBuilder).setModelProcessor(modelProcessor)
Expand Down Expand Up @@ -588,7 +590,10 @@ public class TilesMavenLifecycleParticipant extends AbstractMavenLifecyclePartic

}

protected void copyModel(MavenProject project, Model newModel) {
//FIXME hack to illustrate resolution of profile issue
//protected void copyModel(MavenProject project, Model newModel) {
protected void copyModel(MavenProject project, Model newModel, List<TileModel> tiles ) {


// no setting parent, we have generated an effective model which is now all copied in
Model projectModel = project.model
Expand Down Expand Up @@ -633,6 +638,12 @@ public class TilesMavenLifecycleParticipant extends AbstractMavenLifecyclePartic
}
build.pluginManagement.addPlugin(m2ePlugin)
}

//FIXME hack to illustrate resolution of profile issue
tiles.each { TileModel tileModel ->
Model model = tileModel.model
projectModel.profiles.addAll(model.profiles)
}
}

protected void loadAllDiscoveredTiles() throws MavenExecutionException {
Expand Down

0 comments on commit 66e0f9c

Please sign in to comment.