hadoop/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/pom.xml
Gautham B A dc5460d525
YARN-11078. Set env vars in a cross platform compatible way (#4432)
* Maven runs the ember build script.
  The environment variable TMPDIR was
  set as per bash syntax.
* This failed on Windows since the
  Windows command prompt doesn't
  support bash syntax.
* We're now detecting the OS and
  setting a Maven property
  "emberBuildScript" in a cross
  platform compatible way.
2022-06-15 15:29:55 +05:30

333 lines
12 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.4.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>hadoop-yarn-ui</artifactId>
<version>3.4.0-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>
<!-- Pkck the appropriate ember build script to use in src/package.json based on the OS -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<exportAntProperties>true</exportAntProperties>
<target>
<!-- Set the Maven property emberBuildScript to build:mvn:windows if this is
running on Windows. Set it to build:mvn otherwise. -->
<condition property="emberBuildScript" value="build:mvn:windows" else="build:mvn">
<and>
<os family="windows"/>
</and>
</condition>
<echo>Ember build script to use = ${emberBuildScript}</echo>
</target>
</configuration>
</execution>
</executions>
</plugin>
<!-- 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>${nodejs.version}</nodeVersion>
<yarnVersion>${yarnpkg.version}</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>${emberBuildScript}</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>