Code package dependency relationship detection method and device

Matching code package version information through the version dependency knowledge base solves the problem of low efficiency and accuracy of code package dependency detection in the existing technology, achieves efficient and accurate dependency detection, reduces labor costs, and is adaptable to a variety of businesses scene.

CN118567710APending Publication Date: 2024-08-30BEIJING JINGDONG YUANSHENG TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410773100.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-14
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

The existing technology has low efficiency and accuracy when detecting code package dependencies, resulting in high labor costs.

Method used

By establishing a version dependency knowledge base, it matches the version information of the target code package with the preset dependency version information, determines that the dependency relationship is valid, and updates the version dependency knowledge base when necessary to improve detection efficiency and accuracy.

Benefits of technology

It improves the efficiency and accuracy of code package dependency detection, reduces labor costs, can flexibly handle a variety of business needs, and resolve dependency conflicts in a timely manner.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118567710A
    Figure CN118567710A
Patent Text Reader

Abstract

The invention discloses a code package dependency relationship detection method and device, and relates to the technical field of computers. A specific embodiment of the code package dependency relationship detection method comprises the following steps: in response to a received detection request, determining a corresponding target code package; determining version information of a dependent code package introduced by the target code package; matching the version information with a preset version dependency knowledge base, and judging that the dependency relationship between the dependency code package and the target code package is valid under the condition that the version information is successfully matched with the version dependency knowledge base. According to the embodiment, the version information of the dependency code package is matched based on the version dependency knowledge base, whether the dependency relationship between the dependency code package and the target code package is effective or not can be quickly determined, the detection efficiency and accuracy of the dependency relationship of the code package are improved, and the labor cost is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method and device for detecting code package dependencies. Background Art

[0002] In the process of developing an application, in addition to writing the business code required by the application, you also need to introduce some already developed dependent code packages to assist in the startup and operation of the application. When introducing dependent code packages, you need to pay attention to the version information between dependent code packages to avoid introducing version conflicts and incompatible dependent code packages. Usually, R&D personnel will record the relevant information of dependent code packages, or use third-party tools to build a dependency graph between dependent code packages, and then R&D personnel will determine dependency conflicts based on the dependency graph.

[0003] In the process of implementing the present invention, the inventors found that the prior art has at least the following problems:

[0004] Manually recording the introduced dependent code packages and checking the dependency graph consumes a lot of manpower costs; the efficiency and accuracy of detecting dependency conflicts based on the introduction records of dependent code packages or dependency graphs are low. Summary of the invention

[0005] In view of this, an embodiment of the present invention provides a method and device for detecting code package dependencies, which can improve the efficiency and accuracy of detecting code package dependencies and reduce labor costs.

[0006] To achieve the above-mentioned purpose, according to a first aspect of an embodiment of the present invention, a method for detecting code package dependencies is provided, comprising: determining a target code package corresponding to a received detection request; determining version information of a dependent code package introduced by the target code package; matching the version information with version information of a dependent code package that the target code package can depend on in a preset version dependency knowledge base, and in response to a successful match between the version information and the version information of the dependent code package that the target code package can depend on in the version dependency knowledge base, determining that the dependency relationship between the dependent code package and the target code package is valid, wherein the version dependency knowledge base is used to store the dependency relationship between the code package and the dependent code package.

[0007] Optionally, the version information is matched with version information of dependent code packages that the target code package can depend on in a preset version dependency knowledge base, including: determining a dependent code package set corresponding to the target code package from the version dependency knowledge base; determining a matching code package corresponding to the target code package from the dependent code package set according to non-numeric text included in the version information; taking the numerical text included in the version information as the first numerical text, taking the numerical text corresponding to the matching code package as the second numerical text, matching the first numerical text with the second numerical text, and in response to the first numerical text successfully matching the second numerical text, determining that the version information successfully matches the version information of the dependent code package that the target code package can depend on in the version dependency knowledge base.

[0008] Optionally, matching the first numerical text with the second numerical text includes: converting the first numerical text into a first numerical list, and converting the second numerical text into a second numerical list; determining the list position according to a preset numerical comparison order; obtaining a target numerical value from the list position of the first numerical list, and obtaining a target numerical range from the list position of the second numerical list; in response to the target numerical value being within the target numerical range, determining that the first numerical text and the second numerical text are successfully matched.

[0009] Optionally, in response to not determining a matching code package corresponding to the target code package from the dependent code package set, the version information of the target code package and the dependent code package are associated and stored in a version dependency knowledge base.

[0010] Optionally, obtain the dependent code package name and resource address corresponding to the received knowledge base update request from the version dependency knowledge base; obtain the version information to be updated corresponding to the dependent code package name from the resource address; in response to finding historical version information corresponding to the version information to be updated in the version dependency knowledge base, update the historical version information according to the version information to be updated; in response to not finding the historical version information in the version dependency knowledge base, associate the version information to be updated with the dependent code package name and store them in the version dependency knowledge base.

[0011] Optionally, the resource address includes: a page address and a tag address; obtaining the version information to be updated corresponding to the dependent code package name from the resource address, including: determining the corresponding target page according to the page address; determining the corresponding target page element from the target page according to the tag address; obtaining the page text included in the target page element, and extracting the version information to be updated corresponding to the dependent code package name from the page text.

[0012] Optionally, before extracting the to-be-updated version information corresponding to the dependent code package name from the page text, determine the page signature information corresponding to the page text; compare the page signature information with the historical signature information corresponding to the page text to determine that the page signature information is not equal to the historical signature information.

[0013] Optionally, determining a target code package corresponding to a received detection request includes: determining an initiation event of the detection request; in response to the initiation event being to process a code compilation request, taking the code package corresponding to the code compilation request as the target code package; in response to the initiation event being to process a project startup request, determining a target project corresponding to the project startup request, taking the code package included in the target project as the target code package; in response to the initiation event being to receive a code repository address, taking the code package stored in the code repository address as the target code package.

[0014] Optionally, the method of the embodiment of the present invention further includes: updating an operation log of the version-dependent knowledge base; generating statistical information of the version-dependent knowledge base according to the operation log; and exporting the statistical information as a statistical file in response to receiving an export request.

[0015] According to a second aspect of an embodiment of the present invention, a device for detecting code package dependencies is provided, comprising: a first determination module, used to determine a target code package corresponding to a received detection request; a second determination module, used to determine version information of a dependent code package introduced by the target code package; a matching module, used to match the version information with version information of a dependent code package that the target code package can depend on in a preset version dependency knowledge base, and in response to a successful match between the version information and the version information of the dependent code package that the target code package can depend on in the version dependency knowledge base, determining that the dependency relationship between the dependent code package and the target code package is valid, wherein the version dependency knowledge base is used to store the dependency relationship between the code package and the dependent code package.

[0016] Optionally, the matching module is also used to: determine a set of dependent code packages corresponding to the target code package from a version dependency knowledge base; determine a matching code package corresponding to the target code package from the dependent code package set based on the non-numeric text included in the version information; use the numerical text included in the version information as the first numerical text, and the numerical text corresponding to the matching code package as the second numerical text, match the first numerical text with the second numerical text, and in response to a successful match between the first numerical text and the second numerical text, determine that the version information successfully matches the version information of the dependent code package on which the target code package can depend in the version dependency knowledge base.

[0017] Optionally, the matching module is also used to: convert the first numerical text into a first numerical list, and convert the second numerical text into a second numerical list; determine the list position according to a preset numerical comparison order; obtain the target numerical value from the list position of the first numerical list, and obtain the target numerical range from the list position of the second numerical list; in response to the target numerical value being within the target numerical range, determine that the first numerical text and the second numerical text match successfully.

[0018] Optionally, the apparatus of the embodiment of the present invention further includes: a storage module for associating and storing version information of the target code package and the dependent code package in a version dependency knowledge base in response to failure to determine a matching code package corresponding to the target code package from the dependent code package set.

[0019] Optionally, the device of the embodiment of the present invention also includes: a first acquisition module, used to obtain the dependent code package name and resource address corresponding to the received knowledge base update request from the version dependency knowledge base; a second acquisition module, used to obtain the version information to be updated corresponding to the dependent code package name from the resource address; a knowledge base update module, used to respond to finding historical version information corresponding to the version information to be updated in the version dependency knowledge base, and update the historical version information according to the version information to be updated; in response to not finding the historical version information in the version dependency knowledge base, associate the version information to be updated with the dependent code package name and store it in the version dependency knowledge base.

[0020] Optionally, the resource address includes: a page address and a tag address; the second acquisition module is also used to: determine the corresponding target page according to the page address; determine the corresponding target page element from the target page according to the tag address; obtain the page text included in the target page element, and extract the version information to be updated corresponding to the dependent code package name from the page text.

[0021] Optionally, the device of the embodiment of the present invention also includes: a third determination module, used to determine the page signature information corresponding to the page text; a judgment module, used to compare the page signature information with the historical signature information corresponding to the page text, and determine that the page signature information is not equal to the historical signature information.

[0022] Optionally, the first determination module is also used to: determine the initiating event of the detection request; in response to the initiating event being to process a code compilation request, use the code package corresponding to the code compilation request as the target code package; in response to the initiating event being to process a project startup request, determine the target project corresponding to the project startup request, and use the code package included in the target project as the target code package; in response to the initiating event being to receive a code repository address, use the code package stored in the code repository address as the target code package.

[0023] Optionally, the device of an embodiment of the present invention also includes: a log update module, which is used to update the operation log of the version dependency knowledge base; a generation module, which is used to generate statistical information of the version dependency knowledge base based on the operation log; and an export module, which is used to export the statistical information as a statistical file in response to receiving an export request.

[0024] According to a third aspect of an embodiment of the present invention, there is provided an electronic device, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method of any of the above embodiments.

[0025] According to a fourth aspect of an embodiment of the present invention, there is provided a computer-readable medium on which a computer program is stored, and when the program is executed by a processor, the method of any of the above embodiments is implemented.

[0026] According to a fifth aspect of an embodiment of the present invention, there is provided a computer program product, including a computer program, which implements the method of any of the above embodiments when executed by a processor.

[0027] One embodiment of the above invention has the following advantages or beneficial effects: by matching the version information of the dependent code package based on the version dependency knowledge base, it is possible to quickly determine whether the dependency relationship between the dependent code package and the target code package is valid, thereby improving the detection efficiency and accuracy of the code package dependency relationship and reducing labor costs; by determining the matching code package based on the non-numeric text of the version information, and by matching the version information of the matching code package based on the numeric text of the version information, it is possible to improve the flexibility and efficiency of dependency detection; by comparing the target value with the target value range, it is possible to improve the flexibility and efficiency of value comparison and save system resources occupied by the version dependency knowledge base; in the absence of a matching code package, the relevant information of the dependent code package and the target code package is compared. The information is stored in the version dependency knowledge database, which can timely update the version dependency knowledge base and improve the efficiency and accuracy of dependency detection; the version information included in the version dependency knowledge base is updated according to the dependency package name and resource address, which can improve the efficiency and accuracy of dependency detection; before obtaining new version information, the target page is updated according to the page signature information, which can improve the accuracy of version information acquisition and avoid obtaining duplicate information; when the code is compiled, the project is started, and the code warehouse address is received, the target code package is determined, and the detection method can be flexibly executed to meet various business needs; generating and exporting the operation log of the version dependency knowledge base is conducive to querying the latest code package dependencies and facilitating the timely resolution of dependency conflicts in the project.

[0028] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0030] Figure 1 is a schematic diagram of the main process of a method for detecting code package dependencies according to an embodiment of the present invention;

[0031] Figure 2 is a schematic diagram of a system architecture for detecting code package dependencies according to a reference embodiment of the present invention;

[0032] Figure 3 It is a schematic diagram of the main process of updating the version-dependent knowledge base according to a reference embodiment of the present invention;

[0033] Figure 4 It is a schematic diagram of the main process of detecting code package dependencies according to a reference embodiment of the present invention;

[0034] Figure 5 It is a schematic diagram of the main process of a method for detecting code package dependencies according to a reference embodiment of the present invention;

[0035] Figure 6 is a schematic diagram of the main process of a method for detecting code package dependencies according to another reference embodiment of the present invention;

[0036] Figure 7 is a schematic diagram of main modules of a device for detecting code package dependency according to an embodiment of the present invention;

[0037] Figure 8 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0038] Fig. 9 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0039] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0040] It should be noted that in the technical solution of the present invention, the collection, use, storage, sharing and transfer of user personal information involved are in compliance with the provisions of relevant laws and regulations, and it is necessary to inform the user and obtain the user's consent or authorization. When applicable, the user's personal information is de-identified and / or anonymized and / or encrypted.

[0041] In the process of developing an application, in addition to writing the business code required by the application, you also need to introduce some already developed dependent code packages to assist in the startup and operation of the application. When introducing dependent code packages, you need to pay attention to the version information between dependent code packages to avoid introducing version conflicts and incompatible dependent code packages. Usually, R&D personnel will record the relevant information of dependent code packages, or use third-party tools to build a dependency graph between dependent code packages, and then R&D personnel will determine dependency conflicts based on the dependency graph.

[0042] Manually recording the introduced dependent code packages and checking the dependency graph consumes a lot of manpower costs; the efficiency and accuracy of detecting dependency conflicts based on the introduction records of dependent code packages or dependency graphs are low.

[0043] In view of this, according to a first aspect of an embodiment of the present invention, a method for detecting code package dependencies is provided. Figure 1 FIG. 1 is a schematic diagram of the main process of the method for detecting code package dependencies according to an embodiment of the present invention. Figure 1 As shown, the method for detecting code package dependencies according to an embodiment of the present invention mainly includes the following steps S101 to S103.

[0044] Step S101, determining a target code package corresponding to the received detection request.

[0045] The execution subject of the embodiment of the present invention parses the received detection request and determines the code address carried by the detection request. The code address is the address of storing the target code package. The code address can be a local address in the local server or a remote address in other servers in the same network as the local server. According to the code address, the corresponding target code package is determined. The target code package includes one or more code files. The target code package can be a complete code package of an application or a code package of a functional module of the application.

[0046] The contents of the code files in the target code package include: business codes written by R&D personnel and related codes used to introduce dependent code packages into the target code package. Dependent code packages are already developed code packages that can implement some functions (for example, establishing network connections, operating databases, and generating logs). R&D personnel can carry out further business development work based on the dependent code packages introduced into the target code package.

[0047] The detection request is used to request detection of whether there are dependency conflicts between dependent code packages introduced by the target code package, and between the target code package and dependent code packages. Dependency conflict refers to the problem that the target code package introduces multiple versions of dependent code packages, resulting in inconsistent dependency relationships between the target code package and dependent code packages, and between multiple dependent code packages.

[0048] Exemplarily, the execution subject of the embodiment of the present invention parses the received detection request and obtains the parameter "{'address':'\E:\program001'}", which indicates that the code address of the target code package is the local address "\E:\program001", and the code package name of the target code package is "program001". As another example, the execution subject of the embodiment of the present invention parses the received detection request and obtains the parameter "{'address':'github.com / user1 / program002'}", which indicates that the code address of the target code package is the remote address "github.com / user1 / program002", and the code package name of the target code package is "program002".

[0049] When a detection request is received, the target code package located at a local address or a remote address is accurately and flexibly determined to improve the processing efficiency and accuracy of the detection request.

[0050] Step S102: determining the version information of the dependent code package introduced by the target code package.

[0051] After determining the target code package, obtain the configuration file included in the target code package. The configuration file is used to record the dependency relationship between the target code package and the dependent code package. Obtain the version information of the dependent code package from the configuration file. The version information of the dependent code package includes: organization name, identifier, version number, package type, scope and other information. The target code package introduces multiple dependent code packages, and the version information of the multiple dependent code packages is obtained from the configuration file.

[0052] For example, the target code package is developed based on the Maven project management tool. After the target code package is determined, a configuration file, that is, a pom.xml file, is obtained from the target code package. The pom.xml file is traversed and the configuration files are generated according to the content in the file. <groupid>Tag, determine the organization name of the dependent code package, according to the file <artifactid>Tag, determine the identifier of the dependent code package, according to the file <version>Tag, determine the version number of the dependent code package, according to the file <type>Tag, determine the package type of the dependent code package, according to the file <scope>Tag, determine the scope of the dependent code package; the pointer information, identifier, version number, package type, and scope of each dependent code package obtained are used as the version information of the dependent code package.

[0053] As another example, the target code package is traversed to determine the storage path of the dependent code packages in the target code package, and within the storage path of the dependent code package, the code package name of each dependent code package is determined, and the code package name of the dependent code package includes version information such as the organization name, identifier, and version number of the dependent code package. Specifically, according to a pre-set separator, the code package name of the dependent code package is divided into multiple character strings, and each character string corresponds to a part of the version information. For example, the code package name of the dependent code package is "org.B1-B2-1.0.0.jar", and according to the pre-set separators "-" and ".", the dependent code package is divided into multiple character strings, wherein the organization name of the dependent code package is "org.B1", the identifier is "B2", the version number is "1.0.0", and the package type is "jar".

[0054] Determining the version information of each dependent code package from a configuration file or the code package name of the dependent code package can provide complete data support for dependency conflict detection and quickly and accurately obtain the version information of the dependent code package.

[0055] Step S103, matching the version information with the version information of the dependent code package that the target code package can depend on in the preset version dependency knowledge base, and when the version information and the version information of the dependent code package that the target code package can depend on in the version dependency knowledge base match successfully, determining that the dependency relationship between the dependent code package and the target code package is valid.

[0056] A version dependency knowledge base is pre-established, and the version dependency knowledge base is used to store the dependency relationship between the target code package and the dependent code package. For example, the target code package C1 needs to introduce the dependent code package C2, the dependent code package C3, and the dependent code package C4. The version information of the dependent code package C2, the dependent code package C3, and the dependent code package C4 that will not cause dependency conflicts are associated with the version information of the target code package and stored in the version dependency knowledge base. The dependency relationship stored in the version dependency knowledge base will not cause dependency conflicts.

[0057] Exemplarily, the data structure of the version dependency knowledge base is shown in Table 1. The version dependency knowledge base includes: version information of the target code package and version information of multiple dependent code packages introduced by the target code package. The data types of this information are all strings, which are easy to obtain and process. According to the package name and version information of the target code package, multiple dependent code packages that will not cause dependency conflicts can be determined.

[0058] Table 1

[0059] Field Name type meaning packageName String Object code package name packageVersion String Version number of the object code package packgeGroupId String The name of the organization that packaged the object code packageArtifactId String Identifier of the object code package relationVersion String Dependency code package version number relationGroupId String The name of the organization that depends on the code package relationArtifactId String Identifier of the dependent code package relationVersionMin String Minimum version number of dependent code packages relationVersionMax String Maximum version number of dependent code packages url String Official website address of dependent code packages ... ... ...

[0060] After obtaining the version information of the dependent code package, the applicable version information of the dependent code package applicable to the target code package is queried in the version dependency knowledge base, and the version information is compared and matched with the applicable version information. For example, it is determined whether the version information is the same as the applicable version information. If the version information is the same as the applicable version information, it is determined that the version information and the version information of the dependent code package that the target code package can rely on in the version dependency knowledge base match successfully. If the version information and the applicable version information are different, it is determined that the version information and the version information of the dependent code package that the target code package can rely on in the version dependency knowledge base match unsuccessfully. If the version information and the version information of the dependent code package that the target code package can rely on in the version dependency knowledge base match successfully, it is determined that the dependency relationship between the target code package and the dependent code package corresponding to the version information is valid and will not cause dependency conflicts; if the version information and the version information of the dependent code package that the target code package can rely on in the version dependency knowledge base match unsuccessfully, it is determined that the dependency relationship between the target code package and the dependent code package corresponding to the version information is invalid and will cause dependency conflicts, and it is necessary to adjust the dependency relationship between the target code package and the dependent code package in a timely manner.

[0061] Exemplarily, the organization name of the dependent code package introduced in the target code package is "org.C1.C2", the identifier is "C3.C4", and the version number is "1.0.1"; in the version dependency knowledge base, the applicable version information of the dependent code package associated with the target code package name is searched, and the applicable organization name is "org.C1.C2", the identifier is "C3.C4", and the version number is "1.0.2"; because the version number of the version information and the applicable version number of the applicable version information are different, it is determined that the version information and the version dependency knowledge base are not matched successfully, and the dependency relationship between the dependent code package corresponding to the version information and the target code package is invalid, and the dependent code package will cause a dependency conflict; a prompt information of the dependent code package is generated to inform the R&D personnel: the version information of the dependent code package, the dependency conflict that will be caused by the dependent code package, and the applicable version information of the dependent code package applicable to the target code package, and the prompt information is sent to the R&D personnel by email, SMS, voice, etc., and the R&D personnel are requested to handle it in time.

[0062] In a reference embodiment, after detecting that the dependent code package is not applicable to the target code package and there is a risk of dependency conflict, the execution subject of the embodiment of the present invention shields the configuration information related to the dependent code package, for example, using <exclusions>Tag to shield the configuration information in the pom.xml configuration file; for another example, in the code file that introduces the dependent code package, add the string " / / " at the beginning of the command line that introduces the dependent code package to shield the related statements that introduce the dependent code package, so as to automatically release the dependency relationship between the target code package and the dependent code package.

[0063] Based on the version dependency knowledge base, the dependency relationship between the target code package and the dependent code package is detected, which can improve the detection efficiency and accuracy and reduce labor costs. There is no need for R&D personnel to manually record the version information of the dependent code package, or to detect the dependency relationship by checking the dependency tree. When it is determined that the dependent code package will cause a dependency conflict, prompt information is sent to the R&D personnel in a timely manner to inform the R&D personnel of the relevant situation, so as to facilitate the timely resolution of potential code vulnerabilities in the target code package. The configuration information related to the dependent code package is shielded, so that the dependency relationship between the target code package and the dependent code package can be removed in a timely and accurate manner, reducing the workload of R&D personnel.

[0064] According to a reference embodiment of the present invention, when matching the version information with the version information of the dependent code package that the target code package can depend on in the preset version dependency knowledge base, the dependent code package set corresponding to the target code package is first determined from the version dependency knowledge base. The dependent code package set is used to store the version information of the dependent code package applicable to the introduction of the target code package, and the dependent code package set includes the version information of one or more dependent code packages. For example, determine the target code package name or target code package code and other information, and search the version dependency knowledge base for the dependent code package set associated with the target code package name or target code package code.

[0065] The version information of the dependent code package includes numerical text and non-numerical text, wherein the numerical text consists of one or more numbers, and the non-numerical text consists of one or more character strings. Separate the non-numerical text from the version information of the dependent code package, and determine the corresponding matching code package from the dependent code package set based on the non-numerical text. Specifically, the non-numerical text includes the organization name, identifier, package type, scope and other version information of the dependent code package, obtain the applicable organization name, applicable identifier, applicable package type, applicable scope and other version information of each dependent code package in the dependent code package set, compare the two version information, and use the dependent package with the same organization name, identifier, package type, scope and other version information as the dependent code package as the matching dependent package. At this time, it is only necessary to determine whether the version number between the dependent code package and the matching code package matches.

[0066] The version number is a numerical text included in the version information. The numerical text included in the version information of the dependent code package is used as the first numerical text, and the numerical text corresponding to the matching code package is used as the second numerical text. That is, the first numerical text includes the version number of the dependent code package, and the second numerical text includes the version number of the matching code package. The first numerical text is matched with the second numerical text. For example, in the case where the version number has multiple version number types such as the main version number, the secondary version number, and the sub-version number, the version numbers of the same type are compared respectively to determine whether they are the same. When all types of version numbers are the same, it is determined that the version number of the dependent code package is the same as the version number of the matching code package, that is, the first numerical text and the second numerical text match successfully. When the first numerical text matches the second numerical text successfully, it is determined that the version information matches the version information of the dependent code package that the target code package can depend on in the version dependency knowledge base successfully.

[0067] Exemplarily, the version dependency knowledge base includes the following information "{'programD1':'[E1,E2]'; 'programD2':'[E3,E4,E5]'}", where "'programD1':'[E1,E2]'" indicates that the target code package with the code package name "programD1" is suitable for introducing dependent code packages E1 and E2, and the same applies to other information; when the target code package name is "programD1", the version information of the target code package is determined to be "group01-artifact02-3.4.5", and the non-numeric text is separated from the above version information: the organization name "group01" and the identifier "artifact02" of the target code package, and the numeric text: the target code package. The version number of the package is "3.4.5", the organization name and identifier of the dependent code package E1 are obtained, and "group01" and "artifact02" are obtained. The organization name and identifier of the dependent code package E2 are obtained, and "group03" and "artifact04" are obtained. Therefore, the dependent code package E1 is used as the matching code package; the version number of the dependent code package E1 is determined to be "3.4.5". Since the version number of the target code package and the version number of the matching code package are the same, it is determined that the first numerical text and the second numerical text match successfully, and it is determined that the version information of the dependent code package introduced into the target code package is the same as the version information of the dependent code package applicable to the target code package in the version dependency knowledge base, that is, the version information matches the version information of the dependent code package that the target code package can depend on in the version dependency knowledge base.

[0068] The matching code package is determined according to the non-numeric text of the version information, and the version information of the matching code package is matched according to the numeric text of the version information, so as to improve the flexibility and efficiency of dependency detection.

[0069] According to another reference embodiment of the present invention, when matching the first numerical text with the second numerical text, the first numerical text is first converted into a first numerical list, and the second numerical text is converted into a second numerical list. For example, the first numerical text is represented as "main version number. sub-version number 1. sub-version number 2", and according to the separator ".", the first numerical text is converted into a list with three elements, and the three elements are "main version number", "sub-version number 1" and "sub-version number 2" from left to right. The conversion method of the second numerical text is similar, and the second numerical text is also split according to the separator, and each split result is used as a list element.

[0070] Then, the list position is determined according to the preset numerical comparison order. The list position is the storage position of the value to be compared in the list. For example, if the preset numerical comparison order is to compare from left to right, the list positions are 1, 2, and 3 (assuming that the left side of the list is the starting position of the element), or if the comparison is from right to left, the list positions are 3, 2, and 1.

[0071] Get the target value from the list position of the first value list, and get the target value range from the list position of the second value list. Specifically, the format of each element in the first value list is a value, which is the target value; the format of each element in the second value list is a value range, which is the target value range; the second value text includes the maximum and minimum values ​​of all types of version numbers, and the version number between the maximum and minimum values ​​is the successfully matched version number. Determine whether the target value is within the target value range. If all target values ​​are within the corresponding target value range, it is determined that the first value text and the second value text match successfully.

[0072] Exemplarily, the first numerical text is "6.7.8", which is converted into the first numerical list to obtain "[6,7,8]", where the numerical value at the first list position of the first numerical list is "6", and so on for other list positions; the second numerical text is "5-7.1-8.6-10", which is converted into the second numerical list to obtain "[5-7,1-8,6-10]", where the numerical range at the first list position of the second numerical list is "5 to 7", and so on for other list positions; comparing the numerical value and the numerical range at the same list position, it is obtained that 6 is between 5 and 7, 7 is between 1 and 8, and 8 is between 6 and 10, therefore, it is determined that the first numerical text and the second numerical text match successfully.

[0073] Comparing the target value with the target value range can improve the flexibility and efficiency of value comparison. In addition, using the value range instead of the enumerable value can reduce the amount of data required to be stored and save system resources occupied by the version-dependent knowledge base.

[0074] According to another reference embodiment of the present invention, when the corresponding matching code package is not determined from the dependent code package set, it means that there is no dependent code package in the dependent code package set with the same version information as the organization name, identifier, package type, scope, etc. of the dependent code package introduced by the target code package, that is, there is a new dependency relationship between the dependent code package and the target code package, and it is not stored in the version dependency knowledge base. Therefore, the version information of the target code package and the dependent code package is associated and stored in the version dependency knowledge base. Specifically, according to the target code package name, the corresponding dependent code package set is determined, and the version information of the dependent code package that has a new dependency relationship with the target code package is stored in the dependent code package set, for example, the version information of the dependent code package, such as the organization name, identifier, version number, package type and scope, is stored in the dependent code package set corresponding to the target code package.

[0075] Exemplarily, the version dependency knowledge base includes multiple dependency code package collection tables, and inserts a piece of data into the dependency code package collection table corresponding to the target code package, the data including version information such as the organization name, identifier, version number, package type and scope of the dependency code package.

[0076] In the case that there is no matching code package, the relevant information of the dependent code package and the target code package is associated and stored in the version dependency knowledge database, which can timely update the version dependency knowledge base and improve the detection efficiency and accuracy of the dependency relationship.

[0077] According to a reference embodiment of the present invention, the name and resource address of the dependent code package corresponding to the received knowledge base update request are obtained from the version dependency knowledge base. The resource address represents the acquisition address of the dependent code package, and the resource address stores the dependency relationships between various versions of dependent code packages and different dependent code packages. Specifically, the execution subject of the embodiment of the present invention parses the received knowledge base update request to determine the range of dependent code packages that need to be obtained. For example, the knowledge base update request is parsed to obtain a field. When the field is "all", the names and corresponding resource addresses of all dependent code packages corresponding to the version dependency knowledge base are obtained. When the field is "program003", the names and corresponding resource addresses of all dependent code packages corresponding to the target code package named "program003" are obtained. Each dependent code package name corresponds to a resource address, and each resource address corresponds to one or more dependent code package names.

[0078] After the dependent code package is updated and iterated, a new dependent code package is obtained. The new dependent code package has new version information. The new dependent code package and the new version information will be uploaded to the resource address. The version information to be updated corresponding to the dependent code package name is obtained from the resource address. The version information to be updated is the new version information after the dependent code package in the resource address is updated. For the version dependency knowledge base, it is the version information to be updated.

[0079] Search the version dependency knowledge base for historical version information corresponding to the version information to be updated. For example, query the version dependency knowledge base for historical version information that has the same organization name and identifier as the version information to be updated. When the historical version information is found, update the historical version information according to the version information to be updated. Specifically, use the organization name, identifier, version number, package type, scope and other information in the version information to be updated to replace the corresponding information in the historical version information. When the historical version information is not found, this part of the version information is missing in the version dependency knowledge base. Therefore, the version information to be updated is associated with the name of the dependent code package and stored in the version dependency knowledge base.

[0080] Exemplarily, in the version dependency knowledge base, the target code package F1 and the dependent code package F2 have a dependency relationship, that is, introducing the dependent code package F2 into the target code package F1 will not cause a dependency conflict; the version information of the dependent code package F2 includes: organization name f3, identifier f4, version number f5, and according to the resource address corresponding to the dependent code package F2, the version information of the dependent code package F2 after the update is obtained as the version information to be updated. The version information to be updated includes: organization name f3, identifier f4 and version number f6. By comparison, it can be seen that the version number of the dependent code package F2 has been modified. Therefore, the version number of the dependent code package F2 in the version dependency knowledge base is changed from f5 to f6.

[0081] Updating the version information included in the version dependency knowledge base according to the dependent package name and resource address can improve the efficiency and accuracy of dependency detection.

[0082] According to another reference embodiment of the present invention, the resource address includes a page address and a tag address. When obtaining the version information to be updated corresponding to the name of the dependent code package from the resource address, first determine the corresponding target page according to the page address. For example, the page address is "https: / / hbase.apache.org / book.html", access the page address, determine the target page, and define the dependency relationship between Hbase and Hadoop in the target page.

[0083] Then, according to the tag address, the corresponding target page element is determined from the target page. The tag address is the address of the page element in the target page. For example, the tag address is an xpath path. Specifically, the value of the tag address is " / html / body / div[4] / div[7] / div / div

[10] / table[6]". The tag address points to the page element corresponding to "table 8" in the target page that defines the dependency relationship between Hbase and Hadoop. This page element is used as the target page element.

[0084] Get the page text included in the target page element, and extract the version information to be updated corresponding to the name of the dependent code package from the page text. For example, read the content in the page element "table 8" to determine the dependency relationship between Hbase and Hadoop of different version information. The methods for extracting the target page content applicable to the embodiment of the present invention include: BeautifulSoup, lxml library, etc.

[0085] Determining the target page according to the page address and determining the target page element in the target page according to the tag address can accurately and efficiently obtain the version information to be updated, facilitate timely updating of the version dependency knowledge base, and improve the accuracy of code package dependency detection.

[0086] According to another reference embodiment of the present invention, before extracting the to-be-updated version information corresponding to the dependent code package name from the page text, the page signature information corresponding to the page text is determined. For example, the text information is extracted from the target page, the garbled characters or null values ​​in the text information are removed, and then the text information is encrypted, and the encrypted text information is used as the page signature information.

[0087] The page signature information is compared with the historical signature information corresponding to the page text. Specifically, the execution subject of the embodiment of the present invention stores the page signature information determined each time, for example, in a dependent version knowledge base, and uses the stored page signature information as historical signature information. The page signature information is compared with the historical signature information to determine whether the page signature information is equal to the historical signature information. When the page signature information is equal to the historical signature information, it means that the target page has not been updated since the last time the page information was extracted. Therefore, there is no version information to be updated in the target page. When the page signature information is not equal to the historical signature information, it means that the target page has been updated since the last time the page information was extracted. Therefore, there is version information to be updated in the target page, and the version information to be updated corresponding to the dependent code package name should be extracted from the page text.

[0088] Exemplarily, the execution subject of the embodiment of the present invention downloads the target page to the local, traverses the target page, extracts the text information therein, encrypts the extracted text information using the MD5 encryption algorithm, and obtains the page signature information; obtains the historical signature information of the target page from the version dependency knowledge base, compares the page signature information with the historical signature information, and when the page signature information and the historical signature information are not equal, obtains the version information to be updated from the target page.

[0089] Before obtaining new version information, determining whether the target page is updated based on the page signature information can improve the accuracy of version information acquisition, avoid obtaining duplicate information, and save system resources.

[0090] According to a reference embodiment of the present invention, when determining the target code package corresponding to the received detection request, the initiation event of the detection request is first determined. The initiation event represents an event used to generate the detection request. The detection request is generated after the initiation event is detected. After the initiation event occurs, the execution subject of the embodiment of the present invention processes the detection request and determines the corresponding target code package.

[0091] Specifically, when the initiating event is to process a code compilation request, the code package corresponding to the code compilation request is used as the target code package. The code range corresponding to the code compilation request is determined, that is, the code range that needs to be compiled. Before compiling the code within the code range, the code package where the code within the code package range is located is used as the target code package, and it is determined whether there is a dependency conflict in the dependent code package introduced into the target code package.

[0092] In the case where the initiating event is to process a project start request, the target project corresponding to the project start request is determined, and the code package included in the target project is used as the target code package. Specifically, the code package in the root directory pointed to by the target project is used as the target code package. Before starting the target project, it is determined whether there is a dependency conflict in the dependent code package introduced into the target code package.

[0093] When the initiating event is receiving a code repository address, the code package stored in the code repository address is used as the target code package. Specifically, the user sends the code repository address to the execution subject of the embodiment of the present invention, and the execution subject of the embodiment of the present invention uses the code package in the code repository address as the target code package, and determines whether there is a dependency conflict in the dependent code package introduced into the target code package.

[0094] The execution subject of the embodiment of the present invention determines the target code package in various business scenarios such as before code compilation, before project startup, and after receiving the code repository address, and performs dependency judgment on the dependent code packages introduced into the target code package. This can meet the dependency detection requirements in different business scenarios and flexibly and efficiently detect the dependency between code packages.

[0095] According to another reference embodiment of the present invention, in the process of detecting the dependency relationship of the code package, or in the process of updating the version information of the version dependency knowledge base, an operation record of the version dependency knowledge base is generated, and the operation log of the version dependency knowledge base is updated. The operation log of the version dependency knowledge base includes: operation type (for example, query, update, delete, modify, etc.), operation object (for example, version information of a dependent code package, version information of a target code package, etc.), operation time, operation result (for example, operation success or failure), captured exception information, etc.

[0096] Generate statistical information of the version dependency knowledge base based on the operation log. The statistical information of the version dependency knowledge base includes: version information of the target code package and / or dependent code package, changes in version information of the dependent code package introduced into the target code package, changes in the number of dependent code packages introduced into the target code package, the number of times dependency conflicts are detected in the dependent code package in the target code package, the number of dependency conflicts that occur during code compilation or project startup, etc. The period for generating statistical information can be daily, weekly or monthly, for example, it can be sent to users such as R&D personnel or testers in the form of daily, weekly or monthly reports, so that users can understand the dependencies in the code packages in a timely and accurate manner.

[0097] After receiving the export request, the statistical information is exported as a statistical file. The method for exporting the statistical file applicable to the embodiment of the present invention includes: EasyExcel, an Excel file generation framework based on Apache POI.

[0098] Generating and exporting the operation log of the version dependency knowledge base is helpful for querying the latest code package dependencies and facilitating timely resolution of dependency conflicts in the project.

[0099] Figure 2 is a schematic diagram of a system architecture for detecting code package dependencies according to a reference embodiment of the present invention. Figure 2 As shown, the execution body of the embodiment of the present invention includes: an information extraction module, a version dependency knowledge base, a front-end display module, a file export module, a back-end management module, a dependency detection module, a trigger detection module, a dependency conflict resolution module and other modules. Specifically, the information extraction module obtains the latest version information of the dependent code package from the network resource address, and stores the latest version information in the dependent version knowledge base. The trigger detection module detects the code compilation request, the project startup request and the code address upload interface. Before the code is compiled, before the project is started and after the code warehouse address is received, the target code package is determined, and the dependent version package introduced in the target code package is sent to the dependency detection module. The dependency detection module matches the version information of the dependent code package with the version information of the dependent code package that the target code package can depend on in the version dependency knowledge base. If the match is successful, it is determined that the dependent code package introduced in the target code package will not cause a dependency conflict. In the case of unsuccessful matching, it is determined that the dependent code package introduced in the target code package will cause a dependency conflict. Therefore, a prompt message is sent to the user, asking the user to handle it in time, or the version information of the dependent code package that will cause the dependency conflict is sent to the dependency conflict resolution module, and the dependency conflict resolution module shields the dependent code package introduced in the target code package; the user queries the dependency detection results of the target code package, the latest version information stored in the version dependency knowledge base, and statistical information through the front-end display module; the queried detection results, version information, statistical information and other information are exported as files through the file export module; the network resource address and other information of the dependent code package are configured through the back-end management module.

[0100] Figure 3 FIG. 1 is a schematic diagram of the main process of updating a version-dependent knowledge base according to a reference embodiment of the present invention. Figure 3 As shown, the execution subject of the embodiment of the present invention obtains the first dependent code package name and the corresponding resource address from the version dependency knowledge base in response to receiving a knowledge base update request; uses a crawler tool to periodically obtain the second dependent code package name and the corresponding version information from the target page corresponding to the resource address; determines whether the first dependent code package name is the same as the second dependent code package name, and if the first dependent code package name is the same as the second dependent code package name, uses the version information corresponding to the second dependent code package name to replace the version information corresponding to the first dependent code package name; if the first dependent code package name is different from the second dependent code package name, stores the version information corresponding to the second dependent code package name in the version dependency knowledge base.

[0101] Figure 4 FIG. 1 is a schematic diagram of the main process of detecting code package dependencies according to a reference embodiment of the present invention. For example, Figure 4 As shown, the execution subject of the embodiment of the present invention determines the corresponding code repository address in response to receiving the detection request, pulls the target code package from the code repository address; determines the version information of the dependent code package introduced in the target code package; matches the organization name and identifier in the version information with the version dependent code package to determine the matching code package; determines whether the version number in the version information is consistent with the version number range corresponding to the matching code package; when the version number in the version information is consistent with the version number range corresponding to the matching code package, determines that the dependent code package introduced in the target code package will not cause a dependency conflict; when the version number in the version information is not consistent with the version number range corresponding to the matching code package, determines that the dependent code package introduced in the target code package will cause a dependency conflict.

[0102] Figure 5 FIG. 1 is a schematic diagram of the main process of a method for detecting code package dependencies according to a reference embodiment of the present invention. Figure 5 As shown, the detection method of code package dependency may include: step S501, determining the target code package corresponding to the received detection request; step S502, determining the version information of the dependent code package introduced by the target code package; step S503, determining the dependent code package set corresponding to the target code package from the version dependency knowledge base; step S504, determining the version information of the dependent code package introduced by the target code package; step S505, determining the corresponding matching code package from the dependent code package set according to the non-numeric text included in the version information; step S506, judging whether there is a matching code package, if so, jumping to step S508, otherwise, jumping to step S507; step S507, associating the version information of the target code package and the dependent code package and storing it in the version dependency knowledge base; step S508, taking the numerical text included in the version information as the first numerical text, and converting the first numerical text into a first numerical list; Step S509, taking the numerical text corresponding to the matching code package as the second numerical text, and converting the second numerical text into a second numerical list; Step S510, determining the list position according to the preset numerical comparison order; Step S511, obtaining the target numerical value from the list position of the first numerical list, and obtaining the target numerical range from the list position of the second numerical list; Step S512, judging whether the target numerical value is within the target numerical range, if so, jumping to step S513, otherwise, jumping to step S514; Step S513, judging that the version information matches the version information of the dependent code package that the target code package can depend on in the version dependency knowledge base successfully, and the dependency relationship between the dependent code package and the target code package is valid; Step S514, judging that the version information does not match the version information of the dependent code package that the target code package can depend on in the version dependency knowledge base successfully, and there is a dependency conflict between the dependent code package and the target code package. The specific implementation content of the code package dependency detection method of the above-mentioned reference embodiment of the present invention has been described in detail in the above code package dependency detection method, so the repeated content will not be described here.

[0103] Figure 6 FIG. 1 is a schematic diagram of the main process of a method for detecting code package dependencies according to another reference embodiment of the present invention. Figure 6 As shown, the code package dependency detection method may include: step S601, determining the target code package corresponding to the received detection request; step S602, determining the version information of the dependent code package introduced by the target code package; step S603, matching the version information of the dependent code package that the target code package can depend on in the version information version dependency knowledge base; step S604, judging whether the match is successful, if so, jumping to step S606, otherwise, jumping to step S605; step S605, judging whether there is a dependency conflict between the dependent code package and the target code package; step S606, judging whether the dependency relationship between the dependent code package and the target code package is valid; step S6 07, obtain the dependent code package name and resource address corresponding to the received knowledge base update request from the version dependency knowledge base; step S608, obtain the version information to be updated corresponding to the dependent code package name from the resource address; step S609, search the version dependency knowledge base for historical version information corresponding to the version information to be updated; step S610, determine whether the historical version information is found, if so, jump to step S612, otherwise, jump to step S611; step S611, associate the version information to be updated with the dependent code package name and store it in the version dependency knowledge base; step S612, update the historical version information according to the version information to be updated. The specific implementation content of the code package dependency detection method of another reference embodiment of the present invention has been described in detail in the code package dependency detection method described above, so the repeated content will not be described here.

[0104] According to a second aspect of an embodiment of the present invention, a device for detecting code package dependencies is provided. Figure 7 is a schematic diagram of main modules of a device for detecting code package dependencies according to an embodiment of the present invention, such as Figure 7 As shown, the detection device 700 for code package dependency mainly includes: a first determination module 701, used to determine the target code package corresponding to the received detection request; a second determination module 702, used to determine the version information of the dependent code package introduced by the target code package; a matching module 703, used to match the version information with the version information of the dependent code package that the target code package can depend on in a preset version dependency knowledge base, and in response to the version information and the version information of the dependent code package that the target code package can depend on in the version dependency knowledge base successfully matching, it is determined that the dependency relationship between the dependent code package and the target code package is valid.

[0105] According to a reference embodiment of the present invention, the matching module is also used to: determine a set of dependent code packages corresponding to the target code package from a version dependency knowledge base; determine a matching code package corresponding to the target code package from the dependent code package set based on the non-numeric text included in the version information; use the numerical text included in the version information as the first numerical text, and the numerical text corresponding to the matching code package as the second numerical text, match the first numerical text with the second numerical text, and in response to a successful match between the first numerical text and the second numerical text, determine that the version information matches the version information of the dependent code package on which the target code package can depend in the version dependency knowledge base successfully.

[0106] According to another reference embodiment of the present invention, the matching module is also used to: convert the first numerical text into a first numerical list, and convert the second numerical text into a second numerical list; determine the list position according to a preset numerical comparison order; obtain the target numerical value from the list position of the first numerical list, and obtain the target numerical range from the list position of the second numerical list; in response to the target numerical value being within the target numerical range, determine that the first numerical text and the second numerical text are successfully matched.

[0107] According to another reference embodiment of the present invention, the code package dependency detection device 700 also includes: a storage module, which is used to associate and store version information of the target code package and the dependent code package in a version dependency knowledge base in response to not determining a matching code package corresponding to the target code package from the dependent code package set.

[0108] According to another reference embodiment of the present invention, the code package dependency detection device 700 also includes: a first acquisition module, used to obtain the dependent code package name and resource address corresponding to the received knowledge base update request from the version dependency knowledge base; a second acquisition module, used to obtain the version information to be updated corresponding to the dependent code package name from the resource address; a knowledge base update module, used to respond to finding historical version information corresponding to the version information to be updated in the version dependency knowledge base, and update the historical version information according to the version information to be updated; in response to not finding the historical version information in the version dependency knowledge base, the version information to be updated is associated with the dependent code package name and stored in the version dependency knowledge base.

[0109] According to another reference embodiment of the present invention, the resource address includes: a page address and a tag address; the second acquisition module is also used to: determine the corresponding target page according to the page address; determine the corresponding target page element from the target page according to the tag address; obtain the page text included in the target page element, and extract the version information to be updated corresponding to the dependent code package name from the page text.

[0110] According to a reference embodiment of the present invention, the code package dependency detection device 700 also includes: a third determination module, used to determine the page signature information corresponding to the page text; a judgment module, used to compare the page signature information with the historical signature information corresponding to the page text, and determine that the page signature information is not equal to the historical signature information.

[0111] According to another reference embodiment of the present invention, the first determination module is also used to: determine an initiating event of an identification request; in response to the initiating event being to process a code compilation request, use the code package corresponding to the code compilation request as a target code package; in response to the initiating event being to process a project startup request, determine a target project corresponding to the project startup request, and use the code package included in the target project as the target code package; in response to the initiating event being to receive a code repository address, use the code package stored in the code repository address as the target code package.

[0112] According to another reference embodiment of the present invention, the code package dependency detection device 700 also includes: a log update module for updating the operation log of the version dependency knowledge base; a generation module for generating statistical information of the version dependency knowledge base based on the operation log; and an export module for exporting the statistical information as a statistical file in response to receiving an export request.

[0113] It should be noted that the specific implementation content of the device for detecting code package dependencies in the embodiment of the present invention has been described in detail in the above method for detecting code package dependencies, so the repeated content will not be described again here.

[0114] According to the technical solution of the embodiment of the present invention, by matching the version information of the dependent code package based on the version dependency knowledge base, it is possible to quickly determine whether the dependency relationship between the dependent code package and the target code package is valid, thereby improving the detection efficiency and accuracy of the code package dependency relationship and reducing labor costs; determining the matching code package based on the non-numeric text of the version information, and matching the version information of the matching code package based on the numeric text of the version information, which can improve the flexibility and detection efficiency of the dependency detection; comparing the target value with the target value range, which can improve the flexibility and efficiency of the value comparison and save the system resources occupied by the version dependency knowledge base; in the case where there is no matching code package, the relevant information of the dependent code package and the target code package is associated and stored To the version dependency knowledge database, the version dependency knowledge base can be updated in time to improve the efficiency and accuracy of dependency detection; according to the dependency package name and resource address, the version information included in the version dependency knowledge base is updated to improve the efficiency and accuracy of dependency detection; before obtaining new version information, the target page is determined to be updated according to the page signature information, which can improve the accuracy of version information acquisition and avoid obtaining duplicate information; when the code is compiled, the project is started, and the code warehouse address is received, the target code package is determined, and the detection method can be flexibly executed to meet various business needs; generating and exporting the operation log of the version dependency knowledge base is conducive to querying the latest code package dependencies and facilitating the timely resolution of dependency conflicts in the project.

[0115] According to a third aspect of an embodiment of the present invention, there is provided an electronic device, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method provided by the first aspect of the embodiment of the present invention.

[0116] According to a fourth aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored, and when the program is executed by a processor, the method provided by the first aspect of the embodiment of the present invention is implemented.

[0117] According to a fifth aspect of an embodiment of the present invention, there is provided a computer program product, including a computer program, which implements the method of any of the above embodiments when executed by a processor.

[0118] Figure 8 An exemplary system architecture 800 is shown to which the method for detecting code package dependency or the apparatus for detecting code package dependency according to the embodiments of the present invention may be applied.

[0119] like Figure 8 As shown, system architecture 800 may include terminal devices 801, 802, 803, a network 804, and a server 805. Network 804 is used to provide a medium for communication links between terminal devices 801, 802, 803 and server 805. Network 804 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.

[0120] The user can use the terminal devices 801, 802, 803 to interact with the server 805 through the network 804 to receive or send messages, etc. Various communication client applications can be installed on the terminal devices 801, 802, 803, such as dependency conflict detection applications, dependency conflict prompt applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).

[0121] The terminal devices 801 , 802 , and 803 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.

[0122] Server 805 may be a server that provides various services, such as a background management server (only as an example) that provides support for code package dependency detection requests sent by upstream terminal devices 801, 802, and 803. The background management server may determine the target code package corresponding to the received detection request; determine the version information of the dependent code package introduced by the target code package; match the version information with the version information of the dependent code package that the target code package can depend on in the preset version dependency knowledge base, and in response to the version information successfully matching the version information with the version information of the dependent code package that the target code package can depend on in the version dependency knowledge base, determine that the dependency relationship between the dependent code package and the target code package is valid; and feed back the detection status of the code package dependency (only as an example) to the terminal device.

[0123] It should be noted that the code package dependency detection method provided in the embodiment of the present invention is generally executed by the server 805, and accordingly, the code package dependency detection device is generally set in the server 805. The code package dependency detection method provided in the embodiment of the present invention can also be executed by the terminal devices 801, 802, and 803, and accordingly, the code package dependency detection device can be set in the terminal devices 801, 802, and 803.

[0124] It should be understood that Figure 8 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0125] Reference below Fig. 9 , which shows a schematic diagram of the structure of a computer system 900 of a terminal device suitable for implementing an embodiment of the present invention. Fig. 9 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0126] like Fig. 9 As shown, the computer system 900 includes a central processing unit (CPU) 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage part 908 into a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the system 900 are also stored. The CPU 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.

[0127] The following components are connected to the I / O interface 905: an input section 906 including a keyboard, a mouse, etc.; an output section 907 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 908 including a hard disk, etc.; and a communication section 909 including a network interface card such as a LAN card, a modem, etc. The communication section 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to the I / O interface 905 as needed. A removable medium 911, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 910 as needed, so that a computer program read therefrom is installed into the storage section 908 as needed.

