Software running and installation package generation method and device, computer equipment and storage medium

CN119806681BActive Publication Date: 2026-09-25INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202412000333.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2026-09-25
Estimated Expiration
2044-12-31

AI Technical Summary

Technical Problem

[0004]有鉴于此,本发明提供了一种软件运行和安装包生成方法、装置、计算机设备、存储介质及程序产品,以解决相关技术中无法正常运行软件的问题

Benefits of technology

[0013]通过预先在安装包中设置第一配置文件、查询脚本文件和多种运行环境版本号分别对应的编译文件,并预先在第一配置文件中设置目标标签,在目标标签对应的位置填入查询脚本文件的名称。在目标对象获取到安装包,对安装包进行加载的过程中,在加载到第一配置文件中的目标标签时,可以从目标标签对应的位置读取查询脚本文件的名称。进而,目标对象可以根据查询脚本文件的名称,跳转至查询脚本文件的执行逻辑,识别目标对象当前的目标运行环境版本号。然后,目标对象将与目标标签对应的位置替换为目标运行环境版本号,得到包括指定版本号的第二配置文件。最后,目标对象可以根据包括指定版本号的第二配置文件和安装包中的编译文件,运行目标软件。在这样的设置下,对于目标软件,不同的客户开发厂商只需要提供一种安装包即可,可以降低开发厂商管理安装包的成本和复杂度,避免开发厂商提供错误版本的安装包给客户导致的目标软件无法正常运行的问题。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119806681B_ABST
    Figure CN119806681B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of codes, and discloses a software running and installation package generation method and device, computer equipment and a storage medium, which comprise the following steps: obtaining an installation package of target software, wherein the installation package comprises a first configuration file, a query script file and a plurality of compiled files corresponding to a plurality of running environment versions; loading the installation package; when a target label is loaded from the first configuration file, reading the name of the query script file from a position corresponding to the target label; according to the name of the query script file, jumping to execute the query script file; according to the query script file, identifying a target running environment version number of a target object; replacing the position corresponding to the target label in the name of the query script file with the target running environment version number to obtain a second configuration file; and according to the second configuration file and the compiled files corresponding to the plurality of running environment versions, running the target software. The application can avoid the problem that software cannot normally run.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of code technology, and more specifically to methods, apparatus, computer equipment, and storage media for generating software runtime and installation packages. Background Technology

[0002] In the field of code technology, open-source projects are constantly being updated, and different runtime environments can only use the corresponding versions of open-source projects. When a development vendor develops the same software (software to implement a certain business function) for multiple companies simultaneously, they can develop one set of source code, but need to generate corresponding installation packages based on the operating environment of each customer's computer device. This ensures that the software can run normally on the customer's computer device using the corresponding installation package and the open-source project. For example, if Company A's runtime environment is version 1.0, Company B's is version 2.0, and Company C's is version 3.0, the development vendor needs to generate three versions of installation packages and provide them to the respective companies.

[0003] In this way, the developer needs to manage multiple versions of the installation package. When providing the installation package to customers, they may provide the wrong version of the installation package, causing the customer's computer to be unable to run the software properly. Summary of the Invention

[0004] In view of this, the present invention provides a method, apparatus, computer equipment, storage medium, and program product for generating software running and installation packages, in order to solve the problem of software failing to run properly in related technologies.

[0005] In a first aspect, the present invention provides a software execution method, which is executed by a target object, the method comprising:

[0006] Obtain the installation package of the target software, which includes a first configuration file, a query script file, and compilation files corresponding to multiple runtime environment versions;

[0007] The installation package is loaded. When the target tag is loaded from the first configuration file, the name of the query script file is read from the position corresponding to the target tag.

[0008] Based on the name of the query script file, jump to execute the query script file;

[0009] Based on the query script file, identify the target runtime environment version number of the target object;

[0010] Replace the name of the query script file with the target runtime environment version number at the position corresponding to the target tag to obtain the second configuration file;

[0011] Run the target software based on the second configuration file and the compilation files corresponding to the various runtime environment versions.

[0012] The software running method provided by this invention has the following advantages:

[0013] By pre-setting a first configuration file, a query script file, and compiled files corresponding to various runtime environment version numbers in the installation package, and pre-setting a target tag in the first configuration file with the name of the query script file entered in the corresponding position, the target object can read the name of the query script file from the corresponding position when loading the installation package and encountering the target tag in the first configuration file. Then, the target object can jump to the execution logic of the query script file based on its name, identifying its current target runtime environment version number. The target object then replaces the position corresponding to the target tag with the target runtime environment version number, resulting in a second configuration file containing the specified version number. Finally, the target object can run the target software based on the second configuration file containing the specified version number and the compiled files in the installation package. With this setup, different customer development vendors only need to provide one installation package for the target software, reducing the cost and complexity of managing installation packages for vendors and avoiding problems caused by vendors providing incorrect versions of installation packages, which could lead to the target software malfunctioning.

[0014] In one optional implementation, the target software is run according to the second configuration file and the compiled files corresponding to multiple runtime environment versions, including:

[0015] Read the target runtime environment version number from the location corresponding to the target tag in the second configuration file;

[0016] Obtain the target dependency packages corresponding to the target runtime environment version number;

[0017] Select the target compilation file corresponding to the target runtime environment version number from the compilation files corresponding to multiple runtime environment versions;

[0018] Run the target software based on the target dependencies and the target compilation files.

[0019] Specifically, the target object can read the supported target runtime environment version number from the second configuration file with the specified version number. Then, based on the target runtime environment version number, it can obtain the corresponding target compiled files and target dependency packages, and run the target software under that runtime environment version. This ensures that the target object can run the target software normally, avoiding problems caused by incorrect installation package versions.

[0020] In one optional implementation, identifying the target runtime environment version number of the target object based on the query script file includes:

[0021] Obtain loading information of the running software of the target object;

[0022] The loading information of the running software is parsed to obtain the target runtime environment version number.

[0023] Specifically, by parsing the loading information of the software already running in the target object, the accurate target running version number can be obtained.

[0024] In one optional implementation, identifying the target runtime environment version number of the target object based on the query script file includes:

[0025] Obtain the runtime environment variables of the target object;

[0026] The runtime environment variable is assigned the target runtime environment version number.

[0027] Specifically, directly reading the values ​​of runtime environment variables is more convenient, usually requiring only simple query code or commands from technical personnel. Furthermore, this method is faster, allowing the target software to run earlier.

[0028] In a first aspect, the present invention provides a method for generating an installation package, the method comprising:

[0029] Obtain multiple runtime environment version numbers, the primary configuration file, the query script file, and the source code of the target software;

[0030] Based on each runtime environment version number, the first configuration file, and the source code, generate a project object corresponding to each runtime environment version number;

[0031] Each project object is compiled in parallel to obtain a compiled file corresponding to each project object;

[0032] Once the compilation operations for each project object have been completed, the installation package for the target software is generated based on the compilation file, the first configuration file, and the query script file corresponding to each project object.

[0033] The installation package generation method provided by this invention has the following advantages:

[0034] When generating the installation package, this solution can obtain multiple runtime environment version numbers, a primary configuration file and script files, as well as the source code of the target software. Then, the target software can generate a project object corresponding to each runtime environment version number based on the primary configuration file and source code. The target software can compile each project object in parallel, obtaining a compiled file corresponding to each project object, resulting in fast compilation efficiency. After completing the compilation operations for all project objects, the installation package is generated based on the compiled file, primary configuration file, and query script file corresponding to each project object. In this way, the developer only needs to generate one installation package for the target software according to the above solution. That is, the developer only needs to manage one installation package for each type of software, which is more convenient, avoids the problem of providing incorrect installation package versions, and further avoids the problem of the target software failing to run properly.

[0035] In one alternative implementation, the method further includes:

[0036] Once the compilation error information of the target project object is obtained, the compilation operation of all project objects is stopped. The target project object is the project object corresponding to any runtime environment version number.

[0037] Based on the runtime environment version number and compilation error information corresponding to the target project object, generate alarm information and display it.

[0038] Specifically, during the compilation process, if an error occurs during the compilation of any project object, the compilation of all threads is immediately stopped. This avoids unnecessary compilation of other project objects, saving computational resources and time. Furthermore, by promptly interrupting the compilation process, errors in one version prevent them from affecting the build of other versions. Additionally, by generating alerts based on the version number and error message, developers can quickly receive feedback, knowing which version of the project object is experiencing the problem and what the specific error is, thereby accelerating troubleshooting.

[0039] In one alternative implementation, each project object is compiled in parallel to obtain a compiled file corresponding to each project object, including:

[0040] Create a directory file corresponding to each project object;

[0041] The target thread among multiple threads is started to compile the target project object, resulting in at least one sub-compiled file corresponding to the target project object. The target project object is a project object corresponding to any runtime environment version number.

[0042] Add each sub-compiled file corresponding to the target project object to the directory file corresponding to the target project object to obtain the compiled file corresponding to the target project object.

[0043] Specifically, multiple threads are launched to compile different project objects in parallel, making full use of computing resources and shortening compilation time. Furthermore, creating independent directory files for each project object to store compilation results, including sub-compilation files, ensures that the compilation output of each version is correctly isolated and managed, avoiding file conflicts or overwriting issues, and facilitating subsequent analysis and deployment.

[0044] Thirdly, the present invention provides a software running device, the device comprising:

[0045] The first acquisition module is used to acquire the installation package of the target software. The installation package includes a first configuration file, a query script file, and compilation files corresponding to multiple runtime environment versions.

[0046] The loading module is used to load the installation package. When the target tag is loaded from the first configuration file, the name of the query script file is read from the position corresponding to the target tag.

[0047] The execution module is used to jump to and execute the query script file based on its name;

[0048] The identification module is used to identify the target runtime environment version number of the target object based on the query script file;

[0049] The replacement module is used to replace the name of the query script file with the target runtime environment version number at the position corresponding to the target tag, so as to obtain the second configuration file;

[0050] The runtime module is used to run the target software based on the second configuration file and the compilation files corresponding to the multiple runtime environment versions.

[0051] Fourthly, the present invention provides an installation package generation apparatus, the apparatus comprising:

[0052] The second acquisition module is used to acquire multiple runtime environment version numbers, the first configuration file, the query script file, and the source code of the target software;

[0053] The generation module is used to generate a project object corresponding to each runtime environment version number based on each runtime environment version number, the first configuration file, and the source code.

