Skip to content

Instantly share code, notes, and snippets.

@anfibiacreativa
Created July 12, 2019 17:02
Show Gist options
  • Save anfibiacreativa/f948abf3bc912830f063b75376580744 to your computer and use it in GitHub Desktop.
Save anfibiacreativa/f948abf3bc912830f063b75376580744 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<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>
<name>Our Multitenant Project: Build Reactor POM</name>
<groupId>[SOME-ID]</groupId>
<artifactId>[SOME-OTHER-ID]</artifactId>
<version>[SOME-VERSION]</version>
<packaging>pom</packaging>
<parent>
<groupId>[SOME-GROUP-ID]</groupId>
<artifactId>cq-parent</artifactId>
<version>[SOME-VERSION]</version>
</parent>
<properties>
<revision>[SOME-VERSION-SNAPSHOT]</revision>
<java.version>1.8</java.version>
// more blah blah here
<!-- FE-build -->
<frontend.build.directory>./frontend</frontend.build.directory>
<npm.arguments>install --ignore-scripts</npm.arguments>
<npm.arguments.build>run build</npm.arguments.build>
<npm.arguments.sass>rebuild node-sass</npm.arguments.sass>
<npm.env.moduleBaseDir>${basedir}</npm.env.moduleBaseDir>
<node.env>production</node.env>
<node.version>v10.11.0</node.version>
<npm.version>6.4.1</npm.version>
// even more blah blah
</properties>
<modules>
<module>frontend</module>
<module>components</module>
<module>config</module>
<module>tenants</module>
<module>test-content</module
<module>complete</module>
// etc
</modules>
// dependencies and all those things
<build>
// it's important that you define it under pluginManagement!
// it is the only way you can inherit it to the rest of poms!
<pluginManagement>
<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.6</version>
<configuration>
<workingDirectory>${frontend.build.directory}</workingDirectory>
</configuration>
<executions>
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<configuration>
<nodeVersion>${node.version}</nodeVersion>
<npmVersion>${npm.version}</npmVersion>
<nodeDownloadRoot>https://nodejs.org/dist/</nodeDownloadRoot>
</configuration>
</execution>
<execution>
<id>run frontend-setup</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>${npm.arguments}</arguments>
</configuration>
</execution>
<execution>
<id>rebuild node-sass</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>${npm.arguments.sass}</arguments>
</configuration>
</execution>
</executions>
</plugin>
// probably more plugins here!
</plugins>
</pluginManagement>
</build>
<profiles>
<profile>
<!-- Activate node installation and npm install on non-root triggered builds. For root triggered builds,
frontend module takes care of node initialization -->
<id>frontend submodule build config</id>
<activation>
<file>
<missing>${user.dir}/base</missing>
</file>
</activation>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<configuration>
<workingDirectory>${frontend.build.directory}</workingDirectory>
</configuration>
<executions>
<execution>
<id>frontend-setup :: bootstrap</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<configuration>
<nodeVersion>${node.version}</nodeVersion>
<npmVersion>${npm.version}</npmVersion>
<nodeDownloadRoot>https://nodejs.org/dist/</nodeDownloadRoot>
</configuration>
</execution>
<execution>
<id>frontend-setup :: install dependencies</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>${npm.arguments}</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
<!-- Skips installation of Node, NPM and npm install -->
<profile>
<id>skip-node-npm-install</id>
<build>
<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<executions>
<execution>
<id>install node and npm</id>
<phase>none</phase>
</execution>
<execution>
<id>run frontend-setup</id>
<phase>none</phase>
</execution>
<execution>
<id>rebuild node-sass</id>
<phase>none</phase>
</execution>
<execution>
<id>frontend-setup :: bootstrap</id>
<phase>none</phase>
</execution>
<execution>
<id>frontend-setup :: install dependencies</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment