Skip to content

leplusorg/docker-maven-check-versions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Maven Check Versions

Docker container to run the Maven Versions plugin.

Dockerfile Docker Build Docker Stars Docker Pulls Docker Version

Purpose

This containers is meant to be used in CI/CD pipeline to detect when newer versions of Maven dependencies or plugins are avaible.

Requirements

The image comes with Maven installed so it only needs a pom.xml to analyze. However if you want to control the version of Maven to be used instead, just make sure that there is a Maven wrapper script (mvnw) pointing to that version next to the pom.xml. For more information on how to install the maven wrapper in your project, see the documentation.

The script uses the Versions plugin (more details here). By default Maven will use the latest version of the plugin that it supports but you can set the desired version inside your pom.xml:

<properties>
  ...
  <maven.versions.plugin>2.14.0</maven.versions.plugin>
  ...
</properties>
...
<build>
  <pluginManagement>
    <plugins>
      ...
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>versions-maven-plugin</artifactId>
        <version>${maven.versions.plugin}</version>
      </plugin>
      ...
    </plugins>
  </pluginManagement>
</build>

GitHub

To use this container in a GitHub worklow, add the following action file .github/workflows/maven-check-versions.yml to your project:

---
name: Maven Check Versions

on:
  schedule:
    - cron: '0 0 * * 0'
  workflow_dispatch:

permissions: {}

jobs:
  check:
    runs-on: ubuntu-latest
    container: leplusorg/maven-check-versions:1.0.0@sha256:e8f760bb1faf3d3c333d75810e82289fdd275688421cc8bad04cdbbc757ae5a
    steps:
      - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
      - name: Check the versions
        run: /opt/maven-check-versions.sh

This way the action can be triggered manually and otherwise it runs automatically once per week.

GitLab

To use this container in a GitLab step, add the following step to the stage of your choice:

maven check versions:
  image:
    name: leplusorg/maven-check-versions:1.0.0@sha256:e8f760bb1faf3d3c333d75810e82289fdd275688421cc8bad04cdbbc757ae5a
  script:
    - '/opt/maven-check-versions.sh'