[0128] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 909, and / or installed from the removable medium 911. When the computer program is executed by the central processing unit (CPU) 901, the above-mentioned functions defined in the system of the embodiment of the present invention are executed.

[0129] It should be noted that the computer-readable medium shown in the embodiment of the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In an embodiment of the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In an embodiment of the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0130] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0131] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor, for example, it may be described as: a processor includes a first determination module, a second determination module, and a matching module, wherein the names of these modules do not constitute a limitation on the modules themselves under certain circumstances, for example, the matching module may also be described as "a module for determining a target code package corresponding to a received detection request".

[0132] As another aspect, an embodiment of the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device implements the following method: determining a target code package corresponding to a received detection request; determining the version information of a dependent code package introduced by the target code package; matching the version information with the version information of the dependent code package that the target code package can depend on in a preset version dependency knowledge base, and in response to the version information and the version information of the dependent code package that the target code package can depend on in the version dependency knowledge base successfully matching, determining that the dependency relationship between the dependent code package and the target code package is valid, wherein the version dependency knowledge base is used to store the dependency relationship between the code package and the dependent code package.

[0133] According to the technical solution of the embodiment of the present invention, by matching the version information of the dependent code package based on the version dependency knowledge base, it is possible to quickly determine whether the dependency relationship between the dependent code package and the target code package is valid, thereby improving the detection efficiency and accuracy of the code package dependency relationship and reducing labor costs; determining the matching code package based on the non-numeric text of the version information, and matching the version information of the matching code package based on the numeric text of the version information, which can improve the flexibility and detection efficiency of the dependency detection; comparing the target value with the target value range, which can improve the flexibility and efficiency of the value comparison and save the system resources occupied by the version dependency knowledge base; in the case where there is no matching code package, the relevant information of the dependent code package and the target code package is associated and stored To the version dependency knowledge database, the version dependency knowledge base can be updated in time to improve the efficiency and accuracy of dependency detection; according to the dependency package name and resource address, the version information included in the version dependency knowledge base is updated to improve the efficiency and accuracy of dependency detection; before obtaining new version information, the target page is determined to be updated according to the page signature information, which can improve the accuracy of version information acquisition and avoid obtaining duplicate information; when the code is compiled, the project is started, and the code warehouse address is received, the target code package is determined, and the detection method can be flexibly executed to meet various business needs; generating and exporting the operation log of the version dependency knowledge base is conducive to querying the latest code package dependencies and facilitating the timely resolution of dependency conflicts in the project.

[0134] The above specific implementations do not constitute a limitation on the protection scope of the embodiments of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the embodiments of the present invention should be included in the protection scope of the embodiments of the present invention.< / exclusions> < / scope> < / type> < / version> < / artifactid> < / groupid>

Claims

1. A method for detecting code package dependencies, characterized in that: include: determining a target code package corresponding to the received detection request; Determining version information of a dependent code package introduced by the target code package; The version information is matched with the version information of the dependent code package that the target code package can depend on in a preset version dependency knowledge base, and in response to the version information and the version information of the dependent code package that the target code package can depend on in the version dependency knowledge base successfully matching, it is determined that the dependency relationship between the dependent code package and the target code package is valid, wherein the version dependency knowledge base is used to store the dependency relationship between the code package and the dependent code package.

2. The method according to claim 1, characterized in that Matching the version information with the version information of the dependent code package that the target code package can depend on in a preset version dependency knowledge base includes: Determine a set of dependent code packages corresponding to the target code package from the version dependency knowledge base; Determining, according to the non-numeric text included in the version information, a matching code package corresponding to the target code package from the dependent code package set; The numerical text included in the version information is taken as the first numerical text, and the numerical text corresponding to the matching code package is taken as the second numerical text. The first numerical text is matched with the second numerical text. In response to a successful match between the first numerical text and the second numerical text, it is determined that the version information successfully matches the version information of the dependent code package that the target code package can depend on in the version dependency knowledge base.

3. The method according to claim 2, characterized in that Matching the first numerical text with the second numerical text includes: Convert the first numerical text into a first numerical list, and convert the second numerical text into a second numerical list; Determine the list position according to the preset numerical comparison order; Acquire a target value from the list position of the first value list, and acquire a target value range from the list position of the second value list; In response to the target numerical value being within the target numerical value range, it is determined that the first numerical text matches the second numerical text successfully.

4. The method according to claim 2, characterized in that: The method further comprises: In response to not determining a matching code package corresponding to the target code package from the dependent code package set, the version information of the target code package and the dependent code package are associated and stored in the version dependency knowledge base.

5. The method according to claim 1, characterized in that The method further comprises: Acquire a dependent code package name and a resource address corresponding to the received knowledge base update request from the version dependency knowledge base; Obtain the to-be-updated version information corresponding to the dependent code package name from the resource address; In response to finding historical version information corresponding to the version information to be updated in the version dependency knowledge base, the historical version information is updated according to the version information to be updated; in response to not finding the historical version information in the version dependency knowledge base, the version information to be updated is associated with the dependent code package name and stored in the version dependency knowledge base.

6. The method according to claim 5, characterized in that The resource address includes: page address and tag address; Obtaining the to-be-updated version information corresponding to the dependent code package name from the resource address includes: According to the page address, determining a corresponding target page; Determining a corresponding target page element from the target page according to the tag address; The page text included in the target page element is obtained, and the version information to be updated corresponding to the dependent code package name is extracted from the page text.

7. The method according to claim 6, characterized in that Before extracting the to-be-updated version information corresponding to the dependent code package name from the page text, the method further includes: Determine page signature information corresponding to the page text; The page signature information is compared with the historical signature information corresponding to the page text to determine that the page signature information is not equal to the historical signature information.

8. The method according to claim 1, characterized in that Determine a target code package corresponding to the received detection request, including: Determining an initiating event of the detection request; In response to the initiating event being a processing code compiling request, taking a code package corresponding to the code compiling request as a target code package; In response to the initiation event being a project initiation request, determining a target project corresponding to the project initiation request, and using a code package included in the target project as a target code package; In response to the initiating event being receiving a code repository address, the code package stored in the code repository address is used as a target code package.

9. The method according to claim 1 or 5, characterized in that: The method further comprises: Updating the operation log of the version dependency knowledge base; Generate statistical information of the version dependency knowledge base according to the operation log; In response to receiving the export request, the statistical information is exported as a statistical file.

10. A device for detecting code package dependencies, characterized in that: include: A first determination module, used to determine a target code package corresponding to the received detection request; A second determining module, used to determine version information of a dependent code package introduced by the target code package; A matching module is used to match the version information with the version information of the dependent code package that the target code package can depend on in a preset version dependency knowledge base, and in response to the version information and the version information of the dependent code package that the target code package can depend on in the version dependency knowledge base successfully matching, determine that the dependency relationship between the dependent code package and the target code package is valid, wherein the version dependency knowledge base is used to store the dependency relationship between the code package and the dependent code package.

11. An electronic device, characterized in that: include: One or more processors; A storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 9.

12. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.

13. A computer program product, comprising a computer program, wherein when the program is executed by a processor, the program implements the method according to any one of claims 1 to 9.

Citation Information

Cited By

  • Hierarchical coding-based dynamic subpackage loading method and system for application program

    CN120653328A