blob: b44306f0728213e5b3c7bcf10673e61c83fb8b80 [file] [log] [blame]
<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>io.brooklyn</groupId>
<artifactId>brooklyn-parent</artifactId>
<version>0.6.0</version><!-- BROOKLYN_VERSION -->
<relativePath>../../pom.xml</relativePath>
</parent>
<properties>
<maven-replacer-plugin.version>1.5.2</maven-replacer-plugin.version>
<nodejs-maven-plugin.version>1.0.3</nodejs-maven-plugin.version>
<jasmine-maven-plugin.version>1.2.0.0</jasmine-maven-plugin.version>
<!-- see comment about fixtures below
<jasmine-maven-plugin.version>1.3.1.2</jasmine-maven-plugin.version>
-->
<requirejs-maven-plugin.version>2.0.0</requirejs-maven-plugin.version>
<!-- The maven-war-plugin 2.1+ and the replacer plugin don't work well together. -->
<maven-war-plugin.version>2.0.2</maven-war-plugin.version>
<project.build.webapp>
${project.build.directory}/${project.build.finalName}
</project.build.webapp>
</properties>
<dependencies>
<dependency>
<groupId>io.brooklyn</groupId>
<artifactId>brooklyn-rest-server</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.brooklyn</groupId>
<artifactId>brooklyn-rest-server</artifactId>
<version>${project.version}</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>brooklyn-test-support</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.brooklyn</groupId>
<artifactId>brooklyn-policy</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.brooklyn</groupId>
<artifactId>brooklyn-locations-jclouds</artifactId>
<version>${brooklyn.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.brooklyn</groupId>
<artifactId>brooklyn-software-webapp</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.brooklyn</groupId>
<artifactId>brooklyn-software-database</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.brooklyn</groupId>
<artifactId>brooklyn-software-nosql</artifactId>
<version>${project.version}</version>
<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>
<plugins>
<!-- run js tests with: $ mvn clean process-resources jasmine:test -->
<!--
The Jasmine Maven plugin is now on version 1.3.1.0. It has several improvements,
but we're unable to upgrade to it because of a change to the way it handles our
fixtures. In 1.2 it serves target/fixtures at /fixtures. This no longer happens
in 1.3.1. Ideally, the plugin would have a configuration option to include other
directories for Jetty to serve. If this were added we would also be able to use
mvn jasmine:bdd.
-->
<plugin>
<groupId>com.github.searls</groupId>
<artifactId>jasmine-maven-plugin</artifactId>
<version>${jasmine-maven-plugin.version}</version>
<!-- avoid double phase executions https://github.com/searls/jasmine-maven-plugin/pull/54 -->
<extensions>true</extensions>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<!--Uses the require.js test spec-->
<specRunnerTemplate>REQUIRE_JS</specRunnerTemplate>
<scriptLoaderPath>js/libs/require.js</scriptLoaderPath>
<!--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>
</configuration>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</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>
</plugins>
</build>
<profiles>
<profile>
<id>Optimise 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>
<!-- Runs the require.js optimiser 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>Optimise javascript</id>
<goals>
<goal>optimize</goal>
</goals>
<configuration>
<configFile>${project.basedir}/src/main/resources/optimise-javascript.build.js</configFile>
</configuration>
</execution>
<execution>
<id>Concatenate CSS files</id>
<goals>
<goal>optimize</goal>
</goals>
<configuration>
<configFile>${project.basedir}/src/main/resources/optimise-css.build.js</configFile>
</configuration>
</execution>
</executions>
<configuration>
<nodeExecutable>${project.basedir}/target/nodejs/node</nodeExecutable>
<optimizerFile>${project.basedir}/src/main/resources/r.js</optimizerFile>
<!-- Replaces Maven tokens in the build file with their values -->
<filterConfig>true</filterConfig>
</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>
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<version>${maven-replacer-plugin.version}</version>
<executions>
<execution>
<id>Use optimised resources in index.html</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.min.js</value>
</replacement>
<replacement>
<token>assets/css/styles.css</token>
<value>assets/css/styles.min.css</value>
</replacement>
</replacements>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>