Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the maven snapshot update policy

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

What is the maven snapshot update strategy, I believe that many inexperienced people do not know what to do, so this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.

1. Why is there a snapshot?

Before there is no snapshot:

Project A depends on project B to give a new version number every time it is changed, and then tell A that I will change the version. I have to tell you every time I change it, and sometimes it will be troublesome to forget.

It can be seen that the absence of snapshots will lead to the problem of "wasting version numbers" and communication.

After you have a snapshot:

Project A depends on project BMIT B with a timestamp for each change, and A checks B's timestamp when compiling. If it is later than the local warehouse B's timestamp, it will be updated, otherwise it will not be updated.

It can be seen that snapshots save communication costs and version number costs.

2. Snapshot update policy

Note that snapshots are not updated every time install, depending on the update policy; snapshot update policy, there are daily updates, always check for updates, never check for updates and custom interval updates, the default is daily updates, that is, daily updates, if you want to always update, then you can configure in settings.xml. such as

Nexus

Central

Http://central

True

True

Always

You can also force updates through the command, mvn clean install-U

A SNAPSHOT version of the calling SDK jar package is developed for existing http services at a time. After QA deployed to the test environment, I updated the contents of the jar package, and it was strange that QA did not pull the latest jar package when he deployed again. In my memory, maven doesn't always check from private server.

Is there any update to the jar package of type SNAPSHOT? Why doesn't it work for me? It turns out that it has been used in this way all the time, but it is not good for another company? Finally, by reading the official documents, I found that my understanding was not in place.

Why use SNAPSHOT type dependencies?

The answer, of course, is that you don't want to upgrade the version every time you make a code change.

How does maven handle SNAPSHOT type dependencies?

On the first build, the library is downloaded from the remote repository to the local repository cache, and then irregularly checks whether the snapshot version has changed according to the configuration of the pom file. If there are any changes, the latest jar will be pulled back.

Check the frequency configuration 12345678 myRepository. True update policy

There are several update strategies:

Every time always builds, it checks whether the dependent jar package is updated in the remote repository.

Daily checks once a day (default policy)

Interval:XXX specifies the inspection interval in minutes.

Never never checks. This strategy is the same as the official version of the processing rules.

Referenc

Http://maven.apache.org/ref/3.5.0/maven-settings/settings.html

After reading the above, have you mastered the method of maven snapshot update strategy? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report