A method for downloading dependent packages and related components
By sorting and compressing the storage paths of dependent packets and other dependent packets in the external network environment, and using data migration equipment to send them to the intranet environment for decompression, the complexity of dependent packet acquisition in the intranet environment is solved, and an efficient dependent packet transmission and decompression process is achieved.
Patent Information
- Application Number
- CN202310182877.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-24
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2043-02-24
AI Technical Summary
In industrial production or Internet company intranet environments, the process of manually obtaining dependency packages is complicated, because dependency packages often rely on other packages, forming alternating dependencies, resulting in incomplete downloads or difficulty in finding all dependencies.
After downloading dependent packages and other dependent packages in the external network environment, they are sorted and compressed according to the storage path, sent to the intranet environment through the data migration device, and decompressed according to the storage path in the intranet environment.
It avoids the problem of incomplete download of all dependency packages or difficulty in finding dependency packages, and improves the efficiency and convenience of obtaining dependency packages.
Smart Images

Figure CN116170433B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing, and particularly to a method for downloading dependent packages and related components. Background Art
[0002] In the industrial production or the intranet environment of an Internet company, in order to prevent the leakage of the company's confidential data, the internal environment network is not allowed to obtain and download data from the external network. At this time, when a certain Java project needs to add dependencies or plugin packages, it is necessary to obtain them from the external environment through other transmission methods, such as a secure intranet system or USB flash drive reading. However, the process of copying these dependencies or plugin packages is often complex because some dependent packages often depend on other packages, and other packages may in turn depend on other packages (a certain dependent package needs to depend on A, B, C..., and dependent package A needs to depend on packages a, b, c, d, and so on to form an alternating dependency). Therefore, it is a time-consuming and laborious task to manually find all the packages on which the dependency or plugin depends and copy them to the intranet environment through the secure intranet or USB flash drive. Figure 1 It is a schematic diagram of the dependency relationship. Summary of the Invention
[0003] The purpose of the present invention is to provide a method for downloading dependent packages and related components, which can avoid incomplete downloading of all dependent packages or difficulty in finding dependent packages.
[0004] To solve the above technical problems, the present invention provides a method for downloading dependent packages, including:
[0005] Downloading the dependent package and other dependent packages required by the dependent package in the external network environment;
[0006] Sorting and compressing the dependent packages according to the storage paths;
[0007] Sending the dependent packages to the intranet environment through a data migration device;
[0008] Uncompressing the dependent packages according to the storage paths in the intranet environment.
[0009] Preferably, before downloading the dependent package and other dependent packages required by the dependent package in the external network environment, it further includes:
[0010] Setting the dependent packages to be downloaded and the pom files of the dependent packages, where the pom files include the storage paths of the dependent packages, other dependent packages required by the dependent packages, and the versions of the dependent packages.
[0011] Preferably, downloading the dependent package and other dependent packages required by the dependent package in the external network environment includes:
[0012] Setting a dependent package list in the external network environment;
[0013] Parse the pom file of the current dependent package;
[0014] Determine whether other dependent packages required by the current dependent package in the pom file are in the dependent package list;
[0015] If not, download the other dependent packages and their pom files;
[0016] Determine whether the pom file of the current dependent package has been completely parsed;
[0017] If the pom file of the current dependent package has been completely parsed, determine whether all pom files have been completely parsed;
[0018] If there are pom files that have not been completely parsed, use the dependent packages corresponding to the pom files that have not been completely parsed as the current dependent package, and return to the step of parsing the pom file of the current dependent package;
[0019] If there are no pom files that have not been completely parsed, enter the step of organizing and compressing the dependent packages according to the storage paths;
[0020] Preferably, after determining whether the pom file of the current dependent package has been parsed, it further includes:
[0021] If the pom file of the current dependent package has not been completely parsed, return to the step of parsing the pom file of the current dependent package.
[0022] Preferably, organizing and compressing the dependent packages according to the storage paths includes:
[0023] Generate a tree, where the root node of the tree is the storage location of the tree; the storage path of the dependent package is the child node of the root node, the other dependent packages required by the dependent package are the last-level non-leaf nodes, and the version of the dependent package is the leaf node;
[0024] Compress the tree and the dependent package list.
[0025] Preferably, decompress the dependent packages according to the dependency relationship in the intranet environment;
[0026] Parse the current node in the tree in the intranet environment;
[0027] Determine whether the child nodes of the current node exist;
[0028] If the child nodes do not exist, create a folder;
[0029] Save the child nodes to the created folder, and remove the dependent packages corresponding to the child nodes from the dependent package list and the tree;
[0030] Determine whether the current node is a leaf node;
[0031] If it is a leaf node, determine whether the current dependency package list is empty;
[0032] If the current dependency package list is not empty, use the adjacent node of the current node as the current node and return the step of the current node in the parsing tree;
[0033] If the current dependency package list is empty, it is determined that the decompression is completed.
[0034] Preferably, after determining whether the current node is a leaf node, it further includes:
[0035] If it is not a leaf node, use the child node of the current node as the current node and return the step of the current node in the parsing tree.
[0036] To solve the above technical problems, the present invention also provides a system for downloading dependency packages, including:
[0037] A download unit, configured to download the dependency package and other dependency packages required by the dependency package in an external network environment;
[0038] An arrangement and compression unit, configured to arrange and compress the dependency package according to the storage path;
[0039] A sending unit, configured to send the dependency package to the internal network environment through a data migration device;
[0040] A decompression unit, configured to decompress the dependency package according to the storage path in the internal network environment.
[0041] To solve the above technical problems, the present invention also provides a device for downloading dependency packages, including:
[0042] A memory, configured to store a computer program;
[0043] A processor, configured to implement the steps of the above method for downloading dependency packages when executing the computer program.
[0044] To solve the above technical problems, the present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above method for downloading dependency packages are implemented.
[0045] The present application provides a method for downloading dependent packages and related components, which is applied to the field of data processing. In an external network environment, the dependent packages and other dependent packages required by the dependent packages are downloaded; the dependent packages are sorted and compressed according to the storage paths; the data is sent to the internal network environment through a data migration device; and the dependent packages are decompressed according to the storage paths in the internal network environment. After downloading the required dependent packages and other dependent packages required by the dependent packages in the external network environment, sorting and compressing them according to the storage paths, and decompressing them according to the storage paths during subsequent decompression, it is possible to avoid incomplete downloading of all dependent packages or difficulty in finding dependent packages. Brief Description of the Drawings
[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for use in the prior art and the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0047] Figure 1 It is a schematic diagram of a dependency relationship;
[0048] Figure 2 It is a flowchart of a method for downloading dependent packages provided by the present invention;
[0049] Figure 3 It is a schematic structural diagram of a system for downloading dependent packages provided by the present invention;
[0050] Figure 4 It is a schematic structural diagram of a device for downloading dependent packages provided by the present invention. Detailed Description of the Embodiments
[0051] The core of the present invention is to provide a method for downloading dependent packages and related components, which can avoid incomplete downloading of all dependent packages or difficulty in finding dependent packages.
[0052] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of the present invention.
[0053] In an industrial production or intranet environment of an Internet company, to prevent the leakage of the company's confidential data, the internal environment network is not allowed to access and download data from the external network. At this time, when a certain Java project needs to add dependencies or plugin packages, it is necessary to obtain them from the external environment through other transmission methods, such as a secure intranet system or USB drive reading. However, the process of copying these dependencies or plugin packages is often complex because some dependency packages often depend on other packages, and these other packages may in turn depend on other packages (a certain dependency package depends on A, B, C..., and dependency package A depends on packages a, b, c, d, and so on, forming an alternating dependency). Therefore, it is a time-consuming and laborious task to manually find all the packages on which a dependency or plugin depends and copy them to the internal environment through a secure intranet or USB drive. Figure 1 Schematic diagram of the dependency relationship.
[0054] Figure 2 The flowchart of a method for downloading dependency packages provided by the present invention, the method comprising:
[0055] S21: Download the dependency package and other dependency packages required by the dependency package in the external network environment;
[0056] Since the device needs to download the dependency package in the external network environment and then save the dependency package to the internal network environment, the dependency package can be used subsequently. Specifically, on the same device, the external network environment and the internal network environment can be realized on the same device through a virtual machine.
[0057] Download the required dependency packages and the dependency packages on which the dependency package depends in the external network environment, and complete the download of all dependency packages.
[0058] S22: Organize and compress the dependency packages according to the storage path;
[0059] Considering that the data needs to be transferred from the external network environment to the internal network environment, the data is organized and compressed before sending. The data is organized according to the storage path for subsequent searching and use in the internal network environment.
[0060] S23: Send the dependency packages to the internal network environment through a data migration device;
[0061] The data migration device can be a data security intranet system, or if there are two hosts, the dependency packages can be sent to the internal network environment through a data migration device such as a USB drive.
[0062] The specific sending method is not limited too much herein.
[0063] S24: Uncompress the dependency packages according to the storage path in the internal network environment.
[0064] Unzip the dependent packages according to the storage path in the intranet environment, and it is more convenient to call according to the storage location of the dependent packages during the use of the dependent packages.
[0065] This application provides a method for downloading dependent packages, which is applied to the field of data processing. Download the dependent packages and other dependent packages required by the dependent packages in the external network environment; organize and compress the dependent packages according to the storage path; send the data to the intranet environment through a data migration device; unzip the dependent packages according to the storage path in the intranet environment. After downloading the required dependent packages and other dependent packages required by the dependent packages in the external network environment, organize and compress them according to the storage path, and unzip them according to the storage path during the subsequent decompression process, which can avoid incomplete downloading of all dependent packages or difficulty in finding dependent packages.
[0066] Based on the above embodiments:
[0067] As a preferred embodiment, before downloading the dependent packages and other dependent packages required by the dependent packages in the external network environment, it further includes:
[0068] Set the dependent packages to be downloaded and the pom files of the dependent packages. The pom file includes the storage path of the dependent packages, other dependent packages required by the dependent packages, and the version of the dependent packages.
[0069] Before downloading the dependent packages, it is necessary to know what the dependent packages to be downloaded this time are, and it is necessary to determine the pom files of the dependent packages.
[0070] The format of the pom file is:
[0071] <groupid>path1.path2.path3...< / groupid>
[0072] <artifactid>jar-name< / artifactid>
[0073] <version>jar-version< / version>
[0074] Among them, path1.path2.path3... is the storage path of the dependent packages, jar-name is other dependent packages required by the dependent packages, and jar-version is the version of the dependent packages.
[0075] Specifically, if the dependent package Q to be downloaded in this application requires dependent packages such as A, B... H and I, then path1.path2.path3... is the storage path of Q, jar-name is the dependent packages such as A, B... H and I, and jar-version is the version number of Q.
[0076] As a preferred embodiment, downloading the dependent packages and other dependent packages required by the dependent packages in the external network environment includes:
[0077] Set the list of dependent packages in the external network environment;
[0078] Parse the pom file of the current dependent package;
[0079] Determine whether other dependent packages required by the current dependent package in the pom file are in the list of dependent packages;
[0080] If not, download other dependent packages and their pom files;
[0081] Determine whether the pom file of the current dependent package has been completely parsed;
[0082] If the pom file of the current dependent package has been completely parsed, determine whether all pom files have been completely parsed;
[0083] If there are pom files that have not been completely parsed, use the dependent packages corresponding to the unparsed pom files as the current dependent packages, and return to the step of parsing the pom file of the current dependent package;
[0084] If there are no unparsed pom files, enter the step of organizing and compressing the dependent packages according to the storage paths.
[0085] Considering that the dependency relationship of dependent packages is not one-to-one. For example, dependent package a can correspond to two dependent packages A and H. During the download process, it only needs to be downloaded once. Downloading twice will occupy memory space. Therefore, a list of dependent packages is set in advance, the pom file of the current dependent package is parsed, and it is judged whether the first dependent package in the jar-name is in the list of dependent packages. If not, download the first dependent package and its pom file. If it is, the first dependent package will not be downloaded repeatedly. Then judge whether all pom files have been parsed. If there are unparsed pom files, such as the pom file of the first dependent package, use the dependent packages corresponding to the uncompleted pom files as the current dependent packages, that is, use the first dependent package as the current dependent package, and continue to parse. If all dependent packages have been parsed, then enter the step of organizing and compressing the dependent packages according to the storage paths.
[0086] By setting the list of dependent packages, it is possible to prevent the repeated download of dependent packages, and at the same time, through continuous judgment processes, all dependent packages are downloaded.
[0087] As a preferred embodiment, after determining whether the pom file of the current dependent package has been parsed, it further includes:
[0088] If the pom file of the current dependent package has not been completely parsed, return to the step of parsing the pom file of the current dependent package.
[0089] Considering that the parsing of the pom file of the dependent packages does not download all the dependent packages at once. For example, if Q depends on dependent packages A, B... H and I, after downloading the first dependent package A, the pom file of Q is not completely parsed. At this time, the second dependent package B needs to be downloaded until all the dependent packages are downloaded, and the parsing of the dependent packages of Q is considered complete.
[0090] As a preferred embodiment, the dependent packages are sorted and compressed according to the storage paths, including:
[0091] Generating a tree, where the root node of the tree is the storage location of the tree; the storage paths of the dependent packages are the child nodes of the root node, the other dependent packages required by the dependent packages are the last-level non-leaf nodes, and the versions of the dependent packages are the leaf nodes;
[0092] Compressing the tree and the dependent package list.
[0093] The storage location of the tree can be a data-saving location such as the C drive or the desktop in the computer. For example, if the storage path of the dependent package is folder 2 in folder 1 of the C drive, then the child node of the root node is folder 1, and the child node of folder 1 is folder 2, and so on. The last-level non-leaf node of the tree is the other dependent packages required by the dependent package, and the leaf node is the version of the dependent package. Then, through the tree, the dependency relationship between the dependent packages, the version numbers of the dependent packages, and the storage locations of the dependent packages can be determined. Subsequently, parsing and saving can be performed according to the tree, which is more convenient in subsequent use.
[0094] As a preferred embodiment, the dependent packages are decompressed according to the dependency relationship in the intranet environment;
[0095] Parsing the current node in the tree in the intranet environment;
[0096] Judging whether the child nodes of the current node exist;
[0097] If the child nodes do not exist, create a folder;
[0098] Saving the child nodes to the created folder and removing the dependent packages corresponding to the child nodes from the dependent package list and the tree;
[0099] Judging whether the current node is a leaf node;
[0100] If it is a leaf node, judge whether the current dependent package list is empty;
[0101] If the current dependent package list is not empty, take the adjacent node of the current node as the current node and return to the step of parsing the current node in the parsing tree;
[0102] If the current dependent package list is empty, it is determined that the decompression is complete.
[0103] During the parsing process, it is necessary to complete the parsing of the tree layer by layer. For example, the root node is the storage location, create a folder, save the root node. Next, the child nodes of the root node are the storage paths of the dependent packages. If they do not exist, create folders to save the child nodes of the root node. After saving, remove the child nodes of the root node from the dependent packages and the tree. If the current node is a leaf node, it is necessary to determine whether there are still dependent packages in the dependent package list that have not been decompressed. If so, it is necessary to continue parsing the adjacent nodes of the current node.
[0104] The decompression process is to clear the dependent package list and transform the root node of the tree into a leaf node step by step.
[0105] As a preferred embodiment, after determining whether the current node is a leaf node, it further includes:
[0106] If it is not a leaf node, use the child nodes of the current node as the current node and return to the step of the current node in the parsing tree.
[0107] If the current node is not a leaf node, it means that the current node has not been parsed completely. Then it is necessary to parse the child nodes of the current node until the current node becomes a leaf node.
[0108] Figure 3 The following is a schematic structural diagram of a system for downloading dependent packages provided by the present invention. The system includes:
[0109] A download unit 31, which is used to download the dependent packages and other dependent packages required by the dependent packages in the external network environment;
[0110] An arrangement and compression unit 32, which is used to arrange and compress the dependent packages according to the storage paths;
[0111] A sending unit 33, which is used to send the dependent packages to the internal network environment through a data migration device;
[0112] A decompression unit 34, which is used to decompress the dependent packages according to the storage paths in the internal network environment.
[0113] Specifically, it further includes:
[0114] A first setting unit, which is used to set the dependent packages to be downloaded and the pom files of the dependent packages. The pom files include the storage paths of the dependent packages, other dependent packages required by the dependent packages, and the versions of the dependent packages.
[0115] Downloading the dependent packages and other dependent packages required by the dependent packages in the external network environment includes:
[0116] A second setting unit, which is used to set the dependent package list in the external network environment;
[0117] A parsing unit for parsing the pom file of the current dependent package;
[0118] A first judgment unit for judging whether other dependent packages required by the current dependent package in the pom file are in the dependent package list; if not, trigger the download unit 31;
[0119] The download unit 31 is specifically used to download other dependent packages and the pom files of other dependent packages;
[0120] A second judgment unit for judging whether the pom file of the current dependent package has been completely parsed; if so, trigger the third judgment unit; if not, trigger the parsing unit;
[0121] A third judgment unit for judging whether all pom files have been completely parsed; if so, trigger the first adjustment unit; if not, trigger the sorting and compression unit 32;
[0122] The first adjustment unit is used to use the dependent packages corresponding to the unparsed pom files as the current dependent packages and trigger the parsing unit;
[0123] The sorting and compression unit 32 includes a generation unit and a compression unit;
[0124] The generation unit is used to generate a tree, the root node of the tree is the storage location of the tree; the storage path of the dependent package is the child node of the root node, the other dependent packages required by the dependent package are the last-level non-leaf nodes, and the version of the dependent package is the leaf node;
[0125] The compression unit is used to compress the tree and the dependent package list.
[0126] The decompression unit 34 is used to parse the current node in the tree in the intranet environment;
[0127] A fourth judgment unit for judging whether the child nodes of the current node exist; if so, trigger the creation unit;
[0128] The creation unit is used to create a folder;
[0129] The saving unit is used to save the child nodes to the created folder and remove the dependent packages corresponding to the child nodes from the dependent package list and the tree;
[0130] A fourth judgment unit for judging whether the current node is a leaf node; if so, trigger the fifth judgment unit; if not, trigger the second adjustment unit;
[0131] A fifth judgment unit for judging whether the current dependent package list is empty; if so, trigger the third adjustment unit; if not, trigger the first determination unit;
[0132] A third adjustment unit, which is used to take the adjacent node of the current node as the current node and trigger the parsing unit;
[0133] A first determination unit, which is used to determine that the decompression is completed.
[0134] A second adjustment unit, which is used to take the child node of the current node as the current node and trigger the parsing unit.
[0135] For the introduction of the system for downloading dependency packages provided in this application, please refer to the above-mentioned embodiments, and details will not be elaborated here.
[0136] Figure 4 The following is a schematic structural diagram of a device for downloading dependency packages provided by the present invention. The device includes:
[0137] A memory 41, which is used to store computer programs;
[0138] A processor 42, which is used to implement the steps of the method for downloading dependency packages as described above when executing the computer program.
[0139] Specifically, the steps executed by the computer program include:
[0140] Download the dependency package and other dependency packages required by the dependency package in the external network environment;
[0141] Sort and compress the dependency package according to the storage path;
[0142] Send the dependency package to the internal network environment through a data migration device;
[0143] Decompress the dependency package according to the storage path in the internal network environment.
[0144] Before downloading the dependency package and other dependency packages required by the dependency package in the external network environment, it further includes:
[0145] Set the dependency package to be downloaded and the pom file of the dependency package. The pom file includes the storage path of the dependency package, other dependency packages required by the dependency package, and the version of the dependency package.
[0146] Downloading the dependency package and other dependency packages required by the dependency package in the external network environment includes:
[0147] Set a dependency package list in the external network environment;
[0148] Parse the pom file of the current dependency package;
[0149] Judge whether other dependency packages required by the current dependency package in the pom file are in the dependency package list;
[0150] If not, download other dependency packages and the pom files of other dependency packages;
[0151] Determine whether the pom file of the current dependent package has been completely parsed;
[0152] If the pom file of the current dependent package has been completely parsed, determine whether all pom files have been completely parsed;
[0153] If there is a pom file that has not been completely parsed, use the dependent package corresponding to the pom file that has not been completely parsed as the current dependent package, and return to the step of parsing the pom file of the current dependent package;
[0154] If there is no pom file that has not been completely parsed, enter the step of organizing and compressing the dependent packages according to the storage path.
[0155] After determining whether the pom file of the current dependent package has been parsed, it also includes:
[0156] If the pom file of the current dependent package has not been completely parsed, return to the step of parsing the pom file of the current dependent package.
[0157] Organizing and compressing the dependent packages according to the storage path includes:
[0158] Generate a tree, where the root node of the tree is the storage location of the tree; the storage path of the dependent package is the child node of the root node, the other dependent packages required by the dependent package are the last-level non-leaf nodes, and the version of the dependent package is the leaf node;
[0159] Compress the tree and the dependent package list.
[0160] Unzip the dependent packages according to the dependency relationship in the intranet environment;
[0161] Parse the current node in the tree in the intranet environment;
[0162] Determine whether the child nodes of the current node exist;
[0163] If the child nodes do not exist, create a folder;
[0164] Save the child nodes to the created folder, and move the dependent packages corresponding to the child nodes out of the dependent package list and the tree;
[0165] Determine whether the current node is a leaf node;
[0166] If it is a leaf node, determine whether the current dependent package list is empty;
[0167] If the current dependent package list is not empty, use the adjacent node of the current node as the current node, and return to the step of parsing the current node in the tree;
[0168] If the current dependent package list is empty, determine that the decompression is complete.
[0169] After determining whether the current node is a leaf node, it further includes:
[0170] If it is not a leaf node, use the child nodes of the current node as the current node and return the steps of the current node in the parsing tree.
[0171] For the introduction of the device for downloading dependency packages provided in this application, please refer to the above embodiments and will not be elaborated here.
[0172] This application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the steps of the above method for downloading dependency packages.
[0173] Specifically, the steps executed by the computer program include:
[0174] Download the dependency package and other dependency packages required by the dependency package in the external network environment;
[0175] Organize and compress the dependency package according to the storage path;
[0176] Send the dependency package to the internal network environment through a data migration device;
[0177] Unzip the dependency package according to the storage path in the internal network environment.
[0178] Before downloading the dependency package and other dependency packages required by the dependency package in the external network environment, it further includes:
[0179] Set the dependency packages to be downloaded and the pom files of the dependency packages. The pom file includes the storage path of the dependency package, other dependency packages required by the dependency package, and the version of the dependency package.
[0180] Downloading the dependency package and other dependency packages required by the dependency package in the external network environment includes:
[0181] Set a dependency package list in the external network environment;
[0182] Parse the pom file of the current dependency package;
[0183] Determine whether other dependency packages required by the current dependency package in the pom file are in the dependency package list;
[0184] If not, download other dependency packages and their pom files;
[0185] Determine whether the pom file of the current dependency package has been completely parsed;
[0186] If the pom file of the current dependency package has been completely parsed, determine whether all pom files have been completely parsed;
[0187] If there is an unparsed pom file, use the dependent packages corresponding to the unparsed pom file as the current dependent packages, and return the steps to parse the pom file of the current dependent packages;
[0188] If there is no unparsed pom file, enter the step of organizing and compressing the dependent packages according to the storage paths.
[0189] After determining whether the pom file of the current dependent packages is parsed, it also includes:
[0190] If the pom file of the current dependent packages is not parsed, return the steps to parse the pom file of the current dependent packages.
[0191] Organizing and compressing the dependent packages according to the storage paths includes:
[0192] Generate a tree, where the root node of the tree is the storage location of the tree; the storage paths of the dependent packages are the child nodes of the root node, the other dependent packages required by the dependent packages are the last-level non-leaf nodes, and the versions of the dependent packages are the leaf nodes;
[0193] Compress the tree and the dependent package list.
[0194] Unzip the dependent packages according to the dependency relationship in the intranet environment;
[0195] Parse the current node in the tree in the intranet environment;
[0196] Determine whether the child nodes of the current node exist;
[0197] If the child nodes do not exist, create a folder;
[0198] Save the child nodes to the created folder, and move the dependent packages corresponding to the child nodes out of the dependent package list and the tree;
[0199] Determine whether the current node is a leaf node;
[0200] If it is a leaf node, determine whether the current dependent package list is empty;
[0201] If the current dependent package list is not empty, use the adjacent node of the current node as the current node, and return the steps to parse the current node in the tree;
[0202] If the current dependent package list is empty, determine that the decompression is completed.
[0203] After determining whether the current node is a leaf node, it also includes:
[0204] If it is not a leaf node, use the child nodes of the current node as the current node, and return the steps to parse the current node in the tree.
[0205] For the introduction of the computer-readable storage medium provided in this application, please refer to the above embodiments and will not be elaborated here.
[0206] It should also be noted that in this specification, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device comprising the said element.
[0207] Those skilled in the art can further realize that the units and algorithm steps of each example described in connection with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.
[0208] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but will be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for downloading dependent packages, characterized in that, Including: Download the dependent packages and other dependent packages required by the dependent packages in the external network environment; Organize and compress the dependent packages according to the storage paths; Send the dependent packages to the internal network environment through a data migration device; Unzip the dependent packages according to the storage paths in the internal network environment; wherein: the external network environment and the internal network environment are implemented on the same device through a virtual machine; Before downloading the dependent packages and other dependent packages required by the dependent packages in the external network environment, it further includes: Set the dependent packages to be downloaded and the pom files of the dependent packages, and the pom files include the storage paths of the dependent packages, other dependent packages required by the dependent packages, and the versions of the dependent packages; Download the dependent packages and other dependent packages required by the dependent packages in the external network environment, including: Set a dependent package list in the external network environment; Parse the pom file of the current dependent package; Judge whether other dependent packages required by the current dependent package in the pom file are in the dependent package list; If not, download the other dependent packages and the pom files of the other dependent packages; Judge whether the pom file of the current dependent package is completely parsed; If the pom file of the current dependent package is completely parsed, judge whether all pom files are completely parsed; If there are pom files that are not completely parsed, use the dependent packages corresponding to the pom files that are not completely parsed as the current dependent package, and return to the step of parsing the pom file of the current dependent package; If there are no pom files that are not completely parsed, enter the step of organizing and compressing the dependent packages according to the storage paths.
2. The method for downloading dependent packages according to claim 1, wherein After judging whether the pom file of the current dependent package is parsed, it further includes: If the pom file of the current dependent package is not completely parsed, return to the step of parsing the pom file of the current dependent package.
3. The method for downloading dependent packages according to any one of claims 1 to 2, characterized in that, Organize and compress the dependent packages according to the storage paths, including: Generate a tree, where the root node of the tree is the storage location of the tree; the storage paths of the dependent packages are the child nodes of the root node, other dependent packages required by the dependent packages are the last-level non-leaf nodes, and the versions of the dependent packages are the leaf nodes; Compress the tree and the dependent package list.
4. The method for downloading dependent packages according to claim 3, wherein Determine the dependency relationships, version numbers of the dependent packages, and storage locations of the dependent packages through the tree, and unzip the dependent packages according to the dependency relationships in the internal network environment; Parse the current node in the tree in the internal network environment; Judge whether the child nodes of the current node exist; If the child nodes do not exist, create a folder; Save the child nodes to the created folder, and move the dependent packages corresponding to the child nodes out of the dependent package list and the tree; Judge whether the current node is a leaf node; If it is a leaf node, judge whether the current dependent package list is empty; If the current dependent package list is not empty, use the adjacent node of the current node as the current node, and return to the step of parsing the current node in the tree; If the current dependent package list is empty, it is determined that the decompression is completed.
5. The method for downloading dependent packages according to claim 4, wherein After judging whether the current node is a leaf node, it further includes: If it is not a leaf node, use the child node of the current node as the current node and return the current node in the parsing tree.
6. A system for downloading dependent packages, characterized in that, Including: A download unit, configured to download the dependency package and other dependency packages required by the dependency package in an external network environment; An arrangement and compression unit, configured to arrange and compress the dependency packages according to the storage paths; A sending unit, configured to send the dependency packages to an internal network environment through a data migration device; An extraction unit, configured to extract the dependency packages according to the storage paths in the internal network environment; wherein: the external network environment and the internal network environment are implemented on the same device through a virtual machine; Further including: A first setting unit, configured to set the dependency packages to be downloaded and the pom files of the dependency packages, where the pom files include the storage paths of the dependency packages, other dependency packages required by the dependency packages, and the versions of the dependency packages; A second setting unit, configured to set a dependency package list in the external network environment; A parsing unit, configured to parse the pom file of the current dependency package; A first judgment unit, configured to judge whether other dependency packages required by the current dependency package in the pom file are in the dependency package list; If not, trigger the download unit; The download unit is specifically configured to download the other dependency packages and the pom files of the other dependency packages; A second judgment unit, configured to judge whether the pom file of the current dependency package is completely parsed; if so, trigger a third judgment unit; if not, trigger the parsing unit; A third judgment unit, configured to judge whether all pom files are completely parsed; if not, trigger a first adjustment unit; if so, trigger the arrangement and compression unit; A first adjustment unit, configured to, if there are pom files that are not completely parsed, use the dependency packages corresponding to the pom files that are not completely parsed as the current dependency packages, and return to the step of parsing the pom file of the current dependency package; Trigger the arrangement and compression unit, configured to enter the step of arranging and compressing the dependency packages according to the storage paths.
7. A device for downloading dependent packages, characterized in that Including: A memory, configured to store a computer program; A processor, configured to implement the steps of the method for downloading dependency packages as described in any one of claims 1 to 5 when executing the computer program.
8. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method for downloading dependency packages as described in any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Method for deploying software quickly in linux environment
CN106406960A
Construction method and system of RN project
CN110162332A