Depends on version control methods and devices, electronic devices and readable storage media

By introducing a public pom file to store dependency version numbers and updating them synchronously, the high cost and conflict issues caused by dependency version number upgrades in Maven management are resolved, improving the efficiency of dependency updates and the convenience of retrieval.

CN117215638BActive Publication Date: 2026-11-17PINGAN YIQIANBAO E COMMERCE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311180945.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-12
Publication Date
2026-11-17
Estimated Expiration
2043-09-12

AI Technical Summary

Technical Problem

In Maven management, dependency version number upgrades consume a lot of manpower and time, and are prone to dependency conflicts and low retrieval efficiency.

Method used

Introduce a common pom file to store the dependency version numbers of multiple projects, and update the version number of this file synchronously when a dependency is upgraded, replacing the version number in the parent pom file of the project, thus simplifying the dependency update process.

Benefits of technology

It reduces the manpower and time costs of dependency upgrades, avoids dependency conflicts, and improves the efficiency and ease of retrieval of dependency updates.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117215638B_ABST
    Figure CN117215638B_ABST
Patent Text Reader

Abstract

This application relates to the field of operation and maintenance technology, and proposes a dependency version control method, device, electronic device, and readable storage medium. The method includes: obtaining dependency upgrade information; for the target dependency that has been upgraded as shown in the dependency upgrade information, updating the first dependency version number of the target dependency in the public pom file to the second dependency version number shown in the dependency upgrade information, wherein the public pom file is used to store the version numbers of dependencies involved in multiple projects; in response to the dependency version number update of the public pom file, updating the first file version number of the public pom file itself to the second file version number; replacing the first file version number stored in the parent pom file of each project in the multiple projects with the second file version number. The technical solution of this application reduces the human and time costs arising from dependency upgrades and improves the convenience and effectiveness of project management after dependency upgrades.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] This application relates to the field of operation and maintenance technology, and in particular to a dependency version control method and apparatus, electronic device and readable storage medium. [Background Technology]

[0002] Currently, Maven is generally used to manage Java projects with dependencies. When encountering dependency vulnerabilities or framework upgrades, it is necessary to upgrade dependencies. Accordingly, the dependency version numbers stored in the parent POM file of each project need to be updated.

[0003] However, while this approach is convenient for a single project, managing a large number of projects simultaneously presents challenges. Each project upgrades its own required dependency versions, easily leading to version incompatibility issues and dependency conflicts across multiple projects for the same dependency. Furthermore, upgrading the dependency version number for each project and then redeploying each project consumes significant time and manpower. Additionally, in some search scenarios, querying projects with a specific dependency version number often requires traversing the parent POM files of all projects to obtain reliable search results, which is time-consuming and labor-intensive.

[0004] Therefore, how to deal with the drawbacks of dependency version number upgrades in Maven management has become an urgent technical problem to be solved. [Summary of the Invention]

[0005] This application provides a dependency version control method and apparatus, electronic device and readable storage medium, which aims to solve the technical problem in related technologies where dependency version number upgrades in Maven management consume a lot of manpower and time costs.

[0006] In a first aspect, embodiments of this application provide a dependency version control method, comprising: obtaining dependency upgrade information; for a target dependency that has undergone an upgrade as indicated by the dependency upgrade information, updating the first dependency version number of the target dependency in a public pom file to the second dependency version number indicated by the dependency upgrade information, wherein the public pom file is used to store version numbers of dependencies involved in multiple projects; in response to a dependency version number update in the public pom file, updating the first file version number of the public pom file itself to the second file version number; and replacing the first file version number stored in the parent pom file of each of the multiple projects with the second file version number.

[0007] Secondly, embodiments of this application provide a dependency version management device, comprising: a dependency upgrade information acquisition unit, configured to acquire dependency upgrade information; a dependency version number update unit, configured to update the first dependency version number of the target dependency in a public pom file to the second dependency version number shown in the dependency upgrade information for the target dependency that has undergone an upgrade, wherein the public pom file is used to store the version numbers of dependencies involved in multiple projects; a file version number update unit, configured to update the first file version number of the public pom file itself to the second file version number in response to the dependency version number update of the public pom file; and a project file update unit, configured to replace the first file version number stored in the parent pom file of each of the multiple projects with the second file version number.

[0008] Thirdly, embodiments of this application provide an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being configured to perform the method described in the first aspect above.