[0054] The compilation module is used to compile each project object in parallel, resulting in a compiled file corresponding to each project object;

[0055] The generation module is also used to generate the installation package of the target software based on the compilation file, the first configuration file, and the query script file corresponding to each project object after the compilation operations for all project objects have been completed.

[0056] Fifthly, the present invention provides a computer device, comprising: a memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the computer instructions to perform the software operation method of the first aspect or any corresponding embodiment described above.

[0057] In a sixth aspect, the present invention provides a computer device, comprising: a memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the computer instructions to perform the installation package generation method of the second aspect above or any corresponding embodiment thereof.

[0058] In a seventh aspect, the present invention provides a computer-readable storage medium storing computer instructions for causing a computer to perform the software operation method of the first aspect or any corresponding embodiment thereof.

[0059] Eighthly, the present invention provides a computer-readable storage medium storing computer instructions for causing a computer to execute the installation package generation method of the second aspect or any corresponding embodiment thereof.

[0060] In a ninth aspect, the present invention provides a computer program product, including computer instructions for causing a computer to execute the software running method of the first aspect or any corresponding embodiment thereof.

[0061] In a tenth aspect, the present invention provides a computer program product, including computer instructions for causing a computer to execute the installation package generation method of the first aspect or any corresponding embodiment thereof. Attached Figure Description

[0062] To more clearly illustrate the technical solutions in the specific embodiments or related technologies of the present invention, the drawings used in the description of the specific embodiments or related technologies will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0063] Figure 1 This is a flowchart illustrating a software operation method according to an embodiment of the present invention;

[0064] Figure 2 This is a flowchart illustrating the installation package generation method according to an embodiment of the present invention;

[0065] Figure 3 This is a flowchart illustrating the method for generating an installation package and running software under a Maven project according to an embodiment of the present invention.

[0066] Figure 4 This is a schematic diagram illustrating the specified target runtime environment version number according to an embodiment of the present invention;

[0067] Figure 5 This is a structural block diagram of a software running device according to an embodiment of the present invention;

[0068] Figure 6 This is a structural block diagram of an installation package generation apparatus according to an embodiment of the present invention;

[0069] Figure 7 This is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. Detailed Implementation

[0070] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0071] The technical terms involved in this invention will be explained below.

[0072] Open source projects are software projects whose source code is publicly released and that allow anyone to view, use, modify, and distribute them.

[0073] Source code: It is the original set of instructions written by programmers using a programming language (e.g., the Java programming language), containing all the logic and algorithms of the software.

[0074] Operating environment: refers to the set of hardware and software conditions required to run an application, such as computer equipment, operating system, virtual machine, third-party libraries and other necessary tools and services.

[0075] Dependencies are external libraries required for a project (e.g., the target software in this solution) to be built, run, or tested. Dependencies can be the open-source projects mentioned above. For example, a dependency's compressed format can be a JAR file.

[0076] An installer package typically refers to a packaged file or set of files. For example, it may contain compiled files, configuration files, and instructions for correctly installing these components onto the target object. The main purpose of an installer package is to simplify the software deployment process, allowing users to easily install, update, or uninstall software. For example, an installer package may be in JAR format.

[0077] Compiled files: Files generated after the source code has been processed by the compiler and converted into machine code or bytecode.

[0078] In related technical fields, during the stage of generating each customer's installation package, the developer's computer equipment can generate a project object corresponding to the specified runtime environment version number based on the configuration file (including the runtime environment version number specified by the customer) and source code created by the technicians. The computer equipment can compile the project object to obtain the compiled file corresponding to the project object, and then package the compiled file and configuration file to obtain the installation package. In this way, multiple installation packages corresponding to different runtime environment versions can be obtained, and the developer can provide the corresponding version of the installation package according to the customer's needs. During the runtime phase, after obtaining the installation package, the customer's computer equipment can directly run the software according to the configuration file and compiled file in the installation package. If the developer provides an incorrect version of the installation package to the customer, the customer's computer equipment will not be able to run the software properly.

[0079] This invention provides a software running method. By adding the compiled files of all versions to the installation package during the generation stage, and automatically identifying the target object's runtime environment version number during the runtime stage, the target software is run. In this way, the developer only needs to manage one installation package, which can avoid the problem of providing an incorrect version of the installation package, and thus avoid the problem of the target software not running properly.

[0080] According to an embodiment of the present invention, a software running method embodiment is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0081] This embodiment provides a software execution method, which can be executed by a target object. The target object can be a computer device, or a virtual machine (VM) running on the computer device, such as a Java Virtual Machine (JVM). Figure 1 This is a flowchart of a software operation method according to an embodiment of the present invention, such as... Figure 1As shown, the process includes the following steps:

[0082] Step S101: Obtain the installation package of the target software.

[0083] The installation package may include a first configuration file, a query script file, and compiled files corresponding to multiple runtime environment versions. The first configuration file may include the target software's attribute information, dependency information, and plugin management information. Attribute information may include the target software's identification information, packaging type, and description information (i.e., information indicating the target software's business functions). For example, the target software's identification information could be "A-app," and the packaging type could be Jar, War, etc. The dependency information may include the identification information of all dependent packages required for the target software to run. The query script file may include instructions for querying the runtime environment version number; for example, it could be a shell file.

[0084] Specifically, the target object can receive the installation package of the target software sent from other clients, or it can download the installation package of the target software from the website provided by the manufacturer.

[0085] Step S102: Load the installation package. When the target tag is loaded from the first configuration file, read the name of the query script file from the position corresponding to the target tag.

[0086] Specifically, when the target object needs to run the target software, the installation package can be loaded according to the preset loading order of the files. When the first configuration file is loaded and the target tag is loaded from the first configuration file, the name of the query script file can be read from the position corresponding to the target tag.

[0087] Step S103: Based on the name of the query script file, jump to execute the query script file.

[0088] Specifically, when the target object reads the name of the query script file, it can find the query script file in the installation package based on the name of the query script file.

[0089] Step S104: Identify the target runtime environment version number of the target object based on the query script file.

[0090] Specifically, the target runtime environment version of the target object can be identified based on the instructions included in the query script file. Depending on the instructions included in the query script file, this solution can identify the target runtime environment version number of the target object in the following two ways:

[0091] Method 1: Obtain the loading information of the target object's running software. Parse the loading information of the running software to obtain the target runtime environment version number.

[0092] Specifically, the target object can obtain the identification information of all its running software, randomly select the identification information of one running software, and obtain the loading information of that running software based on its identification information. Then, the loading information of the running software can be parsed to obtain the runtime environment information. Finally, the target runtime environment version number can be extracted from the runtime environment information.

[0093] Method 2: Obtain the runtime environment variables of the target object. Assign the value of the runtime environment variable to the version number of the target runtime environment.

[0094] Specifically, the target object can have runtime environment variables pre-set. The target object can obtain its own runtime environment variables and assign the values ​​of these variables to the target runtime environment version number.

[0095] Step S105: Replace the name of the query script file with the target runtime environment version number at the position corresponding to the target tag to obtain the second configuration file.

[0096] Specifically, the target object can replace the name of the query script file with the target runtime environment version number at the position corresponding to the target tag. In this way, a configuration file with a specified runtime environment version number can be obtained, which is the second configuration file.

[0097] Step S106: Run the target software according to the second configuration file and the compilation files corresponding to the multiple runtime environment versions.

[0098] Specifically, the target object can run the target software by following these steps:

[0099] Step 1: Read the target runtime environment version number from the location corresponding to the target tag in the second configuration file.

[0100] Step 2: Obtain the target dependency package corresponding to the version number of the target runtime environment.

[0101] Step 3: Select the target compilation file corresponding to the target runtime environment version number from the compilation files corresponding to the multiple runtime environment versions.

[0102] Step 4: Run the target software based on the target dependency packages and target compilation files.

[0103] Specifically, after the replacement operation is completed, the target object can reload the second configuration file. When loading the target tag, it reads the target runtime environment version number from the location corresponding to the target tag. Then, the target object can load the corresponding target dependency package from the local or remote repository based on the target runtime environment version number and the dependency package identification information. Simultaneously, the target object can select the target compiled file corresponding to the target runtime environment version number from multiple compiled files for different runtime environment versions. Finally, the target object can run the target software based on the target dependency package and the target compiled file.

[0104] In some optional implementations, after detecting that the target software has terminated, the target object can replace the location corresponding to the target tag in the second configuration file with the name of the query script file. This way, if the target object's runtime environment changes, when running the target software again, it can be run again according to the changed runtime environment version number, without requiring the developer to provide a new installation package, which is convenient and highly flexible.

[0105] The software running method provided in this embodiment pre-sets a first configuration file, a query script file, and compilation files corresponding to various runtime environment version numbers in the installation package. A target tag is pre-set in the first configuration file, and the name of the query script file is entered at the corresponding position. During the loading process of the installation package by the target object, when the target tag in the first configuration file is encountered, the name of the query script file can be read from the corresponding position. Then, the target object can jump to the execution logic of the query script file based on its name, identifying the target runtime environment version number. The target object then replaces the position corresponding to the target tag with the target runtime environment version number, obtaining a second configuration file including the specified version number. Finally, the target object can run the target software based on the second configuration file including the specified version number and the compilation files in the installation package. With this setup, different customer developers only need to provide one installation package for the target software, reducing the cost and complexity of managing installation packages for developers and avoiding the problem of the target software failing to run properly due to developers providing incorrect versions of the installation package to customers.

[0106] This embodiment provides a method for generating an installation package, which can be executed by a computer device, such as a laptop or desktop computer. Figure 2 This is a flowchart of an installation package generation method according to an embodiment of the present invention, such as... Figure 2 As shown, the process includes the following steps:

[0107] Step S201: Obtain multiple runtime environment version numbers, the first configuration file, the query script file, and the source code of the target software.

[0108] Specifically, technicians can input multiple runtime environment version numbers into the computer device and configure the first configuration file based on the target software information. Additionally, technicians need to construct a query script file and write the source code of the target software. In this way, the computer device can obtain multiple runtime environment version numbers, the first configuration file, the query script file, and the source code of the target software.

[0109] Step S202: Generate a project object corresponding to each runtime environment version number based on each runtime environment version number, the first configuration file, and the source code.

[0110] Specifically, the computer device can generate a project object corresponding to a first runtime environment version number based on the first runtime environment version number, the first configuration file, and the source code. The first runtime environment version number can be any one of multiple runtime environment version numbers.

[0111] Step S203: Compile each project object in parallel to obtain a compiled file corresponding to each project object.

[0112] Specifically, the target object can be compiled using the following steps:

[0113] Step 1: Create a directory file corresponding to each project object.

[0114] Step 2: Start the target thread among multiple threads to compile the target project object and obtain at least one sub-compiled file corresponding to the target project object.

[0115] The target project object can be a project object corresponding to any runtime environment version number. The target thread can be any one of multiple threads.

[0116] Step 3: Add each sub-compiled file corresponding to the target project object to the directory file corresponding to the target project object to obtain the compiled file corresponding to the target project object.

[0117] Specifically, the target object can first create a directory file corresponding to each runtime environment version number, that is, create a directory file corresponding to each project object. At the same time, the number of runtime environment version numbers can be determined in the computer device, and based on the number of runtime environment version numbers, an equal number of multiple threads are called to compile each project object, resulting in a sub-compiled file corresponding to each project object. Specifically, one thread can compile one project object.

[0118] In some alternative implementations, after determining the number of runtime environment version numbers, the computer device can first check if the number of runtime environment version numbers exceeds a preset threshold. If it is determined that the number of runtime environment version numbers exceeds the preset threshold, only the number of threads equal to the preset threshold can be invoked to perform the compilation operations on a subset of project objects. After the compilation operation of each project object is completed, the compilation operation on the uncompiled project objects can be performed immediately. In this way, compilation efficiency can be improved through parallel compilation operations, while avoiding the problem of excessive consumption of system resources.

[0119] Step S204: After confirming that the compilation operations corresponding to all project objects have been completed, generate the installation package of the target software based on the compilation file, the first configuration file, and the query script file corresponding to each project object.

[0120] Specifically, once the compilation of all project objects is complete, the computer device can package the compiled files, first configuration files, and query script files corresponding to each project object to obtain the target software installation package. In this way, the developer can provide this installation package to all customers who have reserved the target software. The customer's computer device or the JVM running on the computer device can then configure the installation package according to the following steps: Figure 1 The steps shown will run the target software and execute related business functions.

[0121] In some optional implementations, upon receiving compilation error information for the target project object, compilation operations for all project objects are stopped. An alert is generated and displayed based on the runtime environment version number corresponding to the target project object and the compilation error information.

[0122] Specifically, since errors may occur during the compilation process, an error in compiling a particular project object may indicate a malfunction in the compilation tool. In this case, compilation operations for all project objects should be stopped to prevent further compilation errors. Furthermore, to address issues promptly, the computer can obtain the runtime environment version number and compilation error information corresponding to the erroneous project object, generate alerts, and display them. Technicians can then perform repair operations based on the real-time alert information to complete the installation package generation process as soon as possible.

[0123] The installation package generation method provided in this embodiment can obtain multiple runtime environment version numbers, a first configuration file, a script file, and the source code of the target software when generating the installation package. Then, the target object can generate a project object corresponding to each runtime environment version number based on each runtime environment version number, the first configuration file, and the source code. The target object can compile each project object in parallel to obtain a compiled file corresponding to each project object, resulting in fast compilation efficiency. After completing the compilation operations for all project objects, the installation package is generated based on the compiled file corresponding to each project object, the first configuration file, and the query script file. In this way, the developer only needs to generate one installation package for the target software according to the above scheme; that is, the developer only needs to manage one installation package for each type of software, which is more convenient, avoids the problem of providing incorrect installation package versions, and further avoids the problem of the target software failing to run properly.

[0124] The following uses the Maven project management tool as a specific example to illustrate the process of running software and generating installation packages.

[0125] The target software mentioned above can be a project developed using the Maven project management tool. The Maven project management tool can be a project management tool based on the Java programming language. The Maven project management tool mainly includes several modules such as maven-core, maven-model, maven-artifact, maven-plugin-api, maven-compat, maven-embedder, maven-settings, and maven-resolver. Among them, maven-core contains the main logic and workflow of Maven, such as lifecycle management and plugin execution. maven-model is used to define model objects and data structures; for example, defining the Project Object Model (POM) can be used to parse and manipulate information in the pom.xml file. maven-artifact defines Maven's Artifact objects, used to represent project dependencies and build results. maven-plugin-api defines the API interface and specifications for Maven plugins, allowing plugin developers to write custom plugins based on these interfaces. maven-compat contains compatibility implementation code to support older versions of Maven plugins. maven-embedder provides an embedded engine for Maven, allowing Maven functionality to be embedded into Java applications. maven-settings defines the Maven configuration files and related parameters used to configure the project's build environment. maven-resolver is used to resolve project dependencies, including downloading dependencies from remote repositories and resolving dependency versions.

[0126] During the installation package generation phase, technicians can use the Maven project management tool to write the source code of the target software, as well as the initial configuration file and query script files. For example... Figure 3 As shown, maven-model can include a ModelBuilder class. Technical personnel can modify the ModelBuilder class and specify multiple runtime environment version numbers within it. They can also modify the pom.xml file, adding a new line to the location where version information is specified. <descriptors>The `<shell>` tag specifies the shell file (query script file) mapped to in the installation package. The modified `ModelBuilder` class can construct a project object corresponding to each runtime environment version based on the `pom.xml` file, each runtime environment version number, and the software's source code. When multiple project objects are detected, multiple threads for the target object can be started. For each project object, a thread compiles it using the `CompilerMojo` plugin, generating a corresponding `.class` file (sub-compilation file), which is then saved in the directory corresponding to that project object (compilation file). Finally, the `pom.xml` file, the shell file, and the compilation files corresponding to multiple runtime environment versions are packaged into the target software's installation package.

[0127] During the runtime phase, when the target object loads the installation package, ... <descriptors>The tag can jump to the shell file, identify the target runtime environment version number of the target object based on the shell file, and replace the target runtime environment version number with the appropriate value. <descriptors>The location corresponding to the tag. For example... Figure 4 As shown, the "groupId" tag indicates the path of the installation package, the "aitifactId" tag indicates the name of the installation package, the "version" tag indicates the runtime environment version number, and the "descriptors" tag is used to map query script files. Figure 4 The above may be partial information from the first configuration file. After being loaded into "descriptors", the target object can read the name of the query script file, jump to the execution logic of the query script file, and identify the target runtime environment version number based on the query script file. This version number is then added to the location where the original query script file name was located, thus obtaining... Figure 4 The following is a partial information from the second configuration file.

[0128] In this way, the target object can read the target runtime environment version number from the pom.xml file after the replacement information. Then, based on the target runtime environment version number, it can find the corresponding compiled file (i.e., the directory file containing the .class file corresponding to the target runtime environment version number) in the installation package, and obtain the corresponding dependency packages locally or remotely. Finally, the target object can run the target software based on the compiled file and dependency packages corresponding to the target runtime environment version number.

[0129] This embodiment also provides a software running device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0130] This embodiment provides a software running device, such as... Figure 5 As shown, it includes:

