Maven Build#

Mit dem Plugin "frontend-maven-plugin" kann ein WAR-File gebaut werden:
<?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/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.intersult</groupId>
	<artifactId>reactjs-test</artifactId>
	<version>1.0-SNAPSHOT</version>
	<packaging>war</packaging>
    <name>${project.artifactId}</name>
	<description>ReactJS Test</description>
	
	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	</properties>
	
	<build>
		<finalName>${project.artifactId}</finalName>
		<plugins>
            <plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <version>1.12.1</version>
                <executions>
                    <execution>
                        <id>install-node-and-npm</id>
                        <goals>
                            <goal>install-node-and-npm</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>npm-install</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>npm-build</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <configuration>
                            <arguments>run build</arguments>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <nodeVersion>v18.8.0</nodeVersion>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.3.2</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    <webResources>
                        <resource>
                            <directory>build</directory>
                        </resource>
                    </webResources>
                </configuration>
            </plugin>
		</plugins>
	</build>
</project>

NodeJS Build#

Jenkins kann auch native NodeJS Befehle ausführen. Das Plugin NodeJS unterstützt sowohl Standard-Builds als auch die Build-Pipeline.