Spring Boot Gradle bootBuildImage task with private repo - spring-boot

I'm trying to set up a Spring Boot / Gradle project to use bootBuildImage to build my Docker image, but am hitting a snag. We have limited external network access on our build servers; we use a private nexus repository.
When I try to run the bootBuildImage task, it's attempting to request a file from repo.spring.io:
[creator] unable to invoke layer creator
[creator] unable to contribute spring-cloud-bindings layer
[creator] unable to get dependency spring-cloud-bindings
[creator] unable to download https://repo.spring.io/release/org/springframework/cloud/spring-cloud-bindings/1.7.0/spring-cloud-bindings-1.7.0.jar
[creator] unable to request https://repo.spring.io/release/org/springframework/cloud/spring-cloud-bindings/1.7.0/spring-cloud-bindings-1.7.0.jar
I have repo.spring.io added as a repository on our nexus server, but I'm unclear on how to get the Spring Boot Gradle plugin to use it. I tried adding it to my repositories block, but it didn't seem to have an effect.
repositories {
// Other repositories...
//
maven {
url "<my nexus server>/repository/spring-io-releases/"
}
What am I missing?

I had a similar problem where I needed to configure the download uri of the bellsoft-liberica JDK used inside the Spring Boot build image goal/task to not use github.com - but my own private server instead. It cannot be done with buildpack environment variable alone, but you can use bindings for that!
Please note that with the Spring Boot Gradle Plugin or Spring Boot Maven Plugin it requires Spring Boot 2.5+ (a bindings option has been added in 2.5). If you're on an older Spring Boot release, you need to either upgrade or switch over to pack CLI.
Bindings can be configured either through volumes or Kubernetes secrets. I created a fully comprehensible guide on how to use bindings in order to change a uri used inside a buildpack - but I will outline the key steps for switching the spring-cloud-bindings-x.y.z.jar uri:
1. Create bindings directory
In order to hand over the binding configuration to pack CLI we need to create a directory first:
mkdir spring-cloud-config && cd spring-cloud-config
2. Create file type, containing the binding key
Now we need to create a file called type inside this directory containing the binding key for the spring-boot buildpack binding type dependency-mapping:
echo "dependency-mapping" >> type
3. Create file named as the sha256, containing the spring-cloud-bindings-x.y.z.jar uri
Now we should create another file named exactly according to the sha256 digest value of the [[metadata.dependencies]] section of the spring-cloud-bindings-1.7.0.jar inside the buildpack.toml:
[[metadata.dependencies]]
id = "spring-cloud-bindings"
name = "Spring Cloud Bindings"
version = "1.7.0"
uri = "https://repo.spring.io/release/org/springframework/cloud/spring-cloud-bindings/1.7.0/spring-cloud-bindings-1.7.0.jar"
sha256 = "e3c18bf1a3c2e52743f9ff2fa46af59e5eee0a7f0683ff562eb35aa866e4a9e9"
stacks = [ "io.buildpacks.stacks.bionic", "org.cloudfoundry.stacks.cflinuxfs3" ]
This file must contain the uri of your internal nexus incl. the spring-cloud-bindings.jar:
echo "http://<my nexus server>/repository/spring-io-releases/org/springframework/cloud/spring-cloud-bindings/1.7.0/spring-cloud-bindings-1.7.0.jar" >> e3c18bf1a3c2e52743f9ff2fa46af59e5eee0a7f0683ff562eb35aa866e4a9e9
4. Execute pack CLI with --volume to use the binding
Finally we can issue our pack CLI command. Ensure that pack CLI is installed on your system:
pack build your-application-name-here \
--path . \
--volume $(pwd)/spring-cloud-config:/platform/bindings/spring-cloud-config \
--builder paketobuildpacks/builder:base
Alternatively, you can use the bindings option with Spring Boot 2.5+ Maven or Gradle plugins, see links above.
Now the spring-boot buildpack will download the spring-cloud-bindings-1.7.0.jar from http://<my nexus server>/repository/spring-io-releases/org/springframework/cloud/spring-cloud-bindings/1.7.0/spring-cloud-bindings-1.7.0.jar instead of https://repo.spring.io/release.

The bootBuildImage Gradle task uses Paketo Buildpacks to build your OCI container. There are a bunch of buildpacks participating in the creation of the container, one of them is the Spring Boot Buildpack. Among other things, the Spring Boot Buildpack will add Spring Cloud Bindings to the application classpath:
[creator] Spring Cloud Bindings 1.7.0: Contributing to layer
[creator] Downloading from https://repo.spring.io/release/org/springframework/cloud/spring-cloud-bindings/1.7.0/spring-cloud-bindings-1.7.0.jar
[creator] Verifying checksum
[creator] Copying to /layers/paketo-buildpacks_spring-boot/spring-cloud-bindings
This all happens inside the build container and the buildpack is not aware of your Gradle repositories. The dependency URL is defined in the buildpack itself:
[[metadata.dependencies]]
id = "spring-cloud-bindings"
name = "Spring Cloud Bindings"
version = "1.7.0"
uri = "https://repo.spring.io/release/org/springframework/cloud/spring-cloud-bindings/1.7.0/spring-cloud-bindings-1.7.0.jar"
sha256 = "e3c18bf1a3c2e52743f9ff2fa46af59e5eee0a7f0683ff562eb35aa866e4a9e9"
stacks = [ "io.buildpacks.stacks.bionic", "org.cloudfoundry.stacks.cflinuxfs3" ]
Using the environment variable BPL_SPRING_CLOUD_BINDINGS_ENABLED, you can disable autoconfiguring Spring Boot environment properties from bindings, but the jar file will be pulled anyway.
bootBuildImage {
environment = ["BPL_SPRING_CLOUD_BINDINGS_ENABLED" : "false"]
}

I started getting this error now on spring-cloud-bindings-1.7.1 but in the past it worked:
...
[INFO] [creator] Paketo Spring Boot Buildpack 4.2.0
[INFO] [creator] https://github.com/paketo-buildpacks/spring-boot
[INFO] [creator] Creating slices from layers index
[INFO] [creator] dependencies
[INFO] [creator] spring-boot-loader
[INFO] [creator] snapshot-dependencies
[INFO] [creator] application
[INFO] [creator] Launch Helper: Contributing to layer
[INFO] [creator] Creating /layers/paketo-buildpacks_spring-boot/helper/exec.d/spring-cloud-bindings
[INFO] [creator] Spring Cloud Bindings 1.7.1: Contributing to layer
[INFO] [creator] Downloading from https://repo.spring.io/release/org/springframework/cloud/spring-cloud-bindings/1.7.1/spring-cloud-bindings-1.7.1.jar
[INFO] [creator] unable to invoke layer creator
[INFO] [creator] unable to contribute spring-cloud-bindings layer
[INFO] [creator] unable to get dependency spring-cloud-bindings
[INFO] [creator] unable to download https://repo.spring.io/release/org/springframework/cloud/spring-cloud-bindings/1.7.1/spring-cloud-bindings-1.7.1.jar
[INFO] [creator] unable to request https://repo.spring.io/release/org/springframework/cloud/spring-cloud-bindings/1.7.1/spring-cloud-bindings-1.7.1.jar
...
Old log:
...
[INFO] [creator] Paketo Spring Boot Buildpack 4.2.0
[INFO] [creator] https://github.com/paketo-buildpacks/spring-boot
[INFO] [creator] Creating slices from layers index
[INFO] [creator] dependencies
[INFO] [creator] spring-boot-loader
[INFO] [creator] snapshot-dependencies
[INFO] [creator] application
[INFO] [creator] Launch Helper: Reusing cached layer
[INFO] [creator] Spring Cloud Bindings 1.7.1: Reusing cached layer
[INFO] [creator] Web Application Type: Contributing to layer
[INFO] [creator] Servlet web application detected
[INFO] [creator] Writing env.launch/BPL_JVM_THREAD_COUNT.default
[INFO] [creator] 4 application slices
[INFO] [creator] Image labels:
[INFO] [creator] org.opencontainers.image.title
[INFO] [creator] org.opencontainers.image.version
[INFO] [creator] org.springframework.boot.spring-configuration-metadata.json
[INFO] [creator] org.springframework.boot.version
...
[INFO] [creator] *** Images (aafb789b0498):
[INFO] [creator] docker.io/library/cpo-process-registry:1.0.0
[INFO]
[INFO] Successfully built image 'docker.io/library/cpo-process-registry:1.0.0'

Related

How to get CodenameOne Maven Project Running in Netbeans

Thx to Steve for the CN1 ant to maven migration tool and video here. - Has anyone been able to run the Kitchen Sink project in Netbeans after migration? I follow the video instructions with the migration tool and migrate successfully and it runs from command line with ./run.sh but when I go to run it in NetBeans, I had a lot of 501 (https needed) errors. Added umer's code from here and that solved the 501 errors but now get:
Invalid POM for com.codenameone:codenameone-javase:jar:7.0.23, and
No implementation for org.codehaus.plexus.languages.java.jpms.LocationManager was bound.
while locating org.apache.maven.plugin.surefire.SurefirePlugin.
Note invalid POM warning...
------------------------------------------------------------------------
Building kitchensink-common 1.0-SNAPSHOT
------------------------------------------------------------------------
--- properties-maven-plugin:1.0.0:read-project-properties (default) # kitchensink-common ---
--- codenameone-maven-plugin:7.0.23:generate-gui-sources (generate-gui-sources) # kitchensink-common ---
The POM for com.codenameone:codenameone-javase:jar:7.0.23 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
Generating GUI sources
No GUI Entries available
Running from command line, invalid POM warning disappears:
[INFO] -----------< com.codename1.demos.kitchen:kitchensink-common >-----------
[INFO] Building kitchensink-common 1.0-SNAPSHOT [4/5]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- properties-maven-plugin:1.0.0:read-project-properties (default) # kitchensink-common ---
[INFO]
[INFO] --- codenameone-maven-plugin:7.0.23:generate-gui-sources (generate-gui-sources) # kitchensink-common ---
Generating GUI sources
No GUI Entries available
Running on apache-maven-3.8.1 on MacOSX
Java version: 1.8.0_172
Suggestions welcomed.
Thx, Mike
I think perhaps the method I'm using to detect the latest version of cn1 has issues. It picked 7.0.23 which was released this morning. But then it was unable to find some of the jars.
Probably it will work if you just try running the project again as it should be fully propagated to maven central now.
Problem was solved updating from Netbeans 8.2 to latest Netbeans version (currently 12.3).

Spring Boot 2.3.0 bootBuildImage fails

I have updated my project to use springboot 2.3.0 and trying to build docker image using the default springboot gradle task bootBuildImage.
The project is a simple rest project broken into two parts:- interface definition and interface implementation. All this while I was using Dockerfile to build the image but I am trying to experiment with the new feature.
I have not changed any configuration nor I have added any customizations. I am just it as plain vanilla task but getting the below issue.
DAREYOURDREAM-96TZ:tm-provisioning dareyourdream$ gradle bootBuildImage --scan
Picked up _JAVA_OPTIONS: -Xms1024m -Xmx8192m -XX:MaxPermSize=1024m
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=1024m; support was removed in 8.0
> Task :bootBuildImage
Building image 'docker.io/library/tm-provisioning:0.0.1-SNAPSHOT'
> Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' ..................................................
> Pulled builder image 'gcr.io/paketo-buildpacks/builder#sha256:200fb7945ef0f4a3c79befb1262fd592f54ba7b7ffcc8a37716434dd11d0e5e9'
> Pulling run image 'gcr.io/paketo-buildpacks/run:base-cnb' ..................................................
> Pulled run image 'gcr.io/paketo-buildpacks/run#sha256:f7f27462fb513a70370322ada08440a642d24a700056d4c6b8cbb344610bf486'
> Executing lifecycle version v0.7.5
> Using build cache volume 'pack-cache-defc64ac2d6d.build'
> Running creator
[creator] ---> DETECTING
[creator] 5 of 15 buildpacks participating
[creator] paketo-buildpacks/bellsoft-liberica 2.7.1
[creator] paketo-buildpacks/executable-jar 1.2.5
[creator] paketo-buildpacks/apache-tomcat 1.1.5
[creator] paketo-buildpacks/dist-zip 1.3.2
[creator] paketo-buildpacks/spring-boot 1.5.5
[creator] ---> ANALYZING
[creator] Previous image with name "docker.io/library/tm-provisioning:0.0.1-SNAPSHOT" not found
[creator] Skipping buildpack layer analysis
[creator] ---> BUILDING
[creator]
[creator] Paketo BellSoft Liberica Buildpack 2.7.1
[creator] Set $BPL_JVM_HEAD_ROOM to configure the headroom in memory calculation. Default 0.
[creator] Set $BPL_JVM_LOADED_CLASS_COUNT to configure the number of loaded classes in memory calculation. Default 35% of classes.
[creator] Set $BPL_JVM_THREAD_COUNT to configure the number of threads in memory calculation. Default 250.
[creator] Set $BP_JVM_VERSION to configure the Java version. Default 11.*.
[creator] BellSoft Liberica JRE 8.0.252: Contributing to layer
[creator] Downloading from https://github.com/bell-sw/Liberica/releases/download/8u252+9/bellsoft-jre8u252+9-linux-amd64.tar.gz
[creator] Verifying checksum
[creator] Expanding to /layers/paketo-buildpacks_bellsoft-liberica/jre
[creator] Writing env.launch/JAVA_HOME.override
[creator] Writing env.launch/MALLOC_ARENA_MAX.override
[creator] Writing profile.d/active-processor-count.sh
[creator] Memory Calculator 4.0.0: Contributing to layer
[creator] Downloading from https://github.com/cloudfoundry/java-buildpack-memory-calculator/releases/download/v4.0.0/memory-calculator-4.0.0.tgz
[creator] Verifying checksum
[creator] Expanding to /layers/paketo-buildpacks_bellsoft-liberica/memory-calculator
[creator] Writing profile.d/memory-calculator.sh
[creator] Class Counter: Contributing to layer
[creator] Copying to /layers/paketo-buildpacks_bellsoft-liberica/class-counter
[creator] JVMKill Agent 1.16.0: Contributing to layer
[creator] Downloading from https://github.com/cloudfoundry/jvmkill/releases/download/v1.16.0.RELEASE/jvmkill-1.16.0-RELEASE.so
[creator] Verifying checksum
[creator] Copying to /layers/paketo-buildpacks_bellsoft-liberica/jvmkill
[creator] Writing env.launch/JAVA_OPTS.append
[creator] Link-Local DNS: Contributing to layer
[creator] Copying to /layers/paketo-buildpacks_bellsoft-liberica/link-local-dns
[creator] Writing profile.d/link-local-dns.sh
[creator] Java Security Properties: Contributing to layer
[creator] Writing env.launch/JAVA_OPTS.append
[creator] Writing env.launch/JAVA_SECURITY_PROPERTIES.override
[creator] Security Providers Configurer: Contributing to layer
[creator] Copying to /layers/paketo-buildpacks_bellsoft-liberica/security-providers-configurer
[creator] Writing profile.d/security-providers-classpath.sh
[creator] Writing profile.d/security-providers-configurer.sh
[creator] OpenSSL Certificate Loader: Contributing to layer
[creator] Copying to /layers/paketo-buildpacks_bellsoft-liberica/openssl-security-provider
[creator] Writing profile.d/openssl-certificate-loader.sh
[creator]
[creator] Paketo Executable JAR Buildpack 1.2.5
[creator] Writing env.launch/CLASSPATH
[creator] Process types:
[creator] executable-jar: java -cp "${CLASSPATH}" ${JAVA_OPTS} org.springframework.boot.loader.JarLauncher
[creator] task: java -cp "${CLASSPATH}" ${JAVA_OPTS} org.springframework.boot.loader.JarLauncher
[creator] web: java -cp "${CLASSPATH}" ${JAVA_OPTS} org.springframework.boot.loader.JarLauncher
[creator]
[creator] Paketo Spring Boot Buildpack 1.5.5
[creator] Image labels:
[creator] org.springframework.boot.spring-configuration-metadata.json
[creator] org.springframework.boot.version
[creator] ---> EXPORTING
[creator] ERROR: failed to create launch cache: removing backup directory '/launch-cache/committed-backup': unlinkat /launch-cache/committed-backup/sha256:476cb0263a8f538fc72cbbe6bcbe70e08129d22a953b966115cb866d942e2b33.tar: permission denied
> Task :bootBuildImage FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':bootBuildImage'.
> Builder lifecycle 'creator' failed with status code 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.4/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 45s
2 actionable tasks: 2 executed
That seems to be build cache related (build cache corrupted). Your build log shows the used build cache:
...
> Executing lifecycle version v0.7.5
> Using build cache volume 'pack-cache-defc64ac2d6d.build'
As the Spring Boot Gradle Plugin (same as the spring-boot-maven-plugin) are an abstraction for Paketo.io and it's pack CLI, which is using Docker for the local builds, you should be able to find the build cache volume pack-cache-defc64ac2d6d.build with:
docker volume ls
This gives something like:
$ docker volume ls
DRIVER VOLUME NAME
local bellsoft-jre-config
local pack-cache-defc64ac2d6d.build
local pack-cache-defc64ac2d6d.launch
local spring-cloud-config
Now delete the build cache either individually (docker volume rm pack-cache-defc64ac2d6d.build) - or simply remove all local Docker volumes that aren't used by a other container with:
docker volume prune
Now your build should run again.
So, apparently this action is not supported in the 16 version of java.
The problem was solved when I updated to the 17th version of java in the pom.xml.
see: https://github.com/paketo-buildpacks/bellsoft-liberica/issues/86

Packaging native image using graalvm and quarkus gave an error

Dears,
I am following the native image build tutorial by quarkus to create native graalvm but i am getting the below error :
Error: No main manifest attribute, in /home/docker/workspace/quarkus/quarkus-getting-started/target/quarkus-getting-started-1.0-SNAPSHOT-runner.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.056 s
[INFO] Finished at: 2019-03-14T11:26:12+04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:0.11.0:native-image (default) on project quarkus-getting-started: Failed to generate a native image: Failed to build native image: Image generation failed -> [Help 1]
my environment :
OS : CentOS 7
Quarkus : 0.11.0
Java : Open JDK 1.8.0_181
GraalVM : 1.0.0-rc13
Using quarkus there is no main method in your app, but how to make it working using graal native image ?
The code 137 meant for me that I didn't have enough memory available for my docker image.
Try increasing the memory in your docker preferences. I set it to 10G to be sure because sometimes my build broke or took forever.
Why don't you use the latest Quarkus version 1.4.2.Final which come with it's own Docker image.
You can use the following properties to further config your memory consumption and your GraalVM image.
<quarkus.native.builder-image>quay.io/quarkus/ubi-quarkus-native-image:20.0.0-java11</quarkus.native.builder-image>-->
<quarkus.native.native-image-xmx>8192m</quarkus.native.native-image-xmx>
The first one could help you use another GraalVM image that the default one.
The second one could help you improve your build time. Pay attention it has to be less than the memory you set in your docker daemon.

how to get a jar build in docker maven to my local repository

I use a docker image of maven to build this custom Scribe, the simple OAuth Java lib
Scribe OAuth Java lib
[INFO] Installing /usr/src/app/target/scribe-1.2.3.oauth.jar to /root/.m2/repository/org/scribe/scribe/1.2.3.oauth/scribe-1.2.3.oauth.jar
[INFO] Installing /usr/src/app/pom.xml to /root/.m2/repository/org/scribe/scribe/1.2.3.oauth/scribe-1.2.3.oauth.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17.309 s
[INFO] Finished at: 2017-01-26T15:06:12+00:00
[INFO] Final Memory: 16M/41M
[INFO] ------------------------------------------------------------------------
using this
docker build -t my-maven .
The image build creates the scribe-1.2.3.oauth.jar perfectly. But i need this jar file to build the following project
Alfresco Share OAuth SSO Support
How can i get the jar file from the first build and use it in a local repository for my next build where i again want to use a docker maven to build that project
Left the jar build process out of the docker image build.
Why?
Because a better way to do this is making the maven docker image act as a single command:
docker run -it --rm --name my-maven-project -v "$PWD":/usr/src/mymaven -w /usr/src/mymaven maven:3.2-jdk-7 mvn clean install
I've taken the above example from the maven docker image documentation.
The -v flag attach a local directory to docker image which act as a mount point inside the docker image.
The -w flag indicates to maven where outputs the compiled jar project.

Maven check for updated dependencies in repository

Is there a Maven plugin that allows you to check if there are newer versions of dependencies available in the repository?
Say, you are using dependency X with version 1.2. Now a new version of X is released with version 1.3. I'd like to know, based on the dependencies used in my project, which dependencies have newer versions available.
The Maven Versions plugin and it's display-dependency-updates mojo are what you're looking for:
mvn versions:display-dependency-updates
Here is what the output looks like:
[INFO] ------------------------------------------------------------------------
[INFO] Building Build Helper Maven Plugin
[INFO] task-segment: [versions:display-dependency-updates]
[INFO] ------------------------------------------------------------------------
[INFO] [versions:display-dependency-updates]
[INFO]
[INFO] The following dependency updates are available:
[INFO] org.apache.maven:maven-artifact ........................ 2.0 -> 2.0.9
[INFO] org.apache.maven:maven-plugin-api ...................... 2.0 -> 2.0.9
[INFO] org.apache.maven:maven-project ....................... 2.0.2 -> 2.0.9
[INFO] org.codehaus.plexus:plexus-utils ....................... 1.1 -> 1.5.6
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17 seconds
[INFO] Finished at: Fri Aug 15 10:46:03 IST 2008
[INFO] Final Memory: 10M/167M
[INFO] ------------------------------------------------------------------------
If you want to receive email notifications when newer artifacts versions are available on Maven Central you can create an account on artifact-listener and choose which artifact you want to follow.
You can either search manually for artifacts or directly upload your pom.xml.
You will periodically received notifications like this one (available in english and french for now) :
In projects with a large number of dependancies, you sometimes keep your versions in a properties section.
<properties>
<assertj.version>3.15.0</assertj.version>
<aws-sdk.version>1.11.763</aws-sdk.version>
<cxf.version>3.3.6</cxf.version>
In the case where you are only interested in updates to those versions, you can use the following command
mvn versions:display-property-updates
This gives a more condensed view and only returns the versions you need to update in the properties section.
The VersionEye Maven Plugin is doing the same: versioneye_maven_plugin.
VersionEye can notify you about new versions on Maven Repositories, too. It is a language agnostic tool and beside Java it supports 7 other languages. Beside the simple follow/notify feature it can also directly monitor GitHub and BitBucket repositories and notify your about out-dated dependencies in your projects.
There is also a REST JSON API, for tool integrations.
By the way, I'm the dude who started this project. Let me know if you have questions.
The ideal way to do it is to set dependency versions as properties in pom.xml and then running the below command to get the updated versions for your specific/custom dependencies.
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<skip.tests>true</skip.tests>
<spring-cloud-gcp.version>1.2.3.RELEASE</spring-cloud-gcp.version>
<spring-cloud.version>Hoxton.SR6</spring-cloud.version>
<spring-cloud-stream-schema.version>2.2.1.RELEASE</spring-cloud-stream-schema.version>
<confluent.version>5.5.1</confluent.version>
<avro.version>1.10.0</avro.version>
<janino.version>3.1.2</janino.version>
<swagger.version>2.9.2</swagger.version>
<google-cloud-logging-logback.version>0.118.1-alpha</google-cloud-logging-logback.version>
<spring-cloud-stream-binder-kafka.version>3.0.6.RELEASE</spring-cloud-stream-binder-kafka.version>
</properties>
mvn versions:display-property-updates
[INFO] The following version properties are referencing the newest available version:
[INFO] ${avro.version} .............................................. 1.10.0
[INFO] ${spring-cloud-stream-schema.version} ................. 2.2.1.RELEASE
[INFO] ${janino.version} ............................................. 3.1.2
[INFO] The following version property updates are available:
[INFO] ${spring-cloud-gcp.version} .......... 1.2.3.RELEASE -> 1.2.5.RELEASE
[INFO] ${google-cloud-logging-logback.version} 0.118.1-alpha -> 0.118.2-alpha
[INFO] ${spring-cloud-stream-binder-kafka.version} 3.0.6.RELEASE -> 3.0.8.RELEASE
[INFO] ${confluent.version} ................................. 5.5.1 -> 6.0.0
[INFO] ${swagger.version} ................................... 2.9.2 -> 3.0.0
[INFO] ${spring-cloud.version} .................... Hoxton.SR6 -> Hoxton.SR8
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.572 s
[INFO] Finished at: 2020-10-06T09:35:08-07:00
[INFO] ------------------------------------------------------------------------
Another way to achieve this is by executing the command mvn versions:display-dependency-updates but the problem I face with this approach is that it also shows me updates for the nested dependencies which are not too useful for me.
You can use the Versions Maven Plugin[1] to generate reports in your Maven site to get a list of possible updates. With regard to Spring's irregularity, it appears to use the Mercury versioning system[2]. When configuring the Versions plugin, you can add a special rule for Spring stuff:
http://mojo.codehaus.org/versions-maven-plugin/
http://docs.codehaus.org/display/MAVEN/Mercury+Version+Ranges
I might be a bit late to join the party but a more clear way to get more readable html file or a xml file as report which can be taken for further automation using:
mvn versions:dependency-updates-report
This report plugin not just shows more comprehensive details on updates but also has options to update to latest versions. You can find the documentation for it to use various parameters.
You can use Maven Check, a command line tool, which is standalone unlike the Versions Maven Plugin. It also works with Gradle projects.
Output example:
2 build file(s) found, checking for artifact updates
my-gradle-project\build.gradle
[COMPILE ONLY] com.google.guava:guava 31.0-android -> 31.1-android
1 artifact update(s) available
my-maven-project\pom.xml
[DEPENDENCY] org.apache.commons:commons-lang3 3.10 -> 3.12.0
[BUILD PLUGIN] org.apache.maven.plugins:maven-compiler-plugin 3.10.0 -> 3.10.1
2 artifact update(s) available
2/2 build file(s) checked, 3 artifact update(s) available
Disclaimer: I am the author of Maven Check.

Resources