Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specifies if the build should be failed #387

Closed
KamilKrysztofiak opened this issue Mar 17, 2020 · 12 comments · Fixed by #801
Closed

Specifies if the build should be failed #387

KamilKrysztofiak opened this issue Mar 17, 2020 · 12 comments · Fixed by #801
Milestone

Comments

@KamilKrysztofiak
Copy link

KamilKrysztofiak commented Mar 17, 2020

Hi,

we have the following case within the team:

As a developer I want to see how I can check the topicality for my dependencies for my application in a proper way.

We perform a dependency check using the versions-maven-plugin for topicality inside the stage of the jenkins pipeline.

How we can ensure that the build fails in case if e.g. a depedency has a major update available or e.g.
we have more than 5 dependencies which require a major update etc.
I didn't see the possibility in the plugin configuration or maybe I overlook it.

Best regards,
Kamil

@schdief
Copy link

schdief commented Mar 17, 2020

having the same issue, would be great to have this implemented or explained

@lestephane
Copy link

Same issue here, but the summary is a bit confusing.

Suggested rewording:
"There should be a configurable way to fail the build when dependency and / or plugin updates are available"

@binkley
Copy link

binkley commented Oct 4, 2020

I'm working on an article on "Modern Java/JVM Build Practices", and this plugin is one of the recommendations for Maven projects (https://github.com/ben-manes/gradle-versions-plugin is the counterpart for Gradle projects).

I'd like to offer advice on failing the build if plugins/dependencies are out of date -- with an eye to helping teams that want explicit version exclusions when needed.

So this issue is important for me. What do you suggest?

@github-actions
Copy link

This issue is stale because it has been open 365 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the Stale label Oct 13, 2022
@andrzejj0
Copy link
Contributor

Hi all. Is there still popular interest in having this feature implemented?

@hugoheden
Copy link

Hi all. Is there still popular interest in having this feature implemented?

Yes! This feature would simplify life :-)

@andrzejj0
Copy link
Contributor

andrzejj0 commented Oct 24, 2022

Ok, I'm working on it.

But it will be done as an Enforcer rule. So, it will have to be used in combination with the Enforer plugin. I'll describe how to do it in the Examples section.

In a very short example:

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <goals>
          <goal>enforce</goal>
        </goals>
        <configuration>
          <rules>
            <maxDependencyUpdates>
              <maxUpdates>0</maxUpdates>
              <ignoreMinorUpdates>true</ignoreMinorUpdates>
            </maxDependencyUpdates>
          </rules>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>versions-maven-plugin</artifactId>
          </dependency>
        </dependencies>
      </plugin>
    </plugins>
  </build>

The above configuration will fail if it discovers any dependencies with major updates. Minor and less updates will be ignored.

@hugoheden
Copy link

Sounds reasonable. Is there a separate github "Issue" where your work can be discussed?

An idea is to make it possible to suppress versions that are not suitable to update to. For example, a project might feel that they are not ready to move to Spring Boot 3 (whenever that is released). The project "dependency-check-maven" supports suppressions (of false positives when looking for vulnerabilities). A suppression can even have an expiry date. In our case here one would be able to express that "we are not ready to move to Spring Boot now, but in one month we'll have time, and we should do it then"

@andrzejj0
Copy link
Contributor

andrzejj0 commented Oct 24, 2022

I think this could best be discussed here.

A feature like you describe is already present in version maven plugin though - dependency includes/excludes, which could be used to filter GAV regex patterns which are or aren't to be considered.

This could be used to filter out spring boot or for example just instruct the plugin to check a select set of dependencies.

@github-actions github-actions bot removed the Stale label Oct 25, 2022
andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Oct 27, 2022
andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Oct 27, 2022
andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Oct 27, 2022
andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Oct 27, 2022
andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Oct 28, 2022
andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Oct 28, 2022
andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Oct 28, 2022
andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Oct 28, 2022
andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Oct 29, 2022
andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Oct 29, 2022
andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Oct 29, 2022
andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Nov 3, 2022
andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Nov 3, 2022
andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Nov 13, 2022
andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Nov 13, 2022
andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Nov 13, 2022
andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Nov 22, 2022
andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Nov 24, 2022
andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Nov 24, 2022
andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Nov 24, 2022
andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Nov 25, 2022
andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Nov 25, 2022
andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Nov 25, 2022
andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Nov 25, 2022
slawekjaranowski pushed a commit that referenced this issue Nov 25, 2022
@slawekjaranowski slawekjaranowski added this to the 2.14.0 milestone Nov 25, 2022
@binkley
Copy link

binkley commented Dec 31, 2022

Checking on how this is looking. Is there a version I can try the enforcer feature with?

@andrzejj0
Copy link
Contributor

Yes, it's released as of 2.14.0.

@andrzejj0
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
8 participants