[0131] The first acquisition module 501 is used to acquire the installation package of the target software. The installation package includes a first configuration file, a query script file, and compilation files corresponding to multiple runtime environment versions.

[0132] Loading module 502 is used to load the installation package. When the target tag is loaded from the first configuration file, the name of the query script file is read from the position corresponding to the target tag.

[0133] Execution module 503 is used to jump to and execute the query script file based on the name of the query script file.

[0134] The identification module 504 is used to identify the target runtime environment version number of the target object based on the query script file.

[0135] Replacement module 505 is used to replace the name of the query script file with the target runtime environment version number at the position corresponding to the target tag, so as to obtain the second configuration file.

[0136] The runtime module 506 is used to run the target software based on the second configuration file and the compilation files corresponding to the multiple runtime environment versions.

[0137] In some alternative implementations, the execution module 506 is specifically used for:

[0138] Read the target runtime environment version number from the location corresponding to the target tag in the second configuration file.

[0139] Obtain the target dependency package corresponding to the version number of the target runtime environment.

[0140] Select the target compilation file corresponding to the target runtime environment version number from the compilation files corresponding to multiple runtime environment versions.

[0141] Run the target software based on the target dependencies and the target compilation files.

[0142] In some alternative implementations, the identification module 504 is specifically used for:

