Я использую Spring Framework для размещения приложения React (https://github.com/TheInformationLab/Tableau-Extension-ExportAll). У меня нет никакого внутреннего кода, я просто использую Spring Framework.
<?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>
<groupId>com.company.exportall</groupId>
<artifactId>exportall</artifactId>
<packaging>war</packaging>
<version>1.0.1-SNAPSHOT</version>
<name>${project.artifactId}</name>
<parent>
<groupId>com.company.parents.pom</groupId>
<artifactId>war-common-pom</artifactId>
<version>4.0.0</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<spring.version>4.3.18.RELEASE</spring.version>
</properties>
<dependencies>
<!-- Spring framework -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.9.1</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
<configuration>
<webXml>src/main/webapp/WEB-INF/web.xml</webXml>
<warSourceExcludes>node_modules/**</warSourceExcludes>
</configuration>
</plugin>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.6</version>
<configuration>
<nodeVersion>v12.16.1</nodeVersion>
<npmVersion>6.13.4</npmVersion>
<workingDirectory>src/main/webapp/frontend</workingDirectory>
<!-- <workingDirectory>frontend</workingDirectory>-->
<installDirectory>target</installDirectory>
</configuration>
<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>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>Build frontend</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>run build</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>Copy frontend build to target</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/classes/resources</outputDirectory>
<resources>
<resource>
<directory>${basedir}/src/main/webapp/frontend/build</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Моя структура папок:
src
-test
-main
-java
-resources
-export.mvc.spring.xml
-webapp
-Web-INF
-web.xml
-frontend // clone from the github
-src
-public
-package.json
-ExportAll.trex
-yarn.lock
Я запускаю mvn clean install
и использую -T100
. И то, и другое занимает более 35 минут, и я думаю, что это не должно занять много времени, так как это просто сборка и установка npm.