Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Maven project definition for NodeJS deployable project.
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.acme.test</groupId>
<artifactId>nodejs-test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>nodejs-test</name>
<description>NodeJS Test Project</description>
<packaging>jar</packaging>
<properties>
</properties>
<organization>
<name>A.C.M.E.</name>
</organization>
<scm>
<developerConnection>scm:git:git@git.acme.local:nodejs-test.git</developerConnection>
</scm>
<build>
<finalName>${project.name}</finalName>
<sourceDirectory>modules</sourceDirectory>
<testSourceDirectory>test</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<configuration>
<tasks>
<!--
SCM doesn't contain dependencies, so we need to install them
they are placed locally in node_modules folder
private dependencies are extracted using maven-dependency-plugin
-->
<echo message="========== installing public dependencies ===================" />
<exec executable="npm" dir="${project.basedir}" failonerror="true">
<arg value="install" />
</exec>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
<execution>
<id>test</id>
<phase>test</phase>
<configuration>
<tasks>
<!--
runs tests and exports results in specified location so Jenkins can find them
doesn't fail on error because we want Jenkins to pick up failed tests
-->
<echo message="========== running tests with JUnit compatible results ===================" />
<exec executable="node_modules/nodeunit/bin/nodeunit" dir="${project.basedir}" failonerror="false">
<arg value="--reporter" />
<arg value="junit" />
<arg value="test/" />
<arg value="--output" />
<arg value="target/failsafe-reports" />
</exec>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>unpack</id>
<phase>compile</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.basedir}/node_modules</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
<useSubDirectoryPerArtifact>true</useSubDirectoryPerArtifact>
<includeGroupIds>org.acme.test</includeGroupIds>
<stripVersion>true</stripVersion>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>make-zip-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>${project.name}-${project.version}</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>assembly-zip.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.acme.test</groupId>
<artifactId>nodejs-dependency</artifactId>
<version>0.0.1</version>
<type>zip</type>
</dependency>
</dependencies>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment