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.
Asked
Active
Viewed 784 times
1 Answers
2
I've done something similar with a Vue and Dropwizard based project, set up like so:
- front end project included in the maven structure under a
client
directory/module client
pom uses the maven exec plugin to run a frontend build (npm
in my case, butgrunt
/gulp
/yarn
/whatever would work too) during thecompile
phase of the buildclient
pom uses the maven resources plugin tocopy-resources
from the frontend build output directory (dist
) to a target output subdirectory (${project.build.outputDirectory}/assets
) during theprepare-package
phase of the buildclient
pom uses the maven jar plugin tojar
the output directory during thepackage
phase of the build- dropwizard module depends on the
client
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.

Joe
- 607
- 6
- 13
-
Yes that seems like the best solution using Maven i think. Wish there was some native support in Maven to work with Angular front end projects. Thanks for this Joe! – javshak Sep 16 '20 at 20:57