[0009] Fourthly, embodiments of this application provide a readable storage medium storing computer-executable instructions for performing the method flow described in the first aspect above.

[0010] The above technical solution addresses the issue of high manpower and time costs associated with dependency version number upgrades in Maven management. It proposes adding a dedicated public pom file to store dependency version numbers. When a dependency is updated, the dependency version number in the public pom file is updated synchronously, followed by the file version number in the public pom file itself, and then the file version number in the public pom file is synchronized to the parent pom file of the project.

[0011] Specifically, first, dependency upgrade information is obtained, which shows the target dependency that has been upgraded. This dependency upgrade information may include any unique identifier of the target dependency, such as its name or code. Based on this dependency upgrade information, it can be determined that a target dependency has been upgraded.

[0012] The public pom file described in this application stores version numbers of dependencies involved in multiple projects, including dependencies shared by multiple projects. Furthermore, the dependency upgrade information also shows the version number of the target dependency, which is the updated second dependency version number. Therefore, when it is determined from the dependency upgrade information that a target dependency has been upgraded, it means that the target dependency version number has been updated from the original first dependency version number to the second dependency version number. Thus, the first dependency version number of the target dependency in the public pom file can be updated to the second dependency version number shown in the dependency upgrade information.

[0013] When the version number of the first dependency in the public pom file is updated to the version number of the second dependency, the public pom file is considered updated, which is equivalent to a change in the version of the public pom file. At this point, the version number of the public pom file can be updated from the original first version number to the second version number.

[0014] Finally, the first file version number stored in the parent pom file of each of the multiple projects is replaced with the second file version number. Each project's parent pom file stores the first file version number of the common pom file, used to access the dependency version number of that dependency in the common pom file based on the first file version number when calling any dependency, and then calling the dependency based on that dependency version number. Therefore, after the first file version number in the common pom file is updated to the second file version number, the first file version number stored in each project's parent pom file needs to be changed to the second file version number so that each project can still effectively access the common pom file through its own parent pom file to call the required dependencies.

[0015] In this way, after a dependency upgrade, only dependency conflict or incompatibility testing needs to be performed on the common pom file. Once the common pom file passes the test, each project can access the required dependencies by accessing the common pom file, eliminating the need for testing each project individually, thus simplifying the subsequent update process after a dependency update. It also avoids the problem of manually modifying dependency version numbers for each project due to dependency updates, which is especially beneficial for handling large-scale dependency upgrades, reducing labor and time costs. Furthermore, for dependency version retrieval scenarios, the common pom file can be searched directly, avoiding the tedious search steps of traversing all project's parent pom files.

[0016] In summary, the technical solution of this application reduces the human and time costs associated with dependency upgrades and improves the convenience and effectiveness of project management after dependency upgrades. [Attached Image Description]

[0017] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 A flowchart of a dependency version control method according to an embodiment of this application is shown;

[0019] Figure 2 A schematic diagram of a dependency version control process according to an embodiment of this application is shown;

[0020] Figure 3 A block diagram of a dependency version control apparatus according to an embodiment of this application is shown;

[0021] Figure 4 A block diagram of an electronic device according to an embodiment of this application is shown.

Detailed Implementation Methods

[0022] This application addresses the technical problem of high manpower and time costs associated with dependency version number upgrades in Maven management. It proposes adding a dedicated public pom file for storing dependency version numbers. After a dependency upgrade, this public pom file can be used for dependency conflict or incompatibility testing. Furthermore, for each project's parent pom file, when calling individual dependencies, it's unnecessary to store each dependency's version number separately; instead, it stores the version number of the public pom file. When a dependency is upgraded, the version number of the public pom file is updated accordingly. Each project's parent pom file only needs to update the version number of its own stored public pom file to call the updated dependency.

[0023] To better understand the technical solution of this application, the embodiments of this application will be described in detail below with reference to the accompanying drawings.

[0024] Figure 1 A flowchart of a dependency version control method according to an embodiment of this application is shown.

[0025] like Figure 1 As shown, a dependency version control method according to an embodiment of this application includes:

[0026] Step 102: Obtain dependency upgrade information.

[0027] Step 104: For the target dependency that has been upgraded as shown in the dependency upgrade information, update the first dependency version number of the target dependency in the public pom file to the second dependency version number shown in the dependency upgrade information, wherein the public pom file is used to store the version numbers of dependencies involved in multiple projects.

