Here's a bit of a strange question : I have an Angular project that talks to a Restful Java application. I was looking for help to package it as a Maven webapp project which can then generate/build a WAR file. Is that something that can me done easily in Maven? So far I created a bare bones app using the 'maven-archetype-webapp' archtype but not entirely sure if the Angular will play nice. The goal was to take the Angular UI and deploy it on some legacy servers (like GlassFish, IBM Websphere AS 9.0 etc.) so that it works like a regular client application. Any help is greatly appreciated.
I've done something similar with a Vue and Dropwizard based project, set up like so:
client
directory/moduleclient
pom uses the maven exec plugin to run a frontend build (npm
in my case, but grunt
/gulp
/yarn
/whatever would work too) during the compile
phase of the buildclient
pom uses the maven resources plugin to copy-resources
from the frontend build output directory (dist
) to a target output subdirectory (${project.build.outputDirectory}/assets
) during the prepare-package
phase of the buildclient
pom uses the maven jar plugin to jar
the output directory during the package
phase of the buildclient
jar, and uses AssetsBundle to serve the frontend app at /assets
The details may differ slightly based on the best way to serve assets under Glassfish/Websphere/etc and the angular build process, but the above approach should be adaptable to those details.