[0143] Obtain loading information for the running software of the target object.

[0144] The loading information of the running software is parsed to obtain the target runtime environment version number.

[0145] In some alternative implementations, the identification module 504 is specifically used for:

[0146] Obtain the runtime environment variables of the target object.

[0147] The runtime environment variable is assigned the target runtime environment version number.

[0148] This embodiment provides an installation package generation device, such as... Figure 6 As shown, it includes:

[0149] The second acquisition module 601 is used to acquire multiple runtime environment version numbers, the first configuration file, the query script file, and the source code of the target software.

[0150] The generation module 602 is used to generate a project object corresponding to each runtime environment version number based on each runtime environment version number, the first configuration file, and the source code.

[0151] Compiler module 603 is used to compile each project object in parallel to obtain a compiled file corresponding to each project object.

[0152] The generation module 602 is also used to generate the installation package of the target software based on the compilation file, the first configuration file, and the query script file corresponding to each project object after it is determined that the compilation operations corresponding to all project objects have been completed.

[0153] In some alternative implementations, compiler module 603 is also used for:

[0154] Once a compilation error message for the target project object is obtained, the compilation operation for all project objects is stopped. The target project object is the project object corresponding to any runtime environment version number.

[0155] Based on the runtime environment version number and compilation error information corresponding to the target project object, generate alarm information and display it.

[0156] In some alternative implementations, compiler module 603 is specifically used for:

[0157] Create a directory file corresponding to each project object.

[0158] The target thread among multiple threads is started to compile the target project object, resulting in at least one sub-compiled file corresponding to the target project object, wherein the target project object is a project object corresponding to any runtime environment version number.

[0159] Add each sub-compiled file corresponding to the target project object to the directory file corresponding to the target project object to obtain the compiled file corresponding to the target project object.

[0160] Further functional descriptions of the above modules and units are the same as those in the corresponding embodiments described above, and will not be repeated here.

[0161] In this embodiment, the software running device and the installation package generating device are presented in the form of functional units. Here, a unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that execute one or more software or fixed programs, and / or other devices that can provide the above functions.