[0028] The dependency upgrade information refers to the JAR files required for a project to run. Many projects can share these dependencies. However, in practice, dependencies can be upgraded, requiring projects using these dependencies to switch from using the old dependency to using the upgraded one. The dependency upgrade information described here indicates the target dependency that has been upgraded. Specifically, this information can include the name, code, or any other unique identifier of the target dependency. Based on this upgrade information, it can be determined that a target dependency has been upgraded.

[0029] The public pom file described in this application stores version numbers of dependencies involved in multiple projects, including dependencies shared by multiple projects.

[0030] Furthermore, the dependency upgrade information also shows the version number of the target dependency, which is the second dependency version number after the target dependency is updated.

[0031] At this point, when it is determined from the dependency upgrade information that the target dependency has been upgraded, it means that the version number of the target dependency has been updated from the original first dependency version number to the second dependency version number. Therefore, the first dependency version number of the target dependency in the public pom file can be updated to the second dependency version number shown in the dependency upgrade information.

[0032] Step 106: In response to a dependency version number update in the public pom file, update the first file version number of the public pom file itself to the second file version number.

[0033] When the version number of the first dependency in the public pom file is updated to the version number of the second dependency, the public pom file is considered updated, which is equivalent to a change in the version of the public pom file. At this point, the version number of the public pom file can be updated from the original first version number to the second version number.

[0034] In one possible design, the second file version number can be generated randomly, or it can be obtained by modifying the first file version number. Alternatively, it can be generated based on the unique identifier and / or version number information of the target dependency involved in the dependency version number update. For example, the last four characters of the updated target dependency code and the last two characters of the second dependency version number can be concatenated in sequence to form the second file version number.

[0035] Step 108: Replace the first file version number stored in the parent pom file of each of the plurality of projects with the second file version number.

[0036] In multiple projects, each project's parent pom file stores the first file version number of the common pom file. This is used to access the dependency version number of the dependency in the common pom file based on the first file version number when calling any dependency, and then call the dependency based on that dependency version number.

[0037] like Figure 2 As shown, submodules 1 and 2 in project A can access the common POM file through the file version number of the common POM file stored in the parent POM file of project A. This common POM file is the POM file that manages version numbers. Similarly, submodules 1 and 2 in project B can access the POM file that manages version numbers through the file version number of the common POM file stored in the parent POM file of project B.

[0038] Therefore, after updating the first file version number in the public pom file to the second file version number, the first file version number stored in the parent pom file of each project needs to be changed to the second file version number so that each project can still effectively access the public pom file through its own parent pom file to call the required dependencies.

[0039] The above technical solution addresses the issue of high manpower and time costs associated with dependency version number upgrades in Maven management. It proposes adding a dedicated public pom file to store dependency version numbers. When a dependency is updated, the dependency version number in the public pom file is updated synchronously, followed by the file version number in the public pom file itself, and then the file version number in the public pom file is synchronized to the parent pom file of the project.

[0040] In this way, after a dependency upgrade, only dependency conflict or incompatibility testing needs to be performed on the common pom file. Once the common pom file passes the test, each project can access the required dependencies by accessing the common pom file, eliminating the need for testing each project individually, thus simplifying the subsequent update process after a dependency update. It also avoids the problem of manually modifying dependency version numbers for each project due to dependency updates, which is especially beneficial for handling large-scale dependency upgrades, reducing labor and time costs. Furthermore, for dependency version retrieval scenarios, the common pom file can be searched directly, avoiding the tedious search steps of traversing all project's parent pom files.

[0041] In summary, the technical solution of this application reduces the human and time costs associated with dependency upgrades and improves the convenience and effectiveness of project management after dependency upgrades.

[0042] In one possible design, step 106 includes: in response to a dependency version number update of the public pom file, updating the first file version number of the public pom file itself to the second file version number using a preset upgrade script.

[0043] In other words, the automatic update of the file version number of the public pom file can be achieved by setting a preset upgrade script. That is, the upgrade script can automatically update the first file version number of the public pom file to the second file version number in response to the update of the dependent version number of the public pom file, thereby improving the convenience and timeliness of the public pom file.

[0044] In one possible design, the preset upgrade script is implemented using a preset sed command in a shell script to update the first file version number of the public pom file to the second file version number. The sed command is used to process the data in the public pom file according to the commands of the preset upgrade script, that is, to update the first file version number of the public pom file to the second file version number.

