Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do I stop maven version ranges from using snapshots

Tags:

maven-2

maven

I am using version ranges in my maven POM:

<version>[3.0.0,)</version>

and for this particular artifact there is a 3.0.0 version in the repo and a 3.0.1-SNAPSHOT. When I try to do a release it fails as the SNAPSHOT version is used.

I have tried to get round this by editing my settings file to dis-allow the use of snapshots but it still fails:

<repositories>
    <repository>
        <id>EFX Nexus Repository</id>
        <url>myUrl</url>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
</repositories>

Thanks

like image 859
Roaders Avatar asked Dec 10 '10 08:12

Roaders


People also ask

Why is it best practice not to release SNAPSHOT versions of Maven artifacts?

Rule #3 Never release using the Time-Stamped snapshot The release plugin will still fail if you do this because it correctly understands you have SNAPSHOT dependencies. The plugin has a flag to allow bypass this check and people unfortunately use it far too often.

What is the difference between SNAPSHOT and version in Maven?

A Maven snapshot is a special version of a Maven package that refers to the latest production branch code. It is a development version that precedes the final release version. You can identify a snapshot version of a Maven package by the suffix SNAPSHOT that is appended to the package version.

What happens if you don't specify a version in Maven?

Maven won't allow any other either. Build will fail if version is not found.

What is SNAPSHOT dependency in Maven?

Snapshot simply means depending on your configuration Maven will check latest changes on a special dependency. Snapshot is unstable because it is under development but if on a special project needs to has a latest changes you must configure your dependency version to snapshot version.


1 Answers

This is basic maven issue.

When u fire multiple commands in single line..say mvn versions:resolve-ranges clean install...it will fetch SNAPSHOT when do release build.

Try with seperate execution of command.

first run mvn versions:resolve-ranges and then clen install

like image 93
Devloper_b5 Avatar answered Oct 05 '22 23:10

Devloper_b5