blob: 4ad30d2430c94e4210599a1e6a1524d04e2860fd [file] [log] [blame]
<!--
============LICENSE_START=======================================================
Copyright (C) 2021 Nordix Foundation.
================================================================================
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.
SPDX-License-Identifier: Apache-2.0
============LICENSE_END=========================================================
-->
<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>
<parent>
<groupId>org.onap.policy.gui</groupId>
<artifactId>policy-gui</artifactId>
<version>2.2.1-SNAPSHOT</version>
</parent>
<artifactId>gui-clamp</artifactId>
<packaging>pom</packaging>
<name>${project.artifactId}</name>
<description>This module contains the implementation code for the CLAMP GUIs in the Policy Framework</description>
<properties>
<ui.react.src>ui-react</ui.react.src>
<ui.react.lib.src>ui-react-lib</ui.react.lib.src>
<npm.publish.url>https://nexus3.onap.org/repository/npm.snapshot/</npm.publish.url>
<sonar.nodejs.executable>${project.build.directory}/ui-react/node/node</sonar.nodejs.executable>
<sonar.sources>${project.basedir}/ui-react/src</sonar.sources>
<sonar.exclusions>**/*.test.js</sonar.exclusions>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>copy-resources-1</id>
<!-- here the phase you need -->
<phase>compile</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/${ui.react.src}</outputDirectory>
<resources>
<resource>
<directory>${ui.react.src}</directory>
<excludes>
<exclude>node_modules</exclude>
</excludes>
<includes>
<include>src/**</include>
<include>public/**</include>
<include>package.json</include>
<include>package-lock.json</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-resources-2</id>
<!-- here the phase you need -->
<phase>compile</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/${ui.react.src}</outputDirectory>
<resources>
<resource>
<directory>${ui.react.src}</directory>
<includes>
<include>src/**</include>
</includes>
<excludes>
<exclude>**/__snapshots__/**</exclude>
<exclude>**/**.test.js</exclude>
</excludes>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-resources-3</id>
<!-- here the phase you need -->
<phase>compile</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/${ui.react.lib.src}</outputDirectory>
<resources>
<resource>
<directory>${ui.react.lib.src}</directory>
<includes>
<include>**</include>
</includes>
<excludes>
<exclude>node_modules/**</exclude>
<exclude>package-lock.json</exclude>
</excludes>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.11.3</version>
<configuration>
<installDirectory>${project.build.directory}/${ui.react.src}</installDirectory>
<npmDownloadRoot>${repo.npm}</npmDownloadRoot>
</configuration>
<executions>
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<nodeVersion>v14.17.0</nodeVersion>
</configuration>
</execution>
<execution>
<id>npm_install</id>
<goals>
<goal>npm</goal>
</goals>
<phase>compile</phase>
<configuration>
<workingDirectory>${project.build.directory}/${ui.react.src}</workingDirectory>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>npm_build</id>
<goals>
<goal>npm</goal>
</goals>
<phase>package</phase>
<configuration>
<workingDirectory>${project.build.directory}/${ui.react.src}</workingDirectory>
<arguments>run build</arguments>
</configuration>
</execution>
<execution>
<id>npm_test</id>
<goals>
<goal>npm</goal>
</goals>
<phase>test</phase>
<configuration>
<skip>${maven.test.skip}</skip>
<arguments>run-script test:coverage</arguments>
<workingDirectory>${project.build.directory}/${ui.react.src}</workingDirectory>
</configuration>
</execution>
<!-- XXX Are these deploy steps using npm desirable given docker image generation? -->
<execution>
<id>npm_install_lib</id>
<goals>
<goal>npm</goal>
</goals>
<phase>deploy</phase>
<configuration>
<workingDirectory>${project.build.directory}/${ui.react.lib.src}</workingDirectory>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>npm_build_lib</id>
<goals>
<goal>npm</goal>
</goals>
<phase>deploy</phase>
<configuration>
<workingDirectory>${project.build.directory}/${ui.react.lib.src}</workingDirectory>
<arguments>run build</arguments>
</configuration>
</execution>
<execution>
<id>npm_publish</id>
<goals>
<goal>npm</goal>
</goals>
<phase>deploy</phase>
<configuration>
<workingDirectory>${project.build.directory}/${ui.react.lib.src}</workingDirectory>
<arguments>publish</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<filesets>
<fileset>
<directory>${ui.react.lib.src}/node</directory>
</fileset>
<fileset>
<directory>${ui.react.src}/node</directory>
</fileset>
<fileset>
<directory>${ui.react.src}/node_modules</directory>
</fileset>
<fileset>
<directory>${ui.react.lib.src}/node_modules</directory>
</fileset>
<fileset>
<directory>${basedir}</directory>
<includes>**/package-lock.json</includes>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>1.3.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>generate-gui-clamp-tar</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/assembly/clamp-build.xml</descriptor>
</descriptors>
<finalName>${project.artifactId}-${project.version}</finalName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>