[0045] In another possible design, the default upgrade script is implemented by parsing the tag information of the public POM file using Java or Python, and replacing the first file version number in the parsed tag information with the second file version number. The public POM file is generally in XML format, and the information carried by XML files can be effectively parsed using Java or Python. Therefore, the tag information carrying its own file version number in the public POM file can be parsed using Java or Python, thereby replacing the first file version number in the tag information with the second file version number.

[0046] Of course, the implementation of the preset upgrade script is not limited to the above example. It can be any other way that can replace the file version number, and there are no restrictions here.

[0047] In another possible design, step 108 includes: for each of the plurality of projects, obtaining the update time setting rule of the project; and based on the update time setting rule, determining the time when the parent pom file of the project updates the common pom file, wherein the update time setting rule is determined by the current progress status of the project.

[0048] In other words, before updating the version number of the common pom file stored in the parent pom file of each project, the time for each project to update the version number of that file can be flexibly determined. This takes into account the actual operation of each project and avoids the normal operation of the project being affected by dependency updates.

[0049] In one possible design, multiple progress states can be set for the project, with a corresponding update time assigned to each state. This way, when the common POM file needs updating, the update time corresponding to the project's current progress state can be determined as the specific time for the update. Alternatively, a prompt can be generated when the common POM file needs updating, allowing project developers to manually initiate the update at a chosen time.

[0050] exist Figure 1 Based on the illustrated embodiment, further restrictions can be placed on the dependency version number update process in the public pom file.

[0051] In one possible design, based on the dependency upgrade information, it can be determined whether the target dependency is a common dependency of the multiple projects involved in the public pom file; if the target dependency is the common dependency, the priority of the multiple projects is obtained; only when the target dependency is the version required by the project with the highest priority among the multiple projects is it allowed to proceed to step 104.

[0052] The dependency upgrade information shows the target dependency that has been upgraded. To determine whether the target dependency that has been upgraded is a common dependency of the multiple projects involved in the public pom file, it can be determined whether the name, code or any other form of unique identifier of the target dependency and the common dependency match. If they match, it means that the target dependency is a common dependency.

[0053] Of course, the number of target dependencies and the number of common dependencies can be one or more, and there is no limit here.

[0054] Upgrading shared dependencies across multiple projects obviously involves compatibility issues after the upgrade, based on Figure 1 The technical solution described in the embodiment only requires testing the public pom file for dependency conflicts or incompatibilities after dependency upgrade. If the target dependency is a shared dependency, it indicates that there is a possibility that dependency conflicts or incompatibilities need to be resolved through the public pom file.

[0055] Furthermore, the project with the highest priority among multiple projects can be given priority. If the project has a need for the target dependency, the upgrade can be synchronized to all projects and proceed to the upgrade steps described in step 104.

[0056] This technical solution fully considers the actual needs of high-priority projects, helps to fully meet high-priority needs in dependency upgrade scenarios, and improves the rationality of dependency upgrade management.

[0057] Additionally, when the target dependency is not the version required by the highest priority project among the multiple projects, it is checked whether the public pom file contains a dependency upgrade restriction identifier corresponding to the highest priority project; if the dependency upgrade restriction identifier is not detected, the step of updating the first dependency version number of the target dependency in the public pom file to the second dependency version number shown in the dependency upgrade information is allowed; otherwise, no update is performed.

[0058] Dependency upgrade restriction flags are used to indicate that a dependency upgrade may have a negative impact on the project. Therefore, for the highest priority project, when its public dependencies are upgraded, if the public pom file contains the corresponding dependency upgrade restriction flag, it means that this dependency upgrade may have a negative impact on this highest priority project. Therefore, to meet the security requirements of the highest priority project, the public pom file may not be updated. Furthermore, updates to the target dependency of the upgrade are prohibited in all projects sharing it. Conversely, if the public pom file does not contain the dependency upgrade restriction flag corresponding to the highest priority project, it means that this dependency upgrade does not have a negative impact on this highest priority project. In this case, the upgrade is allowed to be synchronized to all projects, proceeding to the upgrade steps described in step 104.

[0059] This technical solution fully considers the actual needs of high-priority projects, helps to fully meet high-priority needs in dependency upgrade scenarios, and improves the rationality of dependency upgrade management.

