What exactly is a Maven Snapshot and why do we need it?

前端 未结 13 2482
名媛妹妹
名媛妹妹 2020-11-22 07:07

I am a bit confused about the meaning of a Maven Snapshot and why we build one?

13条回答
  •  离开以前
    2020-11-22 07:21

    Maven versions can contain a string literal "SNAPSHOT" to signify that a project is currently under active development.

    For example, if your project has a version of “1.0-SNAPSHOT” and you deploy this project’s artifacts to a Maven repository, Maven would expand this version to “1.0-20080207-230803-1” if you were to deploy a release at 11:08 PM on February 7th, 2008 UTC. In other words, when you deploy a snapshot, you are not making a release of a software component; you are releasing a snapshot of a component at a specific time.

    So mainly snapshot versions are used for projects under active development. If your project depends on a software component that is under active development, you can depend on a snapshot release, and Maven will periodically attempt to download the latest snapshot from a repository when you run a build. Similarly, if the next release of your system is going to have a version “1.8,” your project would have a “1.8-SNAPSHOT” version until it was formally released.

    For example , the following dependency would always download the latest 1.8 development JAR of spring:

        
            org.springframework
            spring
            1.8-SNAPSHOT”
        
    

    Maven

    An example of maven release process

提交回复
热议问题