From 66e0f9cc114dc8773c6e1b9b7a2bfe98256eb89b Mon Sep 17 00:00:00 2001 From: "Sparg, Timothy, Vodacom South Africa (External)" Date: Sat, 6 Jan 2018 15:04:49 +0200 Subject: [PATCH] https://github.com/repaint-io/maven-tiles/issues/53 illustration of issue with profiles --- .gitignore | 3 + profileissue/profiletileusage/pom.xml | 29 ++++++++ profileissue/tile/pom.xml | 26 +++++++ profileissue/tile/tile.xml | 69 +++++++++++++++++++ .../TilesMavenLifecycleParticipant.groovy | 15 +++- 5 files changed, 140 insertions(+), 2 deletions(-) create mode 100644 profileissue/profiletileusage/pom.xml create mode 100644 profileissue/tile/pom.xml create mode 100644 profileissue/tile/tile.xml diff --git a/.gitignore b/.gitignore index f31bdd7..7f37486 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,6 @@ target !.gitignore !.gitattributes !.gitkeep + +#Intelij +*.iml diff --git a/profileissue/profiletileusage/pom.xml b/profileissue/profiletileusage/pom.xml new file mode 100644 index 0000000..4197a44 --- /dev/null +++ b/profileissue/profiletileusage/pom.xml @@ -0,0 +1,29 @@ + + + 4.0.0 + + io.repaint.maven + profile-tile-usage + 1.0.0-SNAPSHOT + + + + + + io.repaint.maven + tiles-maven-plugin + 2.11-SNAPSHOT + true + + true + + io.repaint.maven:profile-issue-tile:1.0.0-SNAPSHOT + + + + + + + diff --git a/profileissue/tile/pom.xml b/profileissue/tile/pom.xml new file mode 100644 index 0000000..4bbbb66 --- /dev/null +++ b/profileissue/tile/pom.xml @@ -0,0 +1,26 @@ + + + 4.0.0 + + io.repaint.maven + profile-issue-tile + 1.0.0-SNAPSHOT + tile + + + + + io.repaint.maven + tiles-maven-plugin + 2.11-SNAPSHOT + true + + true + + + + + + diff --git a/profileissue/tile/tile.xml b/profileissue/tile/tile.xml new file mode 100644 index 0000000..ea9eeb9 --- /dev/null +++ b/profileissue/tile/tile.xml @@ -0,0 +1,69 @@ + + + 4.0.0 + + + dontbe + + + + + + org.apache.maven.plugins + maven-antrun-plugin + 1.7 + + + print-antrun1 + validate + + + + + + + run + + + + + + + + + + + + + ant-run-in-profile + + + + org.apache.maven.plugins + maven-antrun-plugin + 1.7 + + + print-antrun1 + validate + + + + + + + run + + + + + + + + + + + + diff --git a/src/main/groovy/io/repaint/maven/tiles/TilesMavenLifecycleParticipant.groovy b/src/main/groovy/io/repaint/maven/tiles/TilesMavenLifecycleParticipant.groovy index 4fb5408..d528df6 100644 --- a/src/main/groovy/io/repaint/maven/tiles/TilesMavenLifecycleParticipant.groovy +++ b/src/main/groovy/io/repaint/maven/tiles/TilesMavenLifecycleParticipant.groovy @@ -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) @@ -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 tiles ) { + // no setting parent, we have generated an effective model which is now all copied in Model projectModel = project.model @@ -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 {