Modify maven for angular build 67/33867/5
authorPatrick Brady <pb071s@att.com>
Fri, 2 Mar 2018 22:49:54 +0000 (17:49 -0500)
committerPatrick Brady <pb071s@att.com>
Mon, 5 Mar 2018 05:03:11 +0000 (21:03 -0800)
Using the same plugin that portal has been using
to perform angular cli builds in jenkins.

Also modifed maven assembly plugin to package the
generated angular javascript code into a deployable
zip file.

Change-Id: Ib26801ca6b4d8dd5195b570bc694d37efe421684
Signed-off-by: Patrick Brady <pb071s@att.com>
Issue-ID: APPC-627

assemble_dist_zip.xml [new file with mode: 0644]
pom.xml

diff --git a/assemble_dist_zip.xml b/assemble_dist_zip.xml
new file mode 100644 (file)
index 0000000..5268faf
--- /dev/null
@@ -0,0 +1,40 @@
+<!--
+  ============LICENSE_START=======================================================
+  ONAP : APPC
+  ================================================================================
+  Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+  ================================================================================
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+  
+       http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  
+  ECOMP is a trademark and service mark of AT&T Intellectual Property.
+  ============LICENSE_END=========================================================
+  -->
+
+<assembly
+    xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+    <id>dist</id>
+    <formats>
+        <format>zip</format>
+    </formats>
+    <includeBaseDirectory>false</includeBaseDirectory>
+    <fileSets>
+        <fileSet>
+            <directory>dist</directory>
+            <outputDirectory>.</outputDirectory>
+            <excludes>
+            </excludes>
+        </fileSet>
+    </fileSets>
+</assembly>
diff --git a/pom.xml b/pom.xml
index 8ec1088..dd06451 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -117,60 +117,75 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property.
                 </executions>
             </plugin> -->
             <plugin>
-                <artifactId>maven-assembly-plugin</artifactId>
-                <version>2.5.3</version>
+                <groupId>com.github.eirslett</groupId>
+                <artifactId>frontend-maven-plugin</artifactId>
+                <!-- Use the latest released version: https://repo1.maven.org/maven2/com/github/eirslett/frontend-maven-plugin/ -->
+                <version>1.3</version>
                 <configuration>
-                    <descriptors>
-                        <descriptor>src/main/assembly/assembly.xml</descriptor>
-                    </descriptors>
+                    <nodeVersion>v7.7.4</nodeVersion>
+                    <nodeDownloadRoot>https://nodejs.org/dist/</nodeDownloadRoot>
+                    <npmDownloadRoot>https://nodejs.org/dist/npm/</npmDownloadRoot>
+                    <installDirectory>./</installDirectory>
                 </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>build-helper-maven-plugin</artifactId>
-                <version>1.12</version>
                 <executions>
                     <execution>
-                        <id>attach-artifacts</id>
-                        <phase>package</phase>
+                        <id>install node and npm</id>
+                        <goals>
+                            <goal>install-node-and-npm</goal>
+                        </goals>
+                        <phase>generate-resources</phase>
+                    </execution>
+
+                    <execution>
+                        <id>npm install</id>
+                        <goals>
+                            <goal>npm</goal>
+                        </goals>
+
+                        <phase>generate-resources</phase>
+
+                        <configuration>
+                            <arguments>install</arguments>
+                        </configuration>
+                    </execution>
+
+                    <execution>
+                        <id>npm build</id>
                         <goals>
-                            <goal>attach-artifact</goal>
+                            <goal>npm</goal>
                         </goals>
+
+                        <phase>generate-resources</phase>
+
                         <configuration>
-                            <artifacts>
-                                <artifact>
-                                    <file>target/${project.artifactId}-${project.version}-zip.zip</file>
-                                    <type>zip</type>
-                                </artifact>
-                            </artifacts>
+                            <arguments>run build</arguments>
                         </configuration>
                     </execution>
+
                 </executions>
             </plugin>
-            <!-- <plugin> -->
-            <!-- <groupId>org.apache.maven.plugins</groupId> -->
-            <!-- <artifactId>maven-resources-plugin</artifactId> -->
-            <!-- <version>2.4.2</version> -->
-            <!-- <executions> -->
-            <!-- <execution> -->
-            <!-- <id>default-copy-resources</id> -->
-            <!-- <phase>process-resources</phase> -->
-            <!-- <goals> -->
-            <!-- <goal>copy-resources</goal> -->
-            <!-- </goals> -->
-            <!-- <configuration> -->
-            <!-- <format>zip</format> -->
-            <!-- <overwrite>true</overwrite> -->
-            <!-- <outputDirectory>${project.build.directory}/${project.artifactId}-${project.version}/</outputDirectory> -->
-            <!-- <resources> -->
-            <!-- <resource> -->
-            <!-- <directory>${project.basedir}/dist</directory> -->
-            <!-- </resource> -->
-            <!-- </resources> -->
-            <!-- </configuration> -->
-            <!-- </execution> -->
-            <!-- </executions> -->
-            <!-- </plugin> -->
+
+      <plugin>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>maven-repo-zip</id>
+            <goals>
+              <goal>single</goal>
+            </goals>
+            <phase>package</phase>
+            <configuration>
+              <appendAssemblyId>false</appendAssemblyId>
+              <attach>false</attach>
+              <finalName>${project.artifactId}-${project.version}</finalName>
+              <descriptors>
+                <descriptor>assemble_dist_zip.xml</descriptor>
+              </descriptors>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+
         </plugins>
     </build>
     <profiles>