changeset 125:871145d042ba

Build entire plugin with `mvn clean verify` Rely on thermostat-assembly to build a combined zip with all jars needed by the plugin.
author Omair Majid <omajid@redhat.com>
date Wed, 26 Mar 2014 15:22:54 -0400
parents f425cf9c32e8
children b9f5d8a935e9
files com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/wizards/ProjectCreator.java
diffstat 1 files changed, 52 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/wizards/ProjectCreator.java	Wed Mar 26 13:06:12 2014 -0400
+++ b/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/wizards/ProjectCreator.java	Wed Mar 26 15:22:54 2014 -0400
@@ -128,11 +128,11 @@
                 + "  <packaging>pom</packaging>\n"
                 + "\n"
                 + "  <modules>\n"
-                + "    <module>" + this.artifactId + "-agent</module>\n"
-                + "    <module>" + this.artifactId + "-common</module>\n"
-                + "    <module>" + this.artifactId + "-client</module>\n"
-                + "    <module>" + this.artifactId + "-cli</module>\n"
-                + "    <module>" + this.artifactId + "-distribution</module>\n"
+                + "    <module>../" + this.artifactId + "-agent</module>\n"
+                + "    <module>../" + this.artifactId + "-common</module>\n"
+                + "    <module>../" + this.artifactId + "-client</module>\n"
+                + "    <module>../" + this.artifactId + "-cli</module>\n"
+                + "    <module>../" + this.artifactId + "-distribution</module>\n"
                 + "  </modules>\n"
                 + "\n"
                 + "  <dependencyManagement>\n"
@@ -163,11 +163,7 @@
         String pomContents = ""
                 + POM_HEADER
                 + "\n"
-                + "  <parent>\n"
-                + "    <groupId>" + groupId + "</groupId>\n"
-                + "    <artifactId>" + parentId + "</artifactId>\n"
-                + "    <version>" + version + "</version>\n"
-                + "  </parent>\n"
+                + createParentSection(groupId, parentId, version)
                 + "\n"
                 + "  <artifactId>" + artifactId + "</artifactId>\n"
                 + "  <packaging>jar</packaging>\n"
@@ -189,11 +185,7 @@
 
         String pomContents = ""
                 + POM_HEADER
-                + "  <parent>\n"
-                + "    <groupId>" + groupId + "</groupId>\n"
-                + "    <artifactId>" + parentId + "</artifactId>\n"
-                + "    <version>" + version + "</version>\n"
-                + "  </parent>\n"
+                + createParentSection(groupId, parentId, version)
                 + "\n"
                 + "  <artifactId>" + artifactId + "</artifactId>\n"
                 + "  <packaging>jar</packaging>\n"
@@ -253,15 +245,45 @@
 
         String pomContents = ""
                 + POM_HEADER
-                + "  <parent>\n"
-                + "    <groupId>" + groupId + "</groupId>\n"
-                + "    <artifactId>" + parentId + "</artifactId>\n"
-                + "    <version>" + version + "</version>\n"
-                + "  </parent>\n"
+                + createParentSection(groupId, parentId, version)
                 + "\n"
                 + "  <artifactId>" + artifactId + "</artifactId>\n"
                 + "  <packaging>jar</packaging>\n"
                 + "\n"
+                + "  <properties>\n"
+                + "    <thermostat.plugin>" + this.artifactId + "</thermostat.plugin>\n"
+                + "  </properties>\n"
+                + "\n"
+                + "  <build>\n"
+                + "    <plugins>\n"
+                + "      <plugin>\n"
+                + "        <artifactId>maven-assembly-plugin</artifactId>\n"
+                + "        <dependencies>\n"
+                + "          <dependency>\n"
+                + "            <groupId>com.redhat.thermostat</groupId>\n"
+                + "            <artifactId>thermostat-assembly</artifactId>\n"
+                + "            <version>" + thermostatVersion + "</version>\n"
+                + "          </dependency>\n"
+                + "        </dependencies>\n"
+                + "        <configuration>\n"
+                + "          <descriptorRefs>\n"
+                + "            <descriptorRef>plugin-assembly</descriptorRef>\n"
+                + "          </descriptorRefs>\n"
+                + "          <appendAssemblyId>false</appendAssemblyId>\n"
+                + "        </configuration>\n"
+                + "        <executions>\n"
+                + "          <execution>\n"
+                + "            <id>assemble-plugin</id>\n"
+                + "            <phase>package</phase>\n"
+                + "            <goals>\n"
+                + "              <goal>single</goal>\n"
+                + "            </goals>\n"
+                + "          </execution>\n"
+                + "        </executions>\n"
+                + "      </plugin>\n"
+                + "    </plugins>\n"
+                + "  </build>\n"
+                + "\n"
                 + "  <!-- Explicitly list all plug-in artifacts, transitive dependencies\n"
                 + "       are not included in assembly. -->\n"
                 + "  <dependencies>\n"
@@ -367,6 +389,16 @@
         }
     }
 
+    private String createParentSection(String groupId, String parentId, String version) {
+        return ""
+            + "  <parent>\n"
+            + "    <groupId>" + groupId + "</groupId>\n"
+            + "    <artifactId>" + parentId + "</artifactId>\n"
+            + "    <version>" + version + "</version>\n"
+            + "    <relativePath>../" + parentId + "</relativePath>\n"
+            + "  </parent>\n";
+    }
+
     private void refreshProjects() throws CoreException {
         // Refresh projects
         ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IWorkspaceRoot.DEPTH_INFINITE, new NullProgressMonitor());