[0060] In another possible design, the high-priority projects mentioned above can be replaced with projects specified by the developer. In short, any project can be selected based on the actual project operation needs of the developer, and whether the public pom file has the dependency upgrade restriction identifier corresponding to any project can be used as the condition for whether to start the update.

[0061] In another possible design, based on the dependency upgrade information, it can be determined whether the target dependency is a common dependency of the multiple projects involved in the public pom file; if the target dependency is the common dependency, it is checked whether the public pom file has a dependency upgrade restriction identifier corresponding to any project or a specified project among the multiple projects; if the dependency upgrade restriction identifier is detected, it is determined whether the second dependency version number after the target dependency upgrade is the available version number of the project to which the dependency upgrade restriction identifier belongs; only when the determination result is that the second dependency version number is the available version number is allowed to proceed to step 104.

[0062] The dependency upgrade information shows the target dependency that has been upgraded. To determine whether the target dependency that has been upgraded is a common dependency of the multiple projects involved in the public pom file, it can be determined whether the name, code or any other form of unique identifier of the target dependency and the common dependency match. If they match, it means that the target dependency is a common dependency.

[0063] Next, the upgraded version number of the target dependency is matched with the available version number of the project to which each dependency upgrade restriction identifier belongs in the public pom file. If the second dependency version number is the available version number, the upgrade is allowed to be synchronized to all projects, and the upgrade steps described in step 104 are proceeded. Otherwise, the update is not allowed.

[0064] This technical solution fully considers the operational needs of projects affected by dependency updates. Updates to the target dependency being upgraded are only allowed to be synchronized to all projects if the target dependency is available in the affected project. This helps to fully meet the needs of projects susceptible to negative impacts from dependency upgrades in dependency upgrade scenarios, thus improving the rationality of dependency upgrade management.

[0065] Figure 3 A block diagram of a dependency version control apparatus according to an embodiment of this application is shown.

[0066] like Figure 3 As shown, a dependency version control device 300 according to an embodiment of this application includes: a dependency upgrade information acquisition unit 302, used to acquire dependency upgrade information; a dependency version number update unit 304, used to update the first dependency version number of the target dependency in the public pom file to the second dependency version number shown in the dependency upgrade information for the target dependency that has undergone an upgrade, wherein the public pom file is used to store the version numbers of dependencies involved in multiple projects; a file version number update unit 306, used to update the first file version number of the public pom file itself to the second file version number in response to the dependency version number update of the public pom file; and a project file update unit 308, used to replace the first file version number stored in the parent pom file of each of the multiple projects with the second file version number.

[0067] According to one embodiment of this application, optionally, the file version number update unit 306 is configured to: in response to a dependency version number update of the public pom file, update the first file version number of the public pom file itself to the second file version number through a preset upgrade script.

[0068] According to one embodiment of this application, optionally, the file version number update unit 306 is used to: update the first file version number of the public pom file itself to the second file version number based on the preset sed instruction in the shell script; or parse the tag information of the public pom file in Java or Python, and replace the first file version number in the parsed tag information with the second file version number.

[0069] According to one embodiment of this application, optionally, the dependency version control device 300 further includes: an upgrade judgment unit, configured to, before the dependency version number update unit 304 updates, determine, based on the dependency upgrade information, whether the target dependency is a common dependency of the multiple projects involved in the public pom file; if the target dependency is the common dependency, obtain the priority of the multiple projects; when the target dependency is the version required by the project with the highest priority among the multiple projects, allow the step of updating the first dependency version number of the target dependency in the public pom file to the second dependency version number shown in the dependency upgrade information to proceed.

[0070] According to one embodiment of this application, optionally, the upgrade determination unit is further configured to: when the target dependency is not the version required by the highest priority project among the plurality of projects, detect whether the public pom file contains a dependency upgrade restriction identifier corresponding to the highest priority project; if the dependency upgrade restriction identifier is not detected, allow the step of updating the first dependency version number of the target dependency in the public pom file to the second dependency version number shown in the dependency upgrade information; otherwise, do not perform the update.

[0071] According to one embodiment of this application, optionally, the dependency version control device 300 further includes: an upgrade judgment unit, configured to, before the dependency version number update unit 304 updates, determine, based on the dependency upgrade information, whether the target dependency is a common dependency of the multiple projects involved in the public pom file; if the target dependency is the common dependency, detect whether the public pom file has a dependency upgrade restriction identifier corresponding to any project or a specified project among the multiple projects; if the dependency upgrade restriction identifier is detected, determine whether the second dependency version number after the target dependency upgrade is an available version number of the project to which the dependency upgrade restriction identifier belongs; when the determination result is that the second dependency version number is the available version number, allow the step of updating the first dependency version number of the target dependency in the public pom file to the second dependency version number shown in the dependency upgrade information.

[0072] According to one embodiment of this application, optionally, the project file update unit 308 is configured to: for each of the plurality of projects, obtain the update time setting rule of the project; and based on the update time setting rule, determine the time when the parent pom file of the project updates the public pom file, wherein the update time setting rule is determined by the current progress status of the project.

[0073] The version control device 300 uses the solution described in any of the above embodiments, and therefore has all the above-mentioned technical effects, which will not be repeated here.

[0074] Figure 4 A block diagram of an electronic device according to an embodiment of this application is shown.

[0075] like Figure 4 As shown, an electronic device 400 according to one embodiment of this application includes at least one memory 402; and a processor 404 communicatively connected to the at least one memory 402; wherein the memory stores instructions executable by the at least one processor 404, the instructions being configured to execute the scheme described in any of the above embodiments. Therefore, this electronic device 400 has the same technical effects as any of the above embodiments, and will not be repeated here.

[0076] The electronic devices in this application embodiments exist in various forms, including but not limited to:

[0077] (1) Mobile communication devices: These devices are characterized by their mobile communication capabilities and primarily aim to provide voice and data communication. These terminals include: smartphones (e.g., iPhones), multimedia phones, feature phones, and low-end phones, etc.

[0078] (2) Ultra-mobile personal computer devices: These devices fall under the category of personal computers, possessing computing and processing capabilities, and generally also have mobile internet access features. These terminals include PDAs, MIDs, and UMPCs, such as the iPad.

[0079] (3) Portable entertainment devices: These devices can display and play multimedia content. This category includes audio and video players (such as iPods), handheld game consoles, e-book readers, as well as smart toys and portable car navigation devices.

[0080] (4) Server: A device that provides computing services. The components of a server include a processor, hard disk, memory, system bus, etc. Servers are similar to general computer architectures, but because they need to provide highly reliable services, they have higher requirements in terms of processing power, stability, reliability, security, scalability, and manageability.

[0081] (5) Other electronic devices with data interaction functions.

[0082] Additionally, this application provides a readable storage medium storing computer-executable instructions for performing the following steps: obtaining dependency upgrade information; updating the first dependency version number of the target dependency in a public pom file to the second dependency version number shown in the dependency upgrade information for the target dependency that has undergone an upgrade, wherein the public pom file is used to store version numbers of dependencies involved in multiple projects; in response to the dependency version number update of the public pom file, updating the first file version number of the public pom file itself to the second file version number; and replacing the first file version number stored in the parent pom file of each of the multiple projects with the second file version number.

[0083] It should be noted that the functions or steps that can be implemented by the readable storage medium or electronic device described above can be referred to the relevant descriptions in the foregoing method embodiments. To avoid repetition, they will not be described one by one here.

[0084] The technical solution of this application has been described in detail above with reference to the accompanying drawings. The technical solution of this application reduces the human and time costs arising from dependency upgrades and improves the convenience and effectiveness of project management after dependency upgrades.

[0085] It should be understood that the term "and / or" used in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.

[0086] The terminology used in the embodiments of this application is for the purpose of describing particular embodiments only and is not intended to be limiting of this application. The singular forms “a,” “the,” and “the” used in the embodiments of this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise.

[0087] It should be understood that although the terms "first," "second," etc., may be used to describe file version numbers in the embodiments of this application, these file version numbers should not be limited to these terms. These terms are only used to distinguish file version numbers from one another. For example, without departing from the scope of the embodiments of this application, a first file version number may also be referred to as a second file version number, and similarly, a second file version number may also be referred to as a first file version number.

[0088] Depending on the context, the word "if" as used here can be interpreted as "when," "when," "in response to determination," or "in response to detection." Similarly, depending on the context, the phrase "if determination" or "if detection (of the stated condition or event)" can be interpreted as "when determination," "in response to determination," "when detection (of the stated condition or event)," or "in response to detection (of the stated condition or event)."