[0162] This invention also provides a computer device having the above-described features. Figure 5 The software operating device shown, or having the above-mentioned Figure 6 The software running device shown.

[0163] Please see Figure 7 , Figure 7 This is a schematic diagram of the structure of a computer device provided in an optional embodiment of the present invention, such as... Figure 7 As shown, the computer device includes one or more processors 10, memory 20, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The components communicate with each other via different buses and can be mounted on a common motherboard or otherwise installed as needed. The processors can process instructions executed within the computer device, including instructions stored in or on memory to display graphical information of a GUI on external input / output devices (such as display devices coupled to the interfaces). In some alternative implementations, multiple processors and / or multiple buses can be used with multiple memories and multiple memory modules, if desired. Similarly, multiple computer devices can be connected, each providing some of the necessary operations (e.g., as a server array, a group of blade servers, or a multiprocessor system). Figure 7 Take a processor 10 as an example.

[0164] Processor 10 may be a central processing unit, a network processor, or a combination thereof. Processor 10 may further include a hardware integrated circuit. The aforementioned hardware integrated circuit may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The aforementioned programmable logic device may be a complex programmable logic device (CAMP), a field-programmable gate array (FPGA), a general-purpose array logic (GDA), or any combination thereof.

[0165] The memory 20 stores instructions executable by at least one processor 10 to cause the at least one processor 10 to perform the method shown in the above embodiments.

[0166] The memory 20 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the computer device. Furthermore, the memory 20 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some alternative embodiments, the memory 20 may optionally include memory remotely located relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0167] The memory 20 may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as flash memory, hard disk or solid-state drive; the memory 20 may also include a combination of the above types of memory.

[0168] The computer device also includes an input device 30 and an output device 40. The processor 10, memory 20, input device 30, and output device 40 can be connected via a bus or other means. Figure 7 Taking the example of a connection between China and Israel via a bus.

[0169] Input device 30 can receive input numerical or character information, and generate key signal inputs related to user settings and function control of the computer device, such as a touchscreen, keypad, mouse, trackpad, touchpad, joystick, one or more mouse buttons, trackball, joystick, etc. Output device 40 may include display devices, auxiliary lighting devices (e.g., LEDs), and haptic feedback devices (e.g., vibration motors). The aforementioned display devices include, but are not limited to, liquid crystal displays, light-emitting diodes, displays, and plasma displays. In some alternative embodiments, the display device may be a touchscreen.

[0170] This invention also provides a computer-readable storage medium. The methods described above according to embodiments of the invention can be implemented in hardware or firmware, or implemented as computer code that can be recorded on a storage medium, or implemented as computer code downloaded via a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code, which, when accessed and executed by the computer, processor, or hardware, implements the methods shown in the above embodiments.

[0171] A portion of this invention can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to the invention through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions, or the computer compiling the instructions and then executing the corresponding compiled program, or the computer reading and executing the instructions, or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.

[0172] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations all fall within the scope defined by the appended claims.< / descriptors> < / descriptors> < / descriptors>

Claims

1. A software running method, characterized in that, The method is executed by the target object, and the method includes: Obtain the installation package of the target software, wherein the installation package includes a first configuration file, a query script file, and compilation files corresponding to multiple runtime environment versions respectively. The first configuration file includes the attribute information, dependency information, and plugin management information of the target software. The attribute information includes the identification information, packaging type, and description information of the target software. The dependency information includes the identification information of the dependency packages required for the target software to run. The query script file includes instructions for querying the runtime environment version number. The installation package is loaded, and when a target tag is loaded from the first configuration file, the name of the query script file is read from the position corresponding to the target tag; Based on the name of the query script file, jump to execute the query script file; Based on the query script file's instruction to query the runtime environment version number, identify the target runtime environment version number of the target object; The second configuration file is obtained by replacing the name of the query script file with the target runtime environment version number at the position corresponding to the target tag; Read the target runtime environment version number from the position corresponding to the target tag in the second configuration file; Based on the target runtime environment version number and the identifier information of the dependency package, obtain the target dependency package corresponding to the target runtime environment version number; Select the target compilation file corresponding to the target runtime environment version number from the compilation files corresponding to the multiple runtime environment versions respectively; Run the target software based on the target dependency package and the target compiled file; After the target software is detected to have stopped running, the position in the second configuration file corresponding to the target tag is replaced with the name of the query script file.

2. The method according to claim 1, characterized in that, The step of identifying the target runtime environment version number of the target object based on the query script file includes: Obtain the loading information of the running software of the target object; The loading information of the running software is parsed to obtain the target runtime environment version number.

3. The method according to claim 1, characterized in that, The step of identifying the target runtime environment version number of the target object based on the query script file includes: Obtain the runtime environment variables of the target object; The value of the runtime environment variable is determined to be the target runtime environment version number.

