511120: ensure WikiText UI build works after core release

Move p2 repository generation to wikitext core component, so that
wikitext core version can be used when specifying artifact versions to
include in the generated p2 repository.

Change-Id: I41708783c4f5f9d4f1a105c3e154c2c2d7e0fe00
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=511120
diff --git a/wikitext/core/pom.xml b/wikitext/core/pom.xml
index 0b36eea..a1f5ecd 100644
--- a/wikitext/core/pom.xml
+++ b/wikitext/core/pom.xml
@@ -72,6 +72,8 @@
         <module>org.eclipse.mylyn.wikitext.mediawiki.ant</module>
         <module>org.eclipse.mylyn.wikitext.tracwiki</module>
         <module>org.eclipse.mylyn.wikitext.twiki</module>
+        
+        <module>repository</module>
     </modules>
 
     <build>
diff --git a/wikitext/core/repository/.gitignore b/wikitext/core/repository/.gitignore
new file mode 100644
index 0000000..0a98973
--- /dev/null
+++ b/wikitext/core/repository/.gitignore
@@ -0,0 +1,2 @@
+repository-pom.xml
+interpolated*pom.xml
diff --git a/wikitext/repository/.project b/wikitext/core/repository/.project
similarity index 100%
rename from wikitext/repository/.project
rename to wikitext/core/repository/.project
diff --git a/wikitext/core/repository/pom.xml b/wikitext/core/repository/pom.xml
new file mode 100644
index 0000000..9e653ca
--- /dev/null
+++ b/wikitext/core/repository/pom.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.eclipse.mylyn.docs</groupId>
+        <artifactId>wikitext.core</artifactId>
+        <version>3.0.1-SNAPSHOT</version>
+        <relativePath>..</relativePath>
+    </parent>
+
+    <artifactId>wikitext.core.repository</artifactId>
+    <name>Mylyn WikiText Core p2 Repository</name>
+    <packaging>pom</packaging>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-antrun-plugin</artifactId>
+                <version>1.6</version>
+                <executions>
+                    <execution>
+                        <phase>generate-sources</phase>
+                        <configuration>
+                            <target>
+                                <property name="wikitext.version" value="${project.version}"/>
+                                <echo level="info">creating repository with version ${wikitext.version}</echo>
+                                <copy file="repository-pom-template.xml" tofile="repository-pom.xml">
+                                    <filterset>
+                                        <filter token="WIKITEXT_VERSION" value="${wikitext.version}"/>
+                                    </filterset>
+                                </copy>
+                            </target>
+                        </configuration>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <artifactId>maven-invoker-plugin</artifactId>
+                <version>2.0.0</version>
+                <configuration>
+                    <pom>repository-pom.xml</pom>
+                    <streamLogs>true</streamLogs>
+                    <localRepositoryPath>.local-repo</localRepositoryPath>
+                    <disableReports>true</disableReports>
+                    <reportsDirectory>${project.build.directory}</reportsDirectory>
+                    <goals>
+                        <goal>clean</goal>
+                        <goal>package</goal>
+                    </goals>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>two-part-repository-build</id>
+                        <goals>
+                            <goal>install</goal><!-- install to avoid stale p2 cache with locally built artifacts -->
+                            <goal>run</goal>
+                            <goal>verify</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+    <pluginRepositories>
+        <pluginRepository>
+            <id>reficio</id>
+            <url>http://repo.reficio.org/maven/</url>
+        </pluginRepository>
+    </pluginRepositories>
+</project>
diff --git a/wikitext/repository/pom.xml b/wikitext/core/repository/repository-pom-template.xml
similarity index 85%
rename from wikitext/repository/pom.xml
rename to wikitext/core/repository/repository-pom-template.xml
index 5f1df14..f71fbbe 100644
--- a/wikitext/repository/pom.xml
+++ b/wikitext/core/repository/repository-pom-template.xml
@@ -4,8 +4,8 @@
 
     <parent>
         <groupId>org.eclipse.mylyn.docs</groupId>
-        <artifactId>wikitext</artifactId>
-        <version>3.0.1-SNAPSHOT</version>
+        <artifactId>wikitext.core</artifactId>
+        <version>@WIKITEXT_VERSION@</version>
         <relativePath>..</relativePath>
     </parent>
 
@@ -29,67 +29,67 @@
                         <configuration>
                             <artifacts>
                                 <artifact>
-                                    <id>org.eclipse.mylyn.docs:org.eclipse.mylyn.wikitext:3.0.1-SNAPSHOT</id>
+                                    <id>org.eclipse.mylyn.docs:org.eclipse.mylyn.wikitext:@WIKITEXT_VERSION@</id>
                                     <transitive>false</transitive>
                                     <source>true</source>
                                 </artifact>
                                 <artifact>
-                                    <id>org.eclipse.mylyn.docs:org.eclipse.mylyn.wikitext.toolkit:3.0.1-SNAPSHOT</id>
+                                    <id>org.eclipse.mylyn.docs:org.eclipse.mylyn.wikitext.toolkit:@WIKITEXT_VERSION@</id>
                                     <transitive>false</transitive>
                                     <source>true</source>
                                 </artifact>
                                 <artifact>
-                                    <id>org.eclipse.mylyn.docs:org.eclipse.mylyn.wikitext.html:3.0.1-SNAPSHOT</id>
+                                    <id>org.eclipse.mylyn.docs:org.eclipse.mylyn.wikitext.html:@WIKITEXT_VERSION@</id>
                                     <transitive>false</transitive>
                                     <source>true</source>
                                 </artifact>
                                 <artifact>
