Maven Require Release Dependencies

Source: Internet
Author: User
Tags require

Before the project goes live, you must exclude all snap-shot versions of dependencies and upgrade them all to release version, manual one to row efficiency is too low, MAVEN provides the Maven-enforcer-plugin plugin to do this thing. Require Release Dependencies

This rule checks the dependencies and fails if any snapshots is found.

The following parameters is supported by this rule:searchtransitive-if transitive dependencies should is checked.
Default:true Message-an Optional message to the user if the rule fails. Onlywhenrelease-if This rule should only being executed when the
Version is a non-snapshot version. Default:false Failwhenparentissnapshot-if The parent should be checked. Default:
True includes-list of dependency patterns to include when checking for
Snapshot versions excludes-list of dependency patterns to exclude when checking for
Snapshot versions 1.Sample Plugin Configuration:

<project> [...]
        <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-enforcer-plugin</artifactId> <version>1.4.1</version> <e
              xecutions> <execution> <id>enforce-no-snapshots</id> <goals>
              <goal>enforce</goal> </goals> <configuration> <rules> <requireReleaseDeps> <message>no Snapshots Allowed!</messag 
            e> </requireReleaseDeps> </rules> <fail>true</fail> </configuration> </execution> </executions> </plugin> < ;/plugins> </build> [...] </project> 


2.includes/excludes Plugin Configuration:

<project> [...]
        <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-enforcer-plugin</artifactId> <version>1.4.1</version> <e
              xecutions> <execution> <id>enforce-no-snapshots</id> <goals>
              <goal>enforce</goal> </goals> <configuration> <rules> <requireReleaseDeps> <message>no Snapshots Allowed!</messag
                    E> <excludes> <exclude>org.apache.maven:maven-core</exclude>
                <exclude>org.apache.maven.plugins:*</exclude> </excludes> </requireReleaseDeps> </rules> <fail>true</fail> </configuration> </execution> </executions> </plugin> </plugins> </build> [...] </project>
Reference

Require Release dependencies:http://maven.apache.org/enforcer/enforcer-rules/requirereleasedeps.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.