2. Implementation
example node.js (angular) project is located in src/main/js
directory
plugion configuration
<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">
<build>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>${frontend-maven-plugin.version}</version>
<executions>
<execution>
<id>install node and npm</id>
<phase>process-resources</phase>
<goals>
<goal>install-node-and-npm</goal>
</goals>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>install</arguments>
</configuration>
<phase>process-resources</phase>
</execution>
<execution>
<id>npm run build</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>run build</arguments>
</configuration>
<phase>process-resources</phase>
</execution>
</executions>
<configuration>
<workingDirectory>src/main/js</workingDirectory>
<installDirectory>target</installDirectory>
<npmVersion>${frontend-maven-plugin.npmVersion}</npmVersion>
<nodeVersion>${frontend-maven-plugin.nodeVersion}</nodeVersion>
</configuration>
</plugin>
</plugins>
<defaultGoal>process-resources</defaultGoal>
</build>
</project>
3. Test usage
build fat jar
./mvnw clean package
run app
npx serve ./src/main/resources/public/
open http://127.0.0.1:3000/
using docker plugin
./mvnw clean package ./mvnw docker-compose:up -P docker ./mvnw docker-compose:down -P docker