Вы можете сделать это с помощью maven, создав плагин сборки для выполнения сборки приложения angular. Плагины сборки будут выполняться во время сборки, и они должны быть настроены в элементе из POM.
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>npm install</id>
<goals>
<goal>exec</goal>
</goals>
<phase>install</phase>
<configuration>
<executable>npm</executable>
<arguments>
<argument>install</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>npm build</id>
<goals>
<goal>exec</goal>
</goals>
<phase>install</phase>
<configuration>
<executable>npm</executable>
<arguments>
<argument>run</argument>
<argument>build</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Важно, чтобы вы уже установили node js, npm ранее. В противном случае сборка maven не удастся, потому что не найдет среду, нужную для запуска сборки приложения angular.
После этого мы изменим плагин maven-war-plugin. В качестве каталога, который мы укажем ниже, будет каталог angular app in war, созданный сборкой maven.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<webResources>
<resource>
<targetPath>resources</targetPath>
<filtering>false</filtering>
<!-- this is relative to the pom.xml directory -->
<directory>../path when you want to put angular app /dist/</directory>
<includes>
<include>**/*.*</include>
</includes>
</resource
</webResources>
</configuration>
</plugin>