Update your project’s pom.xml

In the <build><plugins> section, add the following configuration:

<!-- Gulp Frontend -->
<plugin>
    <groupId>com.github.eirslett</groupId>
    <artifactId>frontend-maven-plugin</artifactId>
    <version>1.6</version>

    <configuration>
        <workingDirectory>src/main/frontend</workingDirectory>
        <environmentVariables>
            <!-- Avoid certificates issues, needed behind a corporate proxy -->
            <NODE_TLS_REJECT_UNAUTHORIZED>0</NODE_TLS_REJECT_UNAUTHORIZED>
        </environmentVariables>
    </configuration>

    <executions>
        <execution>
            <id>install node and yarn</id>
            <goals>
                <goal>install-node-and-yarn</goal>
            </goals>
            <configuration>
                <nodeVersion>v8.9.3</nodeVersion>
                <yarnVersion>v1.3.2</yarnVersion>
            </configuration>
        </execution>

        <execution>
            <id>yarn install</id>
            <goals>
                <goal>yarn</goal>
            </goals>
            <configuration>
                <arguments>install --dist-url="${maven-frontend.nodeDownloadRoot}"</arguments>
            </configuration>
        </execution>

        <execution>
            <id>yarn build</id>
            <goals>
                <goal>yarn</goal>
            </goals>
            <configuration>
                <arguments>run build</arguments>
            </configuration>
        </execution>
    </executions>
</plugin>
<!-- End Gulp Frontend -->

As you can see, we prefer to use Yarn in this configuration as it’s faster than NPM. Both are are interchangeable in that matter, you can choose the one you prefer.

package.json

in src/main/frontend/package.json add:

{
  "name": "maven-frontend",
  "version": "1.0.0",
  "scripts": {
    "run": "crafty run",
    "watch": "crafty watch"
  }
}

.gitignore

add this to your .gitignore

# Frontend plugins
src/main/frontend/node/**
src/main/frontend/node_modules/**

This applies to Mercurial as well, but the file name would be .hgignore

Next

The next step is to add your presets and bundles