mvn install -P docker-buld-image is not producing an updated jar file after changes

Viewed 23

I have a Spring project to which I have made two very basic changes:

  1. logger.info("testing changes made");
  2. return new ResponseEntity<>(HttpStatus.NO_CONTENT); //previously HttpStatus.OK

I then:

  1. git committed the changes (not really necessary)
  2. mvn clean install -P docker-build-image
  3. docker tag my-service:old-tag my-service:new-tag

I then used this image to install the service in a kubernetes pod as follows:

echo " deploying auth service"
helm uninstall auth
kubectl delete pod -l app.kubernetes.io/name=auth
kind load docker-image my-service:new-tag
helm install auth ./auth --wait

The trouble is: I am never getting any changes. I only see the output from the old version of the application.

What is going on here? This is very strange to me. This feels very much like a maven|docker plugin kind of problem. Or, is it a kubernetes|kind|helm problem?

2 Answers

mvn install will just install the package.

You should do mvn package before install to make new jar file.

The problem I was experiencing resulted from the docker-building module was using an old snapshot to build the docker image. The wrong dependency was being used in the POM file of that module. I changed the dependency and everything worked just fine.

Related