4. A method for generating an installation package, characterized in that, The method includes: The system obtains multiple runtime environment version numbers, a first configuration file, a query script file, and the source code of the target software. The first configuration file includes a target tag, attribute information of the target software, dependency information, and plugin management information. The target tag is used to replace the name of the query script file with the target runtime environment version number of the target object during the operation of the target software, and to replace the name of the query script file with the target runtime environment version number after the target software finishes running. The attribute information includes the identification information, packaging type, and description information of the target software. The dependency information includes the identification information of the dependency packages required for the operation of the target software. The query script file includes instructions for querying the runtime environment version number. Based on the first runtime environment version number, the first configuration file, and the source code, a project object corresponding to the first runtime environment version number is generated, wherein the first runtime environment version number is any one of the plurality of runtime environment version numbers; Each of the project objects is compiled in parallel to obtain a compiled file corresponding to each project object; Once the compilation operations for all project objects have been completed, the installation package of the target software is generated based on the compilation file corresponding to each project object, the first configuration file, and the query script file. The parallel compilation of each project object to obtain a compiled file corresponding to each project object includes: Create a directory file corresponding to each of the project objects; The target thread among multiple threads is started to compile the target project object to obtain at least one sub-compiled file corresponding to the target project object, wherein the target project object is a project object corresponding to any runtime environment version number; Each of the sub-compiled files corresponding to the target project object is added to the directory file corresponding to the target project object to obtain the compiled file corresponding to the target project object; After determining the number of runtime environment version numbers, it is determined whether the number is greater than a preset threshold. When it is determined that the number is greater than the preset threshold, an equal number of threads are called to perform the compilation operation in parallel. After completing the compilation operation for each project object, perform the compilation operation on the project objects that have not yet been compiled.

5. The method according to claim 4, characterized in that, The method further includes: Once a compilation error message for the target project object is obtained, the compilation operation for all project objects is stopped. The target project object is the project object corresponding to any runtime environment version number. Based on the runtime environment version number and compilation error information corresponding to the target project object, an alarm message is generated and displayed.

6. A software running device, characterized in that, The device includes: The first acquisition module is used to acquire the installation package of the target software. The installation package includes a first configuration file, a query script file, and compilation files corresponding to multiple runtime environment versions. The first configuration file includes the target software's attribute information, dependency information, and plugin management information. The attribute information includes the target software's identification information, packaging type, and description information. The dependency information includes the identification information of the dependency packages required for the target software to run. The query script file includes instructions for querying the runtime environment version number. The loading module is used to load the installation package. When a target tag is loaded from the first configuration file, the name of the query script file is read from the position corresponding to the target tag. The execution module is used to jump to and execute the query script file based on its name; The identification module is used to identify the target runtime environment version number of the target object according to the instruction to query the runtime environment version number in the query script file; The replacement module is used to replace the name of the query script file with the target runtime environment version number at the position corresponding to the target tag, thereby obtaining a second configuration file; The runtime module is configured to: read the target runtime environment version number from the location corresponding to the target tag in the second configuration file; obtain the target dependency package corresponding to the target runtime environment version number based on the target runtime environment version number and the identification information of the dependency package; select the target compilation file corresponding to the target runtime environment version number from the compilation files corresponding to the multiple runtime environment versions respectively; and run the target software based on the target dependency package and the target compilation file. After the target software is detected to have stopped running, the position in the second configuration file corresponding to the target tag is replaced with the name of the query script file.

7. An installation package generation apparatus, characterized in that, The device includes: The second acquisition module is used to acquire multiple runtime environment version numbers, a first configuration file, a query script file, and the source code of the target software. The first configuration file includes a target tag, attribute information of the target software, dependency information, and plugin management information. The target tag is used to replace the name of the query script file with the target runtime environment version number of the target object during the operation of the target software, and to replace the name of the query script file with the target runtime environment version number after the target software finishes running. The attribute information includes the identification information, packaging type, and description information of the target software. The dependency information includes the identification information of the dependent packages required for the operation of the target software. The query script file includes instructions for querying the runtime environment version number. The generation module is used to generate a project object corresponding to the first runtime environment version number based on the first runtime environment version number, the first configuration file and the source code, wherein the first runtime environment version number is any one of the plurality of runtime environment version numbers. The compilation module is used to compile each of the project objects in parallel to obtain a compiled file corresponding to each of the project objects. The generation module is further configured to generate the installation package of the target software based on the compilation file corresponding to each project object, the first configuration file, and the query script file after determining that the compilation operations corresponding to all project objects have been completed. The parallel compilation of each project object to obtain a compiled file corresponding to each project object includes: Create a directory file corresponding to each of the project objects; The target thread among multiple threads is started to compile the target project object to obtain at least one sub-compiled file corresponding to the target project object, wherein the target project object is a project object corresponding to any runtime environment version number; Each of the sub-compiled files corresponding to the target project object is added to the directory file corresponding to the target project object to obtain the compiled file corresponding to the target project object; After determining the number of runtime environment version numbers, determine whether the number is greater than a preset threshold. When it is determined that the number is greater than the preset threshold, call a number of threads equal to the preset threshold to perform the compilation operation in parallel. After completing the compilation operation for each project object, perform the compilation operation on the project objects that have not yet been compiled.

8. A computer device, characterized in that, include: The system includes a memory and a processor, which are communicatively connected to each other. The memory stores computer instructions, and the processor executes the computer instructions to perform the software running method of any one of claims 1 to 3, or to perform the installation package generation method of claim 4 or 5.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing the computer to perform the software running method of any one of claims 1 to 3, or to perform the installation package generation method of any one of claims 4 or 5.

Citation Information

Patent Citations

  • Software deployment method and device

    CN114003250A

  • Software compiling and sharing method and system

    CN118605879A