Maven’s versions Plugin Updates All Your Dependencies with a Single Command

Table of Contents


It’s a good habit to use the latest versions of the dependencies you use. Not only because the updated version might contain new features or better performance (one can hope), but also because bugs are fixed and security issues are tackled. If you go about it by hand, however, updating dependencies is a boring and tedious task. Luckily for us, there is the Maven versions plugin to help us.

Check Which Dependencies/Plugins/Properties Need Updating

If you need a report on which dependencies, plugins or properties used for versioning can be upgraded, run one of these:

versions:display-dependency-updates scans a project’s dependencies and produces a report of those dependencies which have newer versions available.

versions:display-plugin-updates scans a project’s plugins and produces a report of those plugins which have newer versions available, taking care of Maven version prerequisites.

versions:display-property-updates scans a project and produces a report of those properties which are used to control artifact versions and which properties have newer versions available.

Update Parent

If you have a parent section, the following command updates the version to the latest available:

$ mvn versions:update-parent

Update To Latest Versions

To upgrade all your dependencies to the latest versions, use:

$ mvn versions:use-latest-versions

Update a Particular Property with Bounds

To upgrade dependencies that get their version from the <properties> section of your POM to version that has bounds:

$ mvn versions:update-property -Dproperty='cucumber.version' -DnewVersion='(,4.99]'

In this case, the lower bound is unspecified (and exclusive as inidicated by the () and the upper bound in 4.99 inclusive. You can tweak -DnewVersion to your liking.


The Maven versions plugin makes it easy for us the see which dependencies are outdated and can even update the dependencies for us with a single command. After updating, don’t forget to run your test suite and run the application to make sure nothing broke!


This has been tested on MacOS with the following Maven and versions versions:

$ mvn --version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /usr/local/Cellar/maven/3.6.3_1/libexec
Java version: 13.0.2, vendor: N/A, runtime: /usr/local/Cellar/openjdk/13.0.2+8_2/libexec/openjdk.jdk/Contents/Home
Default locale: en_NL, platform encoding: UTF-8
OS name: "mac os x", version: "10.15.4", arch: "x86_64", family: "mac"
$ mvn help:describe -Dplugin=versions -Dminimal | grep '^Version: '
Version: 2.7

The documentation can be found here.

Oracle SQL*Plus in a “Small” Docker Container

Table of Contents


Some time back I wrote a blog post about SQL*Plus commands. To run those commands, I would use a 15 GiB image of Oracle XE (Express Edition) just to be able to use a command-line tool. Today I stumbled upon Oracle’s Docker images, that are a whole lot smaller.

How to Build Your Own Image

Oracle provides Dockerfiles on its GitHub page. I’m interested in just SQL*Plus so I can change my password on an Oracle database and maybe execute some simple queries. I took a look at this Dockerfile, and modified it slightly to include only what I need:

FROM oraclelinux:7-slim

ARG release=19
ARG update=6

RUN  yum -y install oracle-release-el7 && \
     yum-config-manager --enable ol7_oracle_instantclient && \
     yum -y install oracle-instantclient${release}.${update}-basic \
        oracle-instantclient${release}.${update}-sqlplus && \
     rm -rf /var/cache/yum

CMD ["sqlplus", "-v"]

Build the image and tag it as sqlplus:

$ docker build -t sqlplus .

The image it generates is pretty small, weighing around 370 MB.

(OK, an image based on Alpine should be smaller, but Oracle requires glibc and not musl libc.)

You can create a container and run a SQL*Plus command with:

$ docker run -it sqlplus user/password@db.domain.tld:1521/FOO

Optional: Add tnsnames.ora to the Image

In Oracle, a file name tnsnames.ora contains the connection strings for databases. They allow you to connect to a database using sqlplus without specifying the hostname:

$ sqlplus user/passsword@FOO

Add the tnsnames.ora to the image by putting the following between the RUN and CMD directive in the Dockerfile:

COPY ./tnsnames.ora /root