Akira Ajisaka bb4c6db9b3
YARN-10470. When building new web ui with root user, the bower install should support it. Contributed by zhuqi.
(cherry picked from commit c4ba0ab7dfcfe76f928d06fcb29ca0cc4d778737)
2020-11-24 15:22:51 +09:00

305 lines
11 KiB
XML

<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
-->
<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 https://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>hadoop-yarn</artifactId>
<groupId>org.apache.hadoop</groupId>
<version>3.3.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>hadoop-yarn-ui</artifactId>
<version>3.3.1-SNAPSHOT</version>
<name>Apache Hadoop YARN UI</name>
<packaging>${packagingType}</packaging>
<properties>
<packagingType>pom</packagingType>
<webappDir>${basedir}/target/webapp</webappDir>
<nodeExecutable>${basedir}/target/webapp/node/node</nodeExecutable>
<packageManagerScript>node/yarn/dist/bin/yarn.js</packageManagerScript>
<keepUIBuildCache>false</keepUIBuildCache>
</properties>
<build>
<plugins>
<!-- Apache RAT -->
<plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
<configuration>
<excludes>
<exclude>src/main/webapp/jsconfig.json</exclude>
<exclude>src/main/webapp/bower.json</exclude>
<exclude>src/main/webapp/bower-shrinkwrap.json</exclude>
<exclude>src/main/webapp/package.json</exclude>
<exclude>src/main/webapp/yarn.lock</exclude>
<exclude>src/main/webapp/testem.json</exclude>
<exclude>src/main/webapp/public/assets/images/**/*</exclude>
<exclude>src/main/webapp/public/assets/images/*</exclude>
<exclude>src/main/webapp/public/robots.txt</exclude>
<exclude>public/crossdomain.xml</exclude>
<exclude>src/main/webapp/.bowerrc</exclude>
<exclude>src/main/webapp/.ember-cli</exclude>
<exclude>src/main/webapp/.jshintrc</exclude>
<exclude>src/main/webapp/.watchmanconfig</exclude>
<exclude>src/main/webapp/WEB-INF/wro.xml</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<skip>${keepUIBuildCache}</skip>
<followSymLinks>false</followSymLinks>
<filesets>
<fileset>
<directory>${webappDir}/bower_components</directory>
</fileset>
<fileset>
<directory>${webappDir}/node_modules</directory>
</fileset>
</filesets>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>yarn-ui</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<packagingType>war</packagingType>
</properties>
<build>
<plugins>
<!-- Copy files into target for build -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-resources</id>
<!-- here the phase you need -->
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${webappDir}</outputDirectory>
<resources>
<resource>
<directory>${basedir}/src/main/webapp</directory>
<filtering>true</filtering>
<excludes>
<exclude>node_modules/**/*</exclude>
<exclude>bower_components/**/*</exclude>
<exclude>tmp/**/*</exclude>
<exclude>dist/**/*</exclude>
<exclude>terminal/**/*</exclude>
</excludes>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-terminal</id>
<!-- here the phase you need -->
<phase>compile</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${webappDir}/dist</outputDirectory>
<resources>
<resource>
<directory>${basedir}/src/main/webapp</directory>
<filtering>true</filtering>
<includes>
<include>terminal/**/*</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-xterm</id>
<!-- here the phase you need -->
<phase>compile</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${webappDir}/dist/terminal/xterm</outputDirectory>
<resources>
<resource>
<directory>${basedir}/target/webapp/node_modules/xterm</directory>
<filtering>true</filtering>
<includes>
<include>dist/**/*</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<!-- Install Node, Yarn, Bower & dependencies -->
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>${frontend-maven-plugin.version}</version>
<configuration>
<workingDirectory>${webappDir}</workingDirectory>
</configuration>
<executions>
<!-- Install all dependencies -->
<execution>
<phase>generate-resources</phase>
<id>install node and yarn</id>
<goals>
<goal>install-node-and-yarn</goal>
</goals>
<configuration>
<nodeVersion>v10.21.0</nodeVersion>
<yarnVersion>v1.21.1</yarnVersion>
</configuration>
</execution>
<execution>
<phase>generate-resources</phase>
<id>yarn install</id>
<goals>
<goal>yarn</goal>
</goals>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<phase>generate-resources</phase>
<id>bower install</id>
<configuration>
<arguments>install --allow-root</arguments>
</configuration>
<goals>
<goal>bower</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<!-- Ember Build -->
<execution>
<id>ember build</id>
<phase>generate-resources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<workingDirectory>${webappDir}</workingDirectory>
<executable>${nodeExecutable}</executable>
<arguments>
<argument>${packageManagerScript}</argument>
<argument>run</argument>
<argument>build:mvn</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
<!-- Asset minifier -->
<plugin>
<groupId>ro.isdc.wro4j</groupId>
<artifactId>wro4j-maven-plugin</artifactId>
<version>1.7.9</version>
<dependencies>
<!-- TODO: Remove this dependency after upgrading wro4j-maven-plugin to 1.8.1 or later. -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.18.0</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<configuration>
<minimize>true</minimize>
<targetGroups>yarn-ui,vendor</targetGroups>
<destinationFolder>${basedir}/target/minified-resources/assets</destinationFolder>
<contextFolder>${webappDir}/dist/assets</contextFolder>
<wroFile>${webappDir}/WEB-INF/wro.xml</wroFile>
</configuration>
</plugin>
<!-- Package into war -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
</execution>
</executions>
<configuration>
<webXml>${webappDir}/WEB-INF/web.xml</webXml>
<warSourceDirectory>${webappDir}/dist</warSourceDirectory>
<webResources>
<resource>
<filtering>false</filtering>
<directory>${basedir}/target/minified-resources</directory>
</resource>
</webResources>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<skipIfEmpty>true</skipIfEmpty>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>