blob: 18c026c56b55c7132a5faf8d2d4d26b7bfb1dc19 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<packaging>war</packaging>
<artifactId>brooklyn-jsgui</artifactId>
<name>Brooklyn REST JavaScript Web GUI</name>
<description>
JavaScript+HTML GUI for interacting with Brooklyn, using the REST API
</description>
<parent>
<groupId>org.apache.brooklyn</groupId>
<artifactId>brooklyn-parent</artifactId>
<version>0.8.0-incubating</version><!-- BROOKLYN_VERSION -->
<relativePath>../../parent/pom.xml</relativePath>
</parent>
<properties>
<project.build.webapp>
${project.build.directory}/${project.build.finalName}
</project.build.webapp>
<nodejs.path>${project.basedir}/target/nodejs/node</nodejs.path>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.brooklyn</groupId>
<artifactId>brooklyn-api</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.brooklyn</groupId>
<artifactId>brooklyn-core</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.brooklyn</groupId>
<artifactId>brooklyn-utils-common</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.brooklyn</groupId>
<artifactId>brooklyn-rest-server</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.brooklyn</groupId>
<artifactId>brooklyn-rest-server</artifactId>
<version>${project.version}</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.brooklyn</groupId>
<artifactId>brooklyn-test-support</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.brooklyn</groupId>
<artifactId>brooklyn-policy</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.brooklyn</groupId>
<artifactId>brooklyn-locations-jclouds</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.brooklyn</groupId>
<artifactId>brooklyn-software-webapp</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.brooklyn</groupId>
<artifactId>brooklyn-software-database</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.brooklyn</groupId>
<artifactId>brooklyn-software-nosql</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.brooklyn</groupId>
<artifactId>brooklyn-software-messaging</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>${project.basedir}/src/test/resources/fixtures</directory>
<targetPath>${project.build.directory}/jasmine/fixtures</targetPath>
</resource>
</resources>
<!-- Insert special LICENSE/NOTICE into the <test-jar>/META-INF folder -->
<testResources>
<testResource>
<directory>${project.basedir}/src/test/resources</directory>
</testResource>
<testResource>
<targetPath>META-INF</targetPath>
<directory>${basedir}/src/test/license/files</directory>
</testResource>
</testResources>
<plugins>
<!--
run js tests with: $ mvn clean process-test-resources jasmine:test
run tests in the browser with: $ mvn jasmine:bdd
-->
<plugin>
<groupId>com.github.searls</groupId>
<artifactId>jasmine-maven-plugin</artifactId>
<version>${jasmine-maven-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<!--Uses the require.js test spec-->
<specRunnerTemplate>REQUIRE_JS</specRunnerTemplate>
<preloadSources>
<source>js/libs/require.js</source>
</preloadSources>
<!--Sources-->
<jsSrcDir>${project.basedir}/src/main/webapp/assets</jsSrcDir>
<jsTestSrcDir>${project.basedir}/src/test/javascript/specs</jsTestSrcDir>
<customRunnerConfiguration>
${project.basedir}/src/test/javascript/config.txt
</customRunnerConfiguration>
<!-- Makes output terser -->
<format>progress</format>
<additionalContexts>
<!-- If context roots start with a / the resource will be available on the server at //root. -->
<!-- It is an error for context roots to end with a /. -->
<context>
<contextRoot>fixtures</contextRoot>
<directory>${project.build.directory}/jasmine/fixtures</directory>
</context>
</additionalContexts>
</configuration>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>${maven-dependency-plugin.version}</version>
<executions>
<execution>
<id>prep-server</id>
<phase>process-test-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>brooklyn-rest-api</artifactId>
<classifier>tests</classifier>
<version>${brooklyn.version}</version>
<overWrite>true</overWrite>
<outputDirectory>${project.build.directory}/jasmine</outputDirectory>
</artifactItem>
</artifactItems>
<includes>fixtures/*</includes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven-war-plugin.version}</version>
<configuration>
<useCache>true</useCache> <!-- to prevent replaced files being overwritten -->
<!-- Insert special LICENSE/NOTICE into the <war>/META-INF folder -->
<webResources>
<webResource>
<targetPath>META-INF</targetPath>
<directory>${basedir}/src/main/license/files</directory>
</webResource>
</webResources>
</configuration>
</plugin>
<!-- Disable the automatic LICENSE/NOTICE placement from the upstream pom, because we need to include
bundled dependencies. See "webResources" section above for where we include the new LICENSE/NOTICE -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-remote-resources-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
<configuration>
<skip>true</skip>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
<configuration>
<excludes combine.children="append">
<!--
JavaScript code that is not copyright of Apache Foundation. It is included in NOTICE.
-->
<exclude>**/src/main/webapp/assets/js/libs/*</exclude>
<exclude>**/src/build/requirejs-maven-plugin/r.js</exclude>
<!--
Trivial Json controlling the build, "without any degree of creativity".
Json does not support comments, therefore far easier to just omit the license header!
-->
<exclude>**//src/build/optimize-css.json</exclude>
<exclude>**//src/build/optimize-js.json</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<profiles>
<profile>
<id>nodejs-path-override</id>
<activation>
<os><family>linux</family></os>
</activation>
<properties>
<nodejs.path>${project.basedir}/src/build/nodejs</nodejs.path>
</properties>
<dependencies>
<dependency>
<groupId>com.github.skwakman.nodejs-maven-binaries</groupId>
<artifactId>nodejs-maven-binaries</artifactId>
<version>${nodejs-maven-binaries.version}</version>
<classifier>linux-x64</classifier>
<type>zip</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>${maven-dependency-plugin.version}</version>
<executions>
<execution>
<id>unpack-nodejs64</id>
<phase>prepare-package</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<includeGroupIds>com.github.skwakman.nodejs-maven-binaries</includeGroupIds>
<includeArtifactIds>nodejs-maven-binaries</includeArtifactIds>
<outputDirectory>
${project.basedir}/target/nodejs64/
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>Optimize resources</id>
<activation>
<property>
<name>!skipOptimization</name>
</property>
</activation>
<build>
<plugins>
<!-- Installs node.js in target/. Means we get the benefits of node's speed
(compared to Rhino) without having to install it manually. -->
<plugin>
<groupId>com.github.skwakman.nodejs-maven-plugin</groupId>
<artifactId>nodejs-maven-plugin</artifactId>
<version>${nodejs-maven-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>extract</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- target directory for node binaries -->
<targetDirectory>${project.basedir}/target/nodejs/</targetDirectory>
</configuration>
</plugin>
<!-- Including the exploded goal means sources are in place ready for the replacer plugin. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven-war-plugin.version}</version>
<executions>
<execution>
<id>prepare-war</id>
<phase>prepare-package</phase>
<goals>
<goal>exploded</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Runs the require.js optimizer with node to produce a single artifact. -->
<plugin>
<groupId>com.github.mcheely</groupId>
<artifactId>requirejs-maven-plugin</artifactId>
<version>${requirejs-maven-plugin.version}</version>
<executions>
<execution>
<id>optimize-js</id>
<phase>prepare-package</phase>
<goals>
<goal>optimize</goal>
</goals>
<configuration>
<configFile>${project.basedir}/src/build/optimize-js.json</configFile>
</configuration>
</execution>
<execution>
<id>optimize-css</id>
<phase>prepare-package</phase>
<goals>
<goal>optimize</goal>
</goals>
<configuration>
<configFile>${project.basedir}/src/build/optimize-css.json</configFile>
</configuration>
</execution>
</executions>
<configuration>
<nodeExecutable>${nodejs.path}</nodeExecutable>
<optimizerFile>${project.basedir}/src/build/requirejs-maven-plugin/r.js</optimizerFile>
<!-- Replaces Maven tokens in the build file with their values -->
<filterConfig>true</filterConfig>
</configuration>
</plugin>
<!-- Modify index.html to point to the optimized resources generated above. -->
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<version>${maven-replacer-plugin.version}</version>
<executions>
<execution>
<id>modify-for-optimized</id>
<phase>prepare-package</phase>
<goals>
<goal>replace</goal>
</goals>
</execution>
</executions>
<configuration>
<file>${project.build.webapp}/index.html</file>
<replacements>
<replacement>
<token>assets/js/config.js</token>
<value>assets/js/gui.all.min.js</value>
</replacement>
<replacement>
<token>assets/css/styles.css</token>
<value>assets/css/styles.min.css</value>
</replacement>
<replacement>
<token>GIT_SHA_1</token>
<value>${buildNumber}</value>
</replacement>
</replacements>
</configuration>
</plugin>
<!-- Compress the minified files. Jetty will serve the gzipped content instead. -->
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>Compress resources</id>
<phase>prepare-package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<gzip src="${project.build.webapp}/assets/css/styles.min.css" destfile="${project.build.webapp}/assets/css/styles.min.css.gz" />
<gzip src="${project.build.webapp}/assets/css/brooklyn.css" destfile="${project.build.webapp}/assets/css/brooklyn.css.gz" />
<gzip src="${project.build.webapp}/assets/js/gui.all.min.js" destfile="${project.build.webapp}/assets/js/gui.all.min.js.gz" />
<gzip src="${project.build.webapp}/assets/js/libs/require.js" destfile="${project.build.webapp}/assets/js/libs/require.js.gz" />
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>