I am a newbie to Maven and I am using internet resources to learn maven. One of my study material that I downloaded from online states that:
In case of Version, if Maven once downloaded the mentioned version say data-service:1.0, it will
never try to download a newer 1.0 available in repository. To download the updated code, data-
service version is be upgraded to 1.1.
In case of SNAPSHOT, Maven will automatically fetch the latest SNAPSHOT (data-service:1.0-
SNAPSHOT) everytime app-ui team build their project.
Let us say that my project depends on project A 1.0-SNAPSHOT. The first time I build my project, maven will download the project A artifact and store it in the local repository. If I am right, the next time I build my project, maven will fetch the artifact from local repository as long as the version of the artifact remains same in my project's pom.xml. So, if it was 1.0-SNAPSHOT when I first built the project and is still the same, maven will fetch the artifact from my local repository. What if the project A has changed in the meantime? Or, am I missing something here?
Please help me to understand this. Thanks in advance.
If you are dependent on a snapshot build, ideally, Maven will make sure you local repository is always upto date. So, if the artifact is updated in the remote repository, it will download it to the local repository
It doesn't download artifacts from local repository. The artifacts are used directly from the local repository. They aren't downloaded from the local repository. Here, local repository means the /m2 folder on your machine.
posted 4 years ago
I would also like to know what would happen if I give some other number instead 1.0 in the "1.0-SNAPSHOT" for the version in my pom.xml
Dineshkumar Gnanaprakasam wrote:I would also like to know what would happen if I give some other number instead 1.0 in the "1.0-SNAPSHOT" for the version in my pom.xml
It would pull the latest snapshot for that particular release number. Been there, done that. It helps when the offshore team is working on a different source branch. Where I might be working on v 1.4.3-SNAPSHOT and they're still working on 1.4.2-SNAPSHOT and we plan to all get together when we're ready to integrate for a production build.
If you have a site-wide repository (such as Sonatype Nexus), it can be used to hold snapshot builds. In fact, Nexus has a special repository subtree just for snaphots. Your POM would contain 2 repository definitions in its distributionManagement stanza - one for the primary repository and one for the snapshot repository.
The process for snapshots is essentially the same for any other build. When a dependency is encountered, Maven will check the repository FIRST, and then download to local cache IF the repository artifact is newer than the local artifact. Unless you run Maven with the "-o" (offline) switch.
"privilege" comes from the Latin words for "private" and "law" (legal) and dates to feudal times. To "claim privilege" meant that you were above the laws that applied to the common people.
Do not meddle in the affairs of dragons - for you are crunchy and good with ketchup. Crunchy tiny ad:
Devious Experiments for a Truly Passive Greenhouse!