-                                    <id>org.eclipse.mylyn.docs:org.eclipse.mylyn.wikitext.textile:3.0.1-SNAPSHOT</id>
+                                    <id>org.eclipse.mylyn.docs:org.eclipse.mylyn.wikitext.textile:@WIKITEXT_VERSION@</id>
                                     <transitive>false</transitive>
                                     <source>true</source>
                                 </artifact>
                                 <artifact>
-                                    <id>org.eclipse.mylyn.docs:org.eclipse.mylyn.wikitext.ant:3.0.1-SNAPSHOT</id>
+                                    <id>org.eclipse.mylyn.docs:org.eclipse.mylyn.wikitext.ant:@WIKITEXT_VERSION@</id>
                                     <transitive>false</transitive>
                                     <source>true</source>
                                 </artifact>
                                 <artifact>
-                                    <id>org.eclipse.mylyn.docs:org.eclipse.mylyn.wikitext.asciidoc:3.0.1-SNAPSHOT</id>
+                                    <id>org.eclipse.mylyn.docs:org.eclipse.mylyn.wikitext.asciidoc:@WIKITEXT_VERSION@</id>
                                     <transitive>false</transitive>
                                     <source>true</source>
                                 </artifact>
                                 <artifact>
-                                    <id>org.eclipse.mylyn.docs:org.eclipse.mylyn.wikitext.commonmark:3.0.1-SNAPSHOT</id>
+                                    <id>org.eclipse.mylyn.docs:org.eclipse.mylyn.wikitext.commonmark:@WIKITEXT_VERSION@</id>
                                     <transitive>false</transitive>
                                     <source>true</source>
                                 </artifact>
                                 <artifact>
-                                    <id>org.eclipse.mylyn.docs:org.eclipse.mylyn.wikitext.confluence:3.0.1-SNAPSHOT</id>
+                                    <id>org.eclipse.mylyn.docs:org.eclipse.mylyn.wikitext.confluence:@WIKITEXT_VERSION@</id>
                                     <transitive>false</transitive>
                                     <source>true</source>
                                 </artifact>
                                 <artifact>
-                                    <id>org.eclipse.mylyn.docs:org.eclipse.mylyn.wikitext.creole:3.0.1-SNAPSHOT</id>
+                                    <id>org.eclipse.mylyn.docs:org.eclipse.mylyn.wikitext.creole:@WIKITEXT_VERSION@</id>
                                     <transitive>false</transitive>
                                     <source>true</source>
                                 </artifact>
                                 <artifact>
-                                    <id>org.eclipse.mylyn.docs:org.eclipse.mylyn.wikitext.markdown:3.0.1-SNAPSHOT</id>
+                                    <id>org.eclipse.mylyn.docs:org.eclipse.mylyn.wikitext.markdown:@WIKITEXT_VERSION@</id>
                                     <transitive>false</transitive>
                                     <source>true</source>
                                 </artifact>
                                 <artifact>
-                                    <id>org.eclipse.mylyn.docs:org.eclipse.mylyn.wikitext.mediawiki:3.0.1-SNAPSHOT</id>
+                                    <id>org.eclipse.mylyn.docs:org.eclipse.mylyn.wikitext.mediawiki:@WIKITEXT_VERSION@</id>
                                     <transitive>false</transitive>
                                     <source>true</source>
                                 </artifact>
                                 <artifact>
-                                    <id>org.eclipse.mylyn.docs:org.eclipse.mylyn.wikitext.tracwiki:3.0.1-SNAPSHOT</id>
+                                    <id>org.eclipse.mylyn.docs:org.eclipse.mylyn.wikitext.tracwiki:@WIKITEXT_VERSION@</id>
                                     <transitive>false</transitive>
                                     <source>true</source>
                                 </artifact>
                                 <artifact>
-                                    <id>org.eclipse.mylyn.docs:org.eclipse.mylyn.wikitext.twiki:3.0.1-SNAPSHOT</id>
+                                    <id>org.eclipse.mylyn.docs:org.eclipse.mylyn.wikitext.twiki:@WIKITEXT_VERSION@</id>
                                     <transitive>false</transitive>
                                     <source>true</source>
                                 </artifact>
diff --git a/wikitext/pom.xml b/wikitext/pom.xml
index 7583700..44b6f40 100644
--- a/wikitext/pom.xml
+++ b/wikitext/pom.xml
@@ -13,7 +13,6 @@
 
     <modules>
         <module>core</module>
-        <module>repository</module>
         <module>ui-pom.xml</module>
     </modules>
 
diff --git a/wikitext/ui/targets/wikitext.target-template b/wikitext/ui/targets/wikitext.target-template
index b0af25d..e7a59d4 100644
--- a/wikitext/ui/targets/wikitext.target-template
+++ b/wikitext/ui/targets/wikitext.target-template
@@ -28,7 +28,7 @@
 <unit id="org.eclipse.mylyn.wikitext.twiki.source" version="0.0.0"/>
 <unit id="org.eclipse.mylyn.wikitext.twiki" version="0.0.0"/>
 <unit id="org.eclipse.mylyn.wikitext" version="0.0.0"/>
-<repository location="file:WIKITEXT_ROOT/repository/target/repository"/>
+<repository location="file:WIKITEXT_ROOT/core/repository/target/repository"/>
 </location>
 <location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="true" type="InstallableUnit">
 <unit id="org.eclipse.mylyn.context_feature.feature.group" version="0.0.0"/>