[0089] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0090] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in a combination of hardware and software functional units.

[0091] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0092] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.

Claims

1. A version control method, characterized in that, include: Obtain dependency upgrade information; For the target dependency that has been upgraded as shown in the dependency upgrade information, the first dependency version number of the target dependency in the public pom file is updated to the second dependency version number shown in the dependency upgrade information, wherein the public pom file is used to store the version numbers of dependencies involved in multiple projects; In response to an update of the dependency version number of the public pom file, the first file version number of the public pom file itself is updated to a second file version number, and the last four characters of the updated target dependency code and the last two characters of the second dependency version number are concatenated in sequence to form the second file version number; Replace the first file version number stored in the parent pom file of each of the multiple projects with the second file version number; Before the step of updating the first dependency version number of the target dependency in the public pom file to the second dependency version number shown in the dependency upgrade information, the method further includes: Based on the dependency upgrade information, determine whether the target dependency is a shared dependency of the multiple projects involved in the public pom file; If the target dependency is the shared dependency, check whether the public pom file contains a dependency upgrade restriction identifier corresponding to any project or a specified project among the multiple projects; If the dependency upgrade restriction flag is detected, determine whether the second dependency version number after the target dependency upgrade is an available version number of the project to which the dependency upgrade restriction flag belongs; When the determination result is that the second dependency version number is the available version number, the step of updating the first dependency version number of the target dependency in the public pom file to the second dependency version number shown in the dependency upgrade information is allowed.

2. The dependency version control method according to claim 1, characterized in that, The step of updating the first file version number of the public pom file to the second file version number in response to a dependency version number update of the public pom file includes: In response to a version number update of the public pom file, the first file version number of the public pom file itself is updated to the second file version number using a preset upgrade script.

3. The dependency version control method according to claim 2, characterized in that, The step of updating the first file version number of the public pom file to the second file version number using a preset upgrade script includes: Based on the preset sed command in the shell script, update the first file version number of the public pom file itself to the second file version number; or The tag information of the public pom file is parsed using Java or Python, and the first file version number in the parsed tag information is replaced with the second file version number.

4. The dependency version control method according to claim 1, characterized in that, The step of replacing the first file version number stored in the parent pom file of each of the multiple projects with the second file version number includes: For each of the multiple projects, obtain the update time setting rules for that project; Based on the update time setting rules, the time when the parent POM file of the project updates the public POM file is determined, wherein... The update time setting rule is determined by the current progress status of the project.

5. A version control device, characterized in that, include: Dependency upgrade information acquisition unit, used to acquire dependency upgrade information; The dependency version number update unit is used to update the first dependency version number of the target dependency that has been upgraded as shown in the dependency upgrade information to the second dependency version number shown in the dependency upgrade information in the public pom file, wherein the public pom file is used to store the version numbers of dependencies involved in multiple projects. The file version number update unit is used to update the first file version number of the public pom file itself to a second file version number in response to the dependency version number update of the public pom file, and to concatenate the last four characters of the updated target dependency code with the last two characters of the second dependency version number in sequence to obtain the second file version number. The project file update unit is used to replace the first file version number stored in the parent pom file of each of the plurality of projects with the second file version number; An upgrade determination unit is configured to, before the dependency version number update unit performs the update, determine, based on the dependency upgrade information, whether the target dependency is a common dependency of the multiple projects involved in the public pom file; if the target dependency is the common dependency, detect whether the public pom file contains a dependency upgrade restriction identifier corresponding to any project or a specified project among the multiple projects; if the dependency upgrade restriction identifier is detected, determine whether the second dependency version number after the target dependency upgrade is an available version number of the project to which the dependency upgrade restriction identifier belongs; when the determination result is that the second dependency version number is the available version number, allow the step of updating the first dependency version number of the target dependency in the public pom file to the second dependency version number shown in the dependency upgrade information.

6. An electronic device, characterized in that, include: At least one processor; And, a memory communicatively connected to the at least one processor; The memory stores instructions executable by the at least one processor, the instructions being configured to perform the method according to any one of claims 1 to 4.

7. A readable storage medium, characterized in that, The device stores computer-executable instructions for performing the method flow as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Method, device and system for resolving Maven dependency conflicts

    CN106033336A

  • Upgrade dependency checking method and device in space downloading, storage medium and terminal

    CN110147242A