Spring boot Angular Application project runs compiled html... how do I 'recompile' - java

Setting: I inherited a project that I need to update the UI for
I have a spring boot application that has an angular front end.
If I make UI changes in the front end, code at src/main/web/, they do not appear in the application that launches when I run mvn spring-boot:run
The application refers to files in the src/main/resources/static/ instead. This folder seems to contain 'compiled` front end scripts.
Question
I am trying to recompile src/main/web/ files into the src/main/resources/static/, how do I do that?
Notes
I have tried
bower install
npm install
mvn install
mvn clean
They have grunt here. Running the grunt serve command will show my updated front end files, this, in a sense "works", but mvn spring boot runs the full application and it is necessary that this command works.
An ls of the main directory shows:
Gruntfile.js bower_components package-lock.json pom.xml src
README.md package.json swagger.json
bower.json node_modules packageOld.json target

The code is being compiled by grunt, not bower or npm or mvn.
grunt clean build

Related

Spring boot basic guide: How to create complete folder?

I'm creating basic spring boot application as in this guide
If I download their completed-guide-code, I get the complete folder to run and test app.
But if I do practice as start from scratch, install prequisite, go to start.spring.io and config, generate starting project, create web app, create app class, and go to step Run the Application, I cannot find the folder complete as in guide, so I can't run and test app. Maybe I should run some build command to create it? So how to create it?
Please just run mvn spring-boot:run (use mvnw if maven is not installed or not on path. Spring boot project contains mvnw executable) in the project root without the directory specifier.
./ could be used for unix like systems but not windows.
complete folder is just the root project name in the guide. In your case, the root project name is spring-boot, go to spring-boot directory and run ./mvnw spring-boot:run.

Best approach to maven project-specific scripts?

In npm we have the option to define project specific scripts in the package.json file as described here.
What is the best tool/approach to this with maven? I'd like a way to write cross-platform, reproducible scripts with minimal setup.
Example scripts and the raw commands:
Build the project into a JAR file, skipping tests, and then deploy as part of a docker-compose deployment
mvn package -Dmaven.test.skip=true
docker-compose up --build -d
Rebuild and replace the running container in the docker-compose deployment
mvn package -Dmaven.test.skip=true
docker-compose up -d --no-deps --build spring
Build the project and run tests without deploying
mvn clean install
These commands can be a pain to remember and this is a project that will be used by many students with limited maven and docker experience. So a tool that's easy to install and makes creating scripts that 'just work' when pulling the repository would be great.

Deploy maven multi module project in GC

I'm new to google cloud and I need to deploy my java application there.
Currently it consists of 1 one web-module and directory structure looks like this:
clinic_project
acms-frontend
pom.xml
pom.xml
And start script:
#!/bin/bash
nohup mvn clean install
serv=acms-frontend
cd $serv
nohup mvn spring-boot:run -Dspring.profiles.active="dev" -DAUTH0_CLIENT_ID=".." -DAUTH0_CLIENT_SECRET=".." -DACMS_CRYPTO_KEY=".." -DACMS_NODE_NAME="n/a" -DACMS_POD_IP="n/a" -DACMS_POD_NAMESPACE="n/a" -DACMS_POD_NAME="n/a"
Inside web-module I have .yml file with default port and other variables.
I've installed gcloud SDK and understand how I can deploy single module application.
But how can I tell google cloud to deploy my multi-module project with commands sequence from script?
If you want to deploy multiple modules, you can do so with the following command: gcloud app deploy ~/my_app/app.yaml ~/my_app/another_service.yaml as mentioned in the gcloud app deploy documentation examples.
Make sure to add the module/service name in the app.yaml files as mentioned in this other document, otherwise you may run into some naming issues with them.
Hope you find this useful!

Java Spring-boot: Problem to finde resources

I have a Spring-boot backend Angular front end application. The application runs well if it is run on port 4200 (Running frontend from the front end). But I have done the integration an I run in to troubles. The application after the following commands:
mvn clean install
npm install
npm build
Properly generate the dist folder on the front end and copy them in the source folder (project/src/main/resources/static).
When I try to run the application from the back end (definded port 8999) the application finde the index.html file in static folder but cannot find the other scripts. The application start looking for those resources on localhost:8999/resourcefile
instead of looking for it in
localhost:8999/src/main/resources/static
Do anyone have any idea?
For anyone with the same problem. There was declared
<base href="/">
in my index.html and that's why it was looking for resources from the wrong directory.

How to use grunt-maven-plugin with cloudbees?

Actually I already have application with java as a backend and backbonejs app as frontend. Both are completely separate. Now I have introduced grunt tasks in my front end which I need to be executed before packaging war file. So that packaged war files have files generated by grunt task.
Locally I can execute grunt tasks from maven.
But for deployment we have been using cloudbees. I tried searching on internet but I haven't got any solution. Though I have gone through a question "How do I get a grunt task working with a Cloudbees Jenkins build" and also through documentation but still I am clueless.
My guess is I need to run grunt tasks post build as a shell script.
So how to setup node.js environment for existing maven project on cloudbees?
This is what I do to run grunt - I have it located in a script bin/build-ci
Call the script below from a shell build step in Jenkins
If you are running grunt commands, then they need to be run in the same build step as the environment is manipulated (and these changes are not carried from one step to the next).
# This script is normally in a ./bin/ subdirectory, so we grab BASEDIR as the parent
BASEDIR=`dirname $0`/..
curl -s -o use-node https://repository-cloudbees.forge.cloudbees.com/distributions/ci-addons/node/use-node
NODE_VERSION=0.10.18 . ./use-node
# Make sure grunt and grunt-cli are in your package.json manifest
npm install
export PATH=$BASEDIR/node_modules/.bin:$PATH
grunt

Categories