[go: up one dir, main page]

CN109766128A - Project aggregation report generation method and device and storage medium - Google Patents

Project aggregation report generation method and device and storage medium Download PDF

Info

Publication number
CN109766128A
CN109766128A CN201811638819.5A CN201811638819A CN109766128A CN 109766128 A CN109766128 A CN 109766128A CN 201811638819 A CN201811638819 A CN 201811638819A CN 109766128 A CN109766128 A CN 109766128A
Authority
CN
China
Prior art keywords
project
source code
jar package
target
directory
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201811638819.5A
Other languages
Chinese (zh)
Inventor
白秋飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Mobile Communications Group Co Ltd
MIGU Culture Technology Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
MIGU Culture Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Mobile Communications Group Co Ltd, MIGU Culture Technology Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN201811638819.5A priority Critical patent/CN109766128A/en
Publication of CN109766128A publication Critical patent/CN109766128A/en
Pending legal-status Critical Current

Links

Landscapes

  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

本发明公开了一种项目聚合报告的生成方法,包括:获得至少一个项目,根据所述至少一个项目确定至少一个第一工程;将所述至少一个第一工程添加至预设的第二工程;将添加有所述至少一个第一工程的第二工程作为目标工程,对所述目标工程的源码进行聚合,获得针对所述至少一个第一工程的项目聚合报告。本发明还公开了一种项目聚合报告的生成装置和计算机可读存储介质。

The invention discloses a method for generating a project aggregation report, comprising: obtaining at least one project, determining at least one first project according to the at least one project; adding the at least one first project to a preset second project; The second project to which the at least one first project is added is used as a target project, and the source code of the target project is aggregated to obtain a project aggregation report for the at least one first project. The invention also discloses an item aggregation report generating device and a computer-readable storage medium.

Description

项目聚合报告的生成方法、装置和存储介质Method, device and storage medium for generating project aggregation report

技术领域technical field

本发明涉及互联网信息技术,尤其涉及一种项目聚合报告的生成方法、装置和计算机可读存储介质。The present invention relates to Internet information technology, and in particular, to a method, device and computer-readable storage medium for generating an item aggregation report.

背景技术Background technique

在微服务架构下,一个技术团队通常会管理多个项目,每个项目分属于不同的分布式版本控制系统(Git)仓库。为生成质量报告,一般会在Jenkins上对各项目做持续集成,最后手动汇聚成一份项目聚合报告。所述Jenkins是一个持续集成工具,它可以定期编译、运行相应代码、运行集成测试,将运行结果展示成项目聚合报告。获得的项目聚合报告指在软件项目的持续集成过程中,通过一些静态检查工具和编译工具等生成的代码质量报告;生成的所述代码质量报告中可以包括代码量、缺陷率、测试覆盖率、编译打包结果等质量数据。Under the microservice architecture, a technical team usually manages multiple projects, each of which belongs to a different distributed version control system (Git) repository. In order to generate a quality report, continuous integration of each project is generally performed on Jenkins, and finally a project aggregation report is manually aggregated. The Jenkins is a continuous integration tool, which can regularly compile, run the corresponding code, run integration tests, and display the running results as a project aggregation report. The obtained project aggregation report refers to the code quality report generated by some static checking tools and compilation tools during the continuous integration process of the software project; the generated code quality report may include code quantity, defect rate, test coverage, Compile quality data such as packaging results.

由于微服务架构下各项目拆分粒度较细,一个技术团队可能需要同时管理十几到几十个项目,采用上述项目聚合报告的生成方法需要技术人员手动将多个项目对应的报告聚合在一起,项目聚合报告的生成效率低。Due to the fine-grained splitting of each project under the microservice architecture, a technical team may need to manage dozens to dozens of projects at the same time. Using the above-mentioned project aggregation report generation method requires technicians to manually aggregate reports corresponding to multiple projects. , the generation efficiency of the project aggregation report is low.

发明内容SUMMARY OF THE INVENTION

有鉴于此,本发明的主要目的在于提供一种项目聚合报告的生成方法、装置和计算机可读存储介质。In view of this, the main purpose of the present invention is to provide a method, apparatus and computer-readable storage medium for generating an item aggregation report.

为达到上述目的,本发明的技术方案是这样实现的:In order to achieve the above object, the technical scheme of the present invention is achieved in this way:

本发明实施例提供了一种项目聚合报告的生成方法,所述方法包括:An embodiment of the present invention provides a method for generating an item aggregation report, the method comprising:

获得至少一个项目,根据所述至少一个项目确定至少一个第一工程;将所述至少一个第一工程添加至预设的第二工程;obtaining at least one project, and determining at least one first project according to the at least one project; adding the at least one first project to a preset second project;

将添加有所述至少一个第一工程的第二工程作为目标工程,对所述目标工程的源码进行聚合,获得针对所述至少一个第一工程的项目聚合报告。The second project to which the at least one first project is added is used as a target project, and the source code of the target project is aggregated to obtain a project aggregation report for the at least one first project.

上述方案中,所述将所述至少一个第一工程添加至预设的第二工程前,所述方法还包括:In the above solution, before adding the at least one first project to the preset second project, the method further includes:

在所述第二工程的配置文件中,添加所述至少一个第一工程对所述第二工程的父依赖描述;In the configuration file of the second project, add a description of the parent dependency of the at least one first project to the second project;

根据所述父依赖描述,建立所述至少一个第一工程与所述第二工程的父子依赖关系。According to the parent dependency description, a parent-child dependency relationship between the at least one first project and the second project is established.

上述方案中,所述对所述目标工程的源码进行聚合前,所述方法包括:In the above solution, before the source code of the target project is aggregated, the method includes:

确定所述第一工程所需的至少一个第一jar包;所述第一jar包为所述第一工程无法通过底层公共包获取的jar包;Determine at least one first jar package required by the first project; the first jar package is a jar package that the first project cannot obtain through the underlying public package;

在所述第二工程的配置文件中添加针对所述至少一个第一jar包的依赖描述,所述第一工程根据所述配置文件中的依赖描述获取所述至少一个第一jar包。A dependency description for the at least one first jar package is added to the configuration file of the second project, and the first project acquires the at least one first jar package according to the dependency description in the configuration file.

上述方案中,所述对所述目标工程的源码进行聚合前,所述方法包括:In the above solution, before the source code of the target project is aggregated, the method includes:

确定所述至少一个第一工程中包含公共工程、且所述公共工程依赖第二jar包时,修改所述公共工程的配置文件中针对jar包的依赖描述,以取消所述公共工程对所述第二jar包的依赖关系;所述第二jar包为除部署有所述第二工程的maven私有仓库包含的jar包外的第三方jar包。When it is determined that the at least one first project contains a public project and the public project depends on the second jar package, modify the dependency description for the jar package in the configuration file of the public project to cancel the public project's effect on the Dependency of the second jar package; the second jar package is a third-party jar package except the jar package included in the maven private repository where the second project is deployed.

上述方案中,所述对所述目标工程的源码进行聚合前,所述方法还包括:In the above solution, before the source code of the target project is aggregated, the method further includes:

获取所述第二工程的源码并保存在根目录;Obtain the source code of the second project and save it in the root directory;

依次获取所述至少一个第一工程的源码,在所述根目录下创建至少一个子目录;一个所述子目录对应保存一个所述第一工程的源码;Obtain the source code of the at least one first project in turn, and create at least one subdirectory under the root directory; one of the subdirectories corresponds to save a source code of the first project;

根据所述根目录和所述至少一个子目录获得树状目录。A tree-like directory is obtained from the root directory and the at least one subdirectory.

上述方案中,所述对所述目标工程的源码进行聚合,获得针对所述至少一个第一工程的项目聚合报告,包括:In the above solution, the source code of the target project is aggregated to obtain a project aggregation report for the at least one first project, including:

根据所述树状目录对所述目标工程的源码进行逐层聚合,根据聚合结果获得针对所述至少一个第一工程的项目聚合报告。The source code of the target project is aggregated layer by layer according to the tree-like directory, and a project aggregation report for the at least one first project is obtained according to the aggregation result.

本发明实施例提供了一种项目聚合报告的生成装置,所述装置包括:第一处理模块、第二处理模块;其中,An embodiment of the present invention provides an apparatus for generating an item aggregation report, the apparatus includes: a first processing module and a second processing module; wherein,

所述第一处理模块,用于获得至少一个项目,根据所述至少一个项目确定至少一个第一工程;将所述至少一个第一工程添加至预设的第二工程;The first processing module is configured to obtain at least one project, and determine at least one first project according to the at least one project; add the at least one first project to a preset second project;

所述第二处理模块,用于将添加有所述至少一个第一工程的第二工程作为目标工程,对所述目标工程的源码进行聚合,获得针对所述至少一个第一工程的项目聚合报告。The second processing module is configured to use the second project added with the at least one first project as a target project, aggregate the source code of the target project, and obtain a project aggregation report for the at least one first project .

上述方案中,所述第二处理模块,具体用于对所述目标工程的源码进行聚合前,获取所述第二工程的源码并保存在根目录;依次获取所述至少一个第一工程的源码,在所述根目录下创建至少一个子目录;一个所述子目录对应保存一个所述第一工程的源码;根据所述根目录和所述至少一个子目录获得树状目录;根据所述树状目录对所述目标工程的源码进行逐层聚合,根据聚合结果获得针对所述至少一个第一工程的项目聚合报告。In the above solution, the second processing module is specifically configured to obtain the source code of the second project and save it in the root directory before aggregating the source code of the target project; sequentially obtain the source code of the at least one first project , create at least one subdirectory under the root directory; one of the subdirectories corresponds to save a source code of the first project; obtain a tree-like directory according to the root directory and the at least one subdirectory; according to the tree The source code of the target project is aggregated layer by layer in the state directory, and a project aggregation report for the at least one first project is obtained according to the aggregation result.

本发明实施例提供了一种项目聚合报告的生成装置,所述装置包括:处理器和用于存储能够在处理器上运行的计算机程序的存储器;其中,An embodiment of the present invention provides an apparatus for generating an item aggregation report, the apparatus includes: a processor and a memory for storing a computer program that can be executed on the processor; wherein,

所述处理器用于运行所述计算机程序时,执行以上所述的任意一种项目聚合报告的生成方法的步骤。The processor is configured to execute the steps of any one of the above-mentioned methods for generating an item aggregation report when running the computer program.

本发明实施例还提供了一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现以上所述的任意一种项目聚合报告的生成方法的步骤。Embodiments of the present invention further provide a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, implements the steps of any of the foregoing methods for generating an item aggregation report.

本发明实施例所提供的项目聚合报告的生成方法、装置和计算机可读存储介质,获得至少一个项目,根据所述至少一个项目确定至少一个第一工程;将所述至少一个第一工程添加至预设的第二工程;将添加有所述至少一个第一工程的第二工程作为目标工程,对所述目标工程的源码进行聚合,获得针对所述至少一个第一工程的项目聚合报告。本发明实施例中,根据各第一工程和第二工程建立具有层级关系目标工程,从而可确定各第一工程间的关系;根据各第一工程间的关系可确定各项目间的关系,使得Jenkins可以一次性检查多个第一工程,以生成一份针对多个项目的项目聚合报告,提高项目聚合报告的生成效率。The method, device, and computer-readable storage medium for generating a project aggregation report provided by the embodiments of the present invention obtain at least one project, determine at least one first project according to the at least one project; add the at least one first project to A preset second project; taking the second project added with the at least one first project as a target project, and aggregating the source code of the target project to obtain a project aggregation report for the at least one first project. In the embodiment of the present invention, a target project with a hierarchical relationship is established according to each first project and the second project, so that the relationship between each first project can be determined; according to the relationship between each first project, the relationship between each project can be determined, so that Jenkins can check multiple first projects at one time to generate a project aggregation report for multiple projects, which improves the generation efficiency of the project aggregation report.

附图说明Description of drawings

图1为本发明实施例提供的一种项目聚合报告的生成方法的流程示意图;1 is a schematic flowchart of a method for generating a project aggregation report according to an embodiment of the present invention;

图2为本发明实施例提供的另一种项目聚合报告的生成方法的流程示意图;2 is a schematic flowchart of another method for generating a project aggregation report according to an embodiment of the present invention;

图3为本发明实施例提供的一种项目聚合报告的生成装置的结构示意图;3 is a schematic structural diagram of an apparatus for generating an item aggregation report according to an embodiment of the present invention;

图4为本发明实施例提供的另一种项目聚合报告的生成装置的结构示意图。FIG. 4 is a schematic structural diagram of another device for generating an item aggregation report according to an embodiment of the present invention.

具体实施方式Detailed ways

在本发明的各种实施例中,获得至少一个项目,根据所述至少一个项目确定至少一个第一工程;将所述至少一个第一工程添加至预设的第二工程;将添加有所述至少一个第一工程的第二工程作为目标工程,对所述目标工程的源码进行聚合,获得针对所述至少一个第一工程的项目聚合报告。In various embodiments of the present invention, at least one project is obtained, at least one first project is determined according to the at least one project; the at least one first project is added to a preset second project; A second project of at least one first project is used as a target project, and the source code of the target project is aggregated to obtain a project aggregation report for the at least one first project.

下面结合实施例对本发明再作进一步详细的说明。The present invention will be described in further detail below in conjunction with the embodiments.

图1为本发明实施例提供的一种项目聚合报告的生成方法的流程示意图;所述方法可以应用于服务器;如图1所示,所述方法包括:FIG. 1 is a schematic flowchart of a method for generating a project aggregation report according to an embodiment of the present invention; the method can be applied to a server; as shown in FIG. 1 , the method includes:

步骤101、获得至少一个项目,根据所述至少一个项目确定至少一个第一工程;将所述至少一个第一工程添加至预设的第二工程。Step 101: Obtain at least one project, and determine at least one first project according to the at least one project; add the at least one first project to a preset second project.

这里,各第一工程可以分别属于不同的项目,所述项目可以分别属于不同的Git仓库,即各第一工程可以分属于不同的Git仓库。所述Git是一个开源的分布式版本控制系统,可以有效、高速的处理从很小到非常大的项目版本管理。Here, each first project may belong to different projects, and the projects may belong to different Git repositories, that is, each first project may belong to different Git repositories. The Git is an open source distributed version control system that can handle version management of projects ranging from very small to very large efficiently and at high speed.

这里,针对每个项目来说,均可以确定一个或多个第一工程。Here, for each item, one or more first projects may be determined.

所述根据至少一个项目确定至少一个第一工程,包括:根据所述至少一个项目中的各个项目确定至少一个第一工程。The determining at least one first project according to at least one project includes: determining at least one first project according to each of the at least one project.

具体地,所述步骤101之前,所述方法包括:获取预设的第二工程。Specifically, before the step 101, the method includes: acquiring a preset second project.

这里,所述第二工程可以为一个空的工程;即所述第二工程既不用于存储业务数据,也不执行业务操作。Here, the second project may be an empty project; that is, the second project is neither used for storing business data nor performing business operations.

所述获取预设的第二工程,包括:创建空的工程,在所述工程中添加用于进行质量检测以获得项目聚合报告的工具;将添加工具后的工程作为所述第二工程。The acquiring a preset second project includes: creating an empty project, adding a tool for performing quality inspection to obtain a project aggregation report in the project; and using the project after adding the tool as the second project.

这里,所述工具为生成项目聚合报告所需的质量检查工具,具体可以用于进行静态检查和覆盖率检查等。所述质量检查工具可以采用现有的工具,因此这里不再赘述。具体可以通过在所述工程的配置文件(POM,Project Object Model)文件中,写入所述质量检查工具对应的代码或者写入获取所述质量检查工具的描述,将所述质量检查报告工具添加至所述工程。Here, the tool is a quality check tool required for generating a project aggregation report, which can be specifically used for static check and coverage check. The quality checking tool can use existing tools, so it will not be repeated here. Specifically, the quality inspection report tool can be added by writing the code corresponding to the quality inspection tool or writing the description of the quality inspection tool in the configuration file (POM, Project Object Model) file of the project. to the said project.

这里,所述POM文件为一个可扩展标记语言(XML,Extensible Markup Language)格式的配置文件;每个工程都对应有其POM文件。所述POM文件用于描述其所述工程对应的maven项目的基本信息,比如groupId、artifactId、version等,也可以对maven私有仓库、打包形式、依赖关系等进行配置。Here, the POM file is a configuration file in an Extensible Markup Language (XML, Extensible Markup Language) format; each project corresponds to its POM file. The POM file is used to describe the basic information of the maven project corresponding to the project, such as groupId, artifactId, version, etc., and can also configure the maven private repository, packaging form, dependencies, and the like.

具体地,所述将所述至少一个第一工程添加至预设的第二工程,包括:Specifically, the adding the at least one first project to the preset second project includes:

在所述第二工程的配置文件、即POM文件中,添加所述至少一个第一工程中各第一工程对所述第二工程的父依赖描述;In the configuration file of the second project, that is, the POM file, add a description of the parent dependency of each first project in the at least one first project to the second project;

根据所述父依赖描述,建立所述至少一个第一工程中各第一工程与所述第二工程的父子依赖关系。建立依赖关系后,即可将各第一工程添加至所述第二工程。According to the parent dependency description, a parent-child dependency relationship between each first project in the at least one first project and the second project is established. After the dependencies are established, each first project can be added to the second project.

这里,还可以各第一工程的POM文件中添加对所述第二工程的父依赖描述,父依赖描述可以是相同的配置描述,从而减少分别配置的工作量。Here, a parent dependency description for the second project may also be added to the POM file of each first project, and the parent dependency description may be the same configuration description, thereby reducing the workload of separate configuration.

通过添加父依赖描述,将Jenkins架构下的多个Git仓库中的各项目对应的第一工程,作为子工程添加至所述第二工程、即所述第二工程作为所述第一工程的父工程。By adding a parent dependency description, the first project corresponding to each project in multiple Git repositories under the Jenkins architecture is added as a sub-project to the second project, that is, the second project is used as the parent of the first project project.

所述步骤101,还包括:将各第一工程添加至所述第二工程后,将所述第二工程部署至maven私有仓库中,使得各第一工程在生成项目聚合报告时可引用。The step 101 further includes: after adding each first project to the second project, deploying the second project to a maven private repository, so that each first project can be referenced when generating a project aggregation report.

需要说明的是,由于上述第二工程本身为一个空的工程,即没有spring bootmain函数的工程(如作为基础服务的公共工程),在将其部署至maven私有仓库时可能会报错:Unable to find main class。因此,为了将所述第二工程部署至所述maven私有仓库中,对所述第二工程的配置文件进行修改。具体可以通过在第二工程中的maven插件中增加相关配置以修改所述第二工程的配置文件,所述在第二工程中的maven插件中增加相关配置,包括:在第二工程中的maven插件中的spring-boot-maven-plugin子插件中增加布局节点:<configuration>节点,并在该节点中增加布局配置:<layout>NONE</layout>。It should be noted that since the above second project itself is an empty project, that is, a project without the spring bootmain function (such as a public project as a basic service), an error may be reported when deploying it to the maven private repository: Unable to find main class. Therefore, in order to deploy the second project into the maven private repository, the configuration file of the second project is modified. Specifically, the configuration file of the second project can be modified by adding relevant configurations to the maven plug-in in the second project, and adding relevant configurations to the maven plug-in in the second project includes: maven in the second project Add the layout node: <configuration> node to the spring-boot-maven-plugin sub-plugin in the plug-in, and add the layout configuration to this node: <layout>NONE</layout>.

步骤102、将添加有所述至少一个第一工程的第二工程作为目标工程,对所述目标工程的源码进行聚合,获得针对所述至少一个第一工程的项目聚合报告。Step 102: Use the second project added with the at least one first project as a target project, and aggregate the source code of the target project to obtain a project aggregation report for the at least one first project.

具体地,所述对所述目标工程的源码进行聚合前,所述方法包括:Specifically, before the aggregating the source code of the target project, the method includes:

确定所述至少一个第一工程中各第一工程所需的至少一个第一jar包;所述第一jar包为所述第一工程无法通过底层公共包获取的jar包;Determine at least one first jar package required by each first project in the at least one first project; the first jar package is a jar package that the first project cannot obtain through the underlying public package;

在所述第二工程的配置文件中添加针对所述至少一个第一jar包的依赖描述,从而所述至少一个第一工程中各第一工程根据所述第二工程的配置文件中的依赖描述获取所述至少一个第一jar包。A dependency description for the at least one first jar package is added to the configuration file of the second project, so that each first project in the at least one first project is based on the dependency description in the configuration file of the second project Obtain the at least one first jar package.

这里,所述第一jar包为所述第一工程无法通过底层公共包获取的jar包,例如编译期依赖的jar包,所述编译期依赖的jar包可以包括:lombok、junit等。本实施例中,可以将公共包中的依赖描述添加到第二工程、即父工程的POM文件中,如通过从属<dependency>标签增加依赖配置,并通过<scope>compile</scope>标签将所述第一jar包配置为编译期依赖,实现对无法通过底层公共包来获取的jar包的依赖修改。Here, the first jar package is a jar package that cannot be obtained by the first project through the underlying public package, such as a jar package that depends on compilation time, and the jar package that depends on compile time may include: lombok, junit, and the like. In this embodiment, the dependency description in the public package can be added to the POM file of the second project, that is, the parent project, for example, the dependency configuration can be added through the subordinate <dependency> tag, and the <scope>compile</scope> tag can be used to add the dependency configuration. The first jar package is configured as a compile-time dependency, so as to implement dependency modification on the jar package that cannot be obtained through the underlying public package.

通过上述步骤,实现对无法通过底层公共包获取的jar包的依赖关系进行修改,以使得所述无法通过底层公共包获取的jar包可在第一工程、即子工程编译时被编译工具引用。Through the above steps, the dependency of the jar package that cannot be obtained through the underlying public package is modified, so that the jar package that cannot be obtained through the underlying public package can be referenced by the compilation tool when the first project, that is, the subproject, is compiled.

所述jar包为一种归档文件,以“.jar”为扩展名,其不仅用于进行数据压缩和发布,还用于部署封装库、组件和插件程序,并可被像编译器等工具直接使用。The jar package is an archive file with an extension of ".jar", which is not only used for data compression and distribution, but also for deploying encapsulated libraries, components and plug-in programs, and can be directly used by tools such as compilers. use.

本实施例中,考虑到项目打包(Package)、也称打发布包时,通常会将其依赖的第三方jar包引入到最终的项目jar包、即目标工程的jar包中,以便通过java–jar运行。但是,当子工程中存在公共工程时,公共工程也会将其依赖的第三方jar包引入到自身的jar包中,再被最终的所述项目jar包所依赖。这种打包方式会导致公共工程打包获得的jar包太大,不便于在其他子工程对应的项目和父工程对应的项目中依赖使用,需要支持在打公共包时不引入所依赖的第三方jar包。In this embodiment, considering the project packaging (Package), also known as the release package, the third-party jar package it depends on is usually introduced into the final project jar package, that is, the jar package of the target project, so as to pass the java- jar runs. However, when there is a public project in the subproject, the public project will also introduce the third-party jar package it depends on into its own jar package, and then be depended on by the final project jar package. This packaging method will cause the jar package obtained by packaging the public project to be too large, which is inconvenient to be used in the projects corresponding to other sub-projects and the project corresponding to the parent project. It is necessary to support the third-party jar not to be imported when the public package is packaged. Bag.

具体来说,所述对所述目标工程的源码进行聚合前,所述方法包括:Specifically, before the aggregating the source code of the target project, the method includes:

确定所述至少一个第一工程中包含公共工程、且所述公共工程依赖第二jar包时,修改所述公共工程的配置文件中针对jar包的依赖描述,以取消所述公共工程对所述第二jar包的依赖关系;所述第二jar包为除部署有所述第二工程的maven私有仓库包含的jar包外的第三方jar包。When it is determined that the at least one first project contains a public project and the public project depends on the second jar package, modify the dependency description for the jar package in the configuration file of the public project to cancel the public project's effect on the Dependency of the second jar package; the second jar package is a third-party jar package except the jar package included in the maven private repository where the second project is deployed.

举例来说,本实施例中可以通过在公共工程的POM文件中增加重新打包(repackage)的配置描述实现对打包过程进行修改。具体可以通过在spring-boot-maven-plugin插件中增加执行<execution>节点,并在该节点中增加<goal>repackage</goal>配置,完成在公共工程的POM文件中增加repackage配置。For example, in this embodiment, the packaging process can be modified by adding a configuration description of repackage (repackage) to the POM file of the public project. Specifically, you can add the execution <execution> node in the spring-boot-maven-plugin plug-in, and add the <goal>repackage</goal> configuration to the node to complete the addition of the repackage configuration to the POM file of the public project.

具体地,所述对所述目标工程的源码进行聚合前,所述方法还包括:Specifically, before the aggregating the source code of the target project, the method further includes:

获取所述第二工程的源码并保存在根目录;Obtain the source code of the second project and save it in the root directory;

依次获取所述至少一个第一工程中各第一工程的源码,在所述根目录下创建至少一个子目录;一个所述子目录对应保存一个所述第一工程的源码;Obtain the source code of each first project in the at least one first project in turn, and create at least one subdirectory under the root directory; one of the subdirectories corresponds to save the source code of one of the first projects;

根据所述根目录和所述至少一个子目录获得树状目录。A tree-like directory is obtained from the root directory and the at least one subdirectory.

具体地,所述对所述目标工程的源码进行聚合,获得针对所述至少一个第一工程的项目聚合报告,包括:Specifically, the aggregating the source code of the target project to obtain a project aggregation report for the at least one first project, including:

根据所述树状目录对所述目标工程的源码进行逐层聚合,根据聚合结果获得针对所述至少一个第一工程的项目聚合报告。The source code of the target project is aggregated layer by layer according to the tree-like directory, and a project aggregation report for the at least one first project is obtained according to the aggregation result.

具体来说,对Jenkins上目标工程中的多个第一工程的源码(具体为Git源码)进行聚合时,可以先下载父工程、即第二工程的源码;再通过父工程的multiple-scms插件在同一目录下创建至少一个子目录,将各子工程的源码下载到新创建的相应的子目录下,一个子工程的源码保存在一个子目录;从而获得包含父子工程源码的树状目录(具体应用过程中可以在Jenkins的工作区workspace根目录中显示)。Specifically, when aggregating the source code (specifically Git source code) of multiple first projects in the target project on Jenkins, you can first download the source code of the parent project, that is, the second project; and then use the multiple-scms plug-in of the parent project. Create at least one subdirectory in the same directory, download the source code of each subproject to the newly created corresponding subdirectory, and save the source code of a subproject in a subdirectory; thus obtain a tree-like directory containing the source code of the parent and child projects (specifically The application process can be displayed in the workspace root directory of Jenkins).

获得所述树状目录后,在所述树状目录(即workspace根目录)下执行检查命令,即执行所述第二工程的配置文件中的质量检查工具的命令,执行过程中逐层获取子工程(即第一工程)的源码并逐层聚合,最终即可生成一份同时包含所有子工程检查结果的项目聚合报告。After obtaining the tree-like directory, execute the inspection command under the tree-like directory (that is, the workspace root directory), that is, execute the command of the quality inspection tool in the configuration file of the second project, and obtain sub-layers layer by layer during the execution process. The source code of the project (ie, the first project) is aggregated layer by layer, and finally a project aggregation report containing the inspection results of all sub-projects can be generated.

需要说明的是,考虑源码下载时的排他性,使得同一目录下只允许下载一个源码,即若先下载子工程的源码,待下载父工程源码时会将子工程源码删除,因此,本实施例中先下载父工程作为顶级目录,再通过multiple-scms插件在同一目录下创建子目录,且创建的子目录的名称与和父工程配置文件中的子工程节点的名称一致,从而Jenkins可以将下载的子目录作为子工程来检查。It should be noted that, considering the exclusivity of the source code download, only one source code is allowed to be downloaded in the same directory, that is, if the source code of the subproject is downloaded first, the source code of the subproject will be deleted when the source code of the parent project is downloaded. Therefore, in this embodiment, the source code of the subproject will be deleted. First download the parent project as the top-level directory, and then create a subdirectory in the same directory through the multiple-scms plugin, and the name of the created subdirectory is the same as the name of the subproject node in the parent project configuration file, so that Jenkins can download the downloaded Subdirectories are checked as subprojects.

本实施例提供的上述方法,无需手写脚本或者对各项目对应的工程进行过多修改,对项目侵入少,方便自动化检查;并且支持父子工程在不同的Git仓库中进行检查,方便父子工程分别做权限管理和分支管理。The above method provided in this embodiment does not require handwritten scripts or excessive modifications to the projects corresponding to each project, less intrusion into the project, and convenient automatic inspection; and supports the inspection of the parent and child projects in different Git repositories, which is convenient for the parent and child projects to do separately. Permission management and branch management.

图2为本发明实施例提供的另一种项目聚合报告的生成方法的流程示意图;如图2所示,所述方法包括:FIG. 2 is a schematic flowchart of another method for generating an item aggregation report according to an embodiment of the present invention; as shown in FIG. 2 , the method includes:

步骤201、获取预设的父工程。Step 201: Acquire a preset parent project.

这里,所述父工程即图1所述的第二工程,可以为一个空的工程,即该父工程既不用于存储业务数据,也不执行业务操作。Here, the parent project, that is, the second project described in FIG. 1 , may be an empty project, that is, the parent project is neither used for storing business data nor performing business operations.

所述步骤201之前,包括:添加父工程。具体包括:为所述父工程编写对应的配置文件、即POM文件,并在编写POM文件时将生成项目聚合报告时需要的质量检查工具写入到父工程的POM文件中。Before the step 201, it includes: adding a parent project. Specifically, it includes: writing a corresponding configuration file, that is, a POM file, for the parent project, and writing a quality inspection tool required for generating a project aggregation report into the POM file of the parent project when writing the POM file.

需要说明的是,由于上述父工程本身为一个空的工程,即没有spring boot main函数的工程(如作为基础服务的公共工程),在将其部署至maven私有仓库时可能会报错:Unable to find main class。因此,为了将所述父工程部署至所述maven私有仓库中,对所述父工程的POM文件进行修改。具体可以通过在父工程中的maven插件中增加相关配置以修改所述父工程的POM文件,所述在父工程中的maven插件中增加相关配置,包括:在父工程中的maven插件中的spring-boot-maven-plugin子插件中增加布局节点:<configuration>节点,并在该节点中增加布局配置:<layout>NONE</layout>。It should be noted that since the above parent project itself is an empty project, that is, a project without a spring boot main function (such as a public project as a basic service), an error may be reported when deploying it to the maven private repository: Unable to find main class. Therefore, in order to deploy the parent project into the maven private repository, the POM file of the parent project is modified. Specifically, the POM file of the parent project can be modified by adding relevant configurations to the maven plug-in in the parent project, and adding relevant configurations to the maven plug-in in the parent project, including: spring in the maven plug-in in the parent project Add a layout node to the -boot-maven-plugin sub-plugin: <configuration> node, and add a layout configuration to this node: <layout>NONE</layout>.

步骤202、将至少一个第一工程添加至所述父工程,作为所述父工程的子工程。Step 202: Add at least one first project to the parent project as a child project of the parent project.

具体地,所述第一工程为Jenkins架构下的多个Git仓库中的项目对应的工程,将其作为子工程添加至所述父工程。并将所述父工程部署到maven私有仓库中,以便子工程可以在生成Jenkins项目聚合报告时引用。Specifically, the first project is a project corresponding to projects in multiple Git repositories under the Jenkins architecture, which is added to the parent project as a sub-project. And deploy the parent project to the maven private repository so that the child project can be referenced when generating the Jenkins project aggregation report.

所述将至少一个第一工程添加至所述父工程,包括:在所述父工程的POM文件中,添加所述至少一个第一工程中各第一工程对所述父工程的父依赖描述;根据所述父依赖描述,建立各第一工程与所述父工程的父子依赖关系;建立依赖关系后,即可将各第一工程添加至所述父工程。The adding at least one first project to the parent project includes: in the POM file of the parent project, adding a parent dependency description of each first project in the at least one first project to the parent project; According to the parent dependency description, a parent-child dependency relationship between each first project and the parent project is established; after the dependency relationship is established, each first project can be added to the parent project.

或者,还可以在多个第一工程的POM文件中添加指定对该父工程的父依赖描述,且各第一工程中统一使用相同的依赖描述,从而可以减少分别配置的工作量。Alternatively, a parent dependency description specifying the parent project may be added to the POM files of multiple first projects, and the same dependency description is uniformly used in each first project, thereby reducing the workload of separate configuration.

步骤203、对无法通过底层公共包获取的jar包的依赖关系进行修改。Step 203 , modify the dependency of the jar package that cannot be obtained through the underlying public package.

具体地,在添加父工程和子工程后,考虑到有些jar包无法通过底层公共包来获取,需对无法通过底层公共包获取的jar包的依赖关系进行修改,使得该jar包可在子工程编译时被编译工具引用。Specifically, after adding the parent project and sub-project, considering that some jar packages cannot be obtained through the underlying public package, it is necessary to modify the dependencies of the jar package that cannot be obtained through the underlying public package, so that the jar package can be compiled in the sub-project. is referenced by the compilation tools.

具体地,所述对目标工程的源码进行聚合前,所述方法包括:Specifically, before the source code of the target project is aggregated, the method includes:

确定各第一工程所需的至少一个第一jar包;所述第一jar包为所述第一工程无法通过底层公共包获取的jar包;在所述父工程的POM文件中添加针对所述至少一个第一jar包的依赖描述,所述至少一个第一工程根据所述父工程的POM文件中的依赖描述获取所述至少一个第一jar包。Determine at least one first jar package required by each first project; the first jar package is a jar package that cannot be obtained by the first project through the underlying public package; in the POM file of the parent project The dependency description of at least one first jar package, and the at least one first project obtains the at least one first jar package according to the dependency description in the POM file of the parent project.

举例来说,在对无法通过底层公共包来获取的jar包的依赖关系进行修改时,可以将公共包中的依赖描述添加到父工程的POM文件中,如通过<dependency>标签增加依赖配置,并通过<scope>compile</scope>标签将该jar包配置为编译期依赖。For example, when modifying the dependencies of a jar package that cannot be obtained through the underlying public package, you can add the dependency description in the public package to the POM file of the parent project, such as adding dependency configuration through the <dependency> tag, And configure the jar package as a compile-time dependency through the <scope>compile</scope> tag.

步骤204、对打包过程进行修改。Step 204: Modify the packaging process.

考虑到微服务项目在打包时,通常会将依赖的第三方jar包引入到最终的项目jar包中,以便通过java–jar运行。但是,当子工程中存在公共工程时,公共工程也会将其依赖的第三方jar包引入到自身的jar包中,再被最终的所述项目jar包所依赖。这种打包方式会导致公共工程打包获得的jar包太大,不便于在其他子工程对应的项目和父工程对应的项目中依赖使用,需要支持在打公共包时不引入所依赖的第三方jar包。Considering that when a microservice project is packaged, the dependent third-party jar package is usually introduced into the final project jar package so that it can be run through java-jar. However, when there is a public project in the subproject, the public project will also introduce the third-party jar package it depends on into its own jar package, and then be depended on by the final project jar package. This packaging method will cause the jar package obtained by packaging the public project to be too large, which is inconvenient to be used in the projects corresponding to other sub-projects and the project corresponding to the parent project. It is necessary to support the third-party jar not to be imported when the public package is packaged. Bag.

具体来说,所述对目标工程的源码进行聚合前,所述方法包括:Specifically, before the aggregating the source code of the target project, the method includes:

确定所述至少一个第一工程中包含公共工程、且所述公共工程依赖第二jar包时,修改所述公共工程的POM文件中针对jar包的依赖描述,以取消所述公共工程对所述第二jar包的依赖关系;所述第二jar包为除部署有所述第二工程的maven私有仓库包含的jar包外的第三方jar包。When it is determined that the at least one first project contains a public project and the public project depends on the second jar package, modify the dependency description for the jar package in the POM file of the public project to cancel the public project's influence on the Dependency of the second jar package; the second jar package is a third-party jar package except the jar package included in the maven private repository where the second project is deployed.

举例来说,本实施例中可以通过在公共工程的POM文件中增加重新打包(repackage)的配置描述实现对打包过程进行修改。具体可以通过在spring-boot-maven-plugin插件中增加执行<execution>节点,并在该节点中增加<goal>repackage</goal>配置,完成在公共工程的POM文件中增加repackage配置。For example, in this embodiment, the packaging process can be modified by adding a configuration description of repackage (repackage) to the POM file of the public project. Specifically, you can add the execution <execution> node in the spring-boot-maven-plugin plug-in, and add the <goal>repackage</goal> configuration to the node to complete the addition of the repackage configuration to the POM file of the public project.

步骤205、将添加有所述至少一个第一工程的父工程作为目标工程,对所述目标工程的源码进行聚合,获得针对所述至少一个第一工程的项目聚合报告。Step 205: Use the parent project to which the at least one first project is added as a target project, and aggregate the source code of the target project to obtain a project aggregation report for the at least one first project.

具体地,所述步骤205,包括:下载父工程的源码;再通过multiple-scms插件在同一目录下创建子目录,之后将子工程、即各第一工程的源码下载到新创建的相应子目录下;从而在Jenkins的workspace根目录中生成完整的包含父子工程源码的树状目录,为全方位的检查做好准备;Specifically, the step 205 includes: downloading the source code of the parent project; then creating a subdirectory under the same directory through the multiple-scms plug-in, and then downloading the source code of the subproject, that is, each first project, to the newly created corresponding subdirectory Then, a complete tree-like directory containing the source code of the parent and child projects is generated in the workspace root directory of Jenkins, ready for a comprehensive inspection;

获得所述树状目录后,在所述树状目录、即上述workspace目录下执行检查命令,执行配置在父工程的POM文件中的质量检查工具的命令,执行过程中逐层获取子工程的源码并逐层聚合,最终即可生成一份同时包含所有子工程检查结果的项目聚合报告。After obtaining the tree-like directory, execute the inspection command in the tree-like directory, that is, the above-mentioned workspace directory, execute the command of the quality inspection tool configured in the POM file of the parent project, and obtain the source code of the subproject layer by layer during the execution process. And aggregate it layer by layer, and finally generate a project aggregation report that includes the inspection results of all sub-projects at the same time.

需要说明的是,考虑Git源码下载时的排他性,使得同一目录下只允许下载一个源码,即若先下载子工程的源码,待下载父工程源码时会将子工程源码删除,因此,本实施例中先下载父工程作为顶级目录,再通过multiple-scms插件在同一目录下创建子目录,且创建的子目录的名称与和父工程的POM文件中的子工程节点的名称一致,从而Jenkins可以将下载的子目录作为子工程来检查。It should be noted that, considering the exclusivity of Git source code download, only one source code is allowed to be downloaded in the same directory, that is, if the source code of the subproject is downloaded first, the source code of the subproject will be deleted when the source code of the parent project is downloaded. Therefore, this embodiment First download the parent project as the top-level directory, and then create a subdirectory in the same directory through the multiple-scms plugin, and the name of the created subdirectory is the same as the name of the subproject node in the POM file of the parent project, so that Jenkins can Downloaded subdirectories are checked as subprojects.

图3为本发明实施例提供的一种项目聚合报告的生成装置的结构示意图;如图3所示,所述装置包括:第一处理模块301和第二处理模块302。FIG. 3 is a schematic structural diagram of an apparatus for generating an item aggregation report according to an embodiment of the present invention; as shown in FIG. 3 , the apparatus includes: a first processing module 301 and a second processing module 302 .

所述第一处理模块301,用于获得至少一个项目,根据所述至少一个项目确定至少一个第一工程;将所述至少一个第一工程添加至预设的第二工程。The first processing module 301 is configured to obtain at least one project, determine at least one first project according to the at least one project, and add the at least one first project to a preset second project.

所述第二处理模块302,用于将添加有所述至少一个第一工程的第二工程作为目标工程,对所述目标工程的源码进行聚合,获得针对所述至少一个第一工程的项目聚合报告。The second processing module 302 is configured to use the second project added with the at least one first project as a target project, and aggregate the source code of the target project to obtain a project aggregation for the at least one first project Report.

具体地,所述第一处理模块301,用于将所述至少一个第一工程添加至预设的第二工程前,在所述第二工程的配置文件中,添加所述至少一个第一工程对所述第二工程的父依赖描述;根据所述父依赖描述,建立所述至少一个第一工程与所述第二工程的父子依赖关系。Specifically, the first processing module 301 is configured to, before adding the at least one first project to a preset second project, add the at least one first project in the configuration file of the second project A parent dependency description for the second project; according to the parent dependency description, establish a parent-child dependency relationship between the at least one first project and the second project.

具体地,所述第二处理模块302,用于对所述目标工程的源码进行聚合前,确定所述第一工程所需的至少一个第一jar包;所述第一jar包为所述第一工程无法通过底层公共包获取的jar包;在所述第二工程的配置文件中添加针对所述至少一个第一jar包的依赖描述,所述第一工程根据所述配置文件中的依赖描述获取所述至少一个第一jar包。Specifically, the second processing module 302 is configured to determine at least one first jar package required by the first project before aggregating the source code of the target project; the first jar package is the first jar package. A jar package that cannot be obtained through the underlying public package for a project; a dependency description for the at least one first jar package is added to the configuration file of the second project, and the first project is based on the dependency description in the configuration file. Obtain the at least one first jar package.

具体地,所述第二处理模块302,用于对所述目标工程的源码进行聚合前,确定所述至少一个第一工程中包含公共工程、且所述公共工程依赖第二jar包时,修改所述公共工程的配置文件中针对jar包的依赖描述,以取消所述公共工程对所述第二jar包的依赖关系;所述第二jar包为除部署有所述第二工程的maven私有仓库包含的jar包外的第三方jar包。Specifically, the second processing module 302 is configured to, before aggregating the source code of the target project, determine that the at least one first project includes a public project and the public project depends on the second jar package, modify the The dependency description for the jar package in the configuration file of the public project, so as to cancel the dependency of the public project on the second jar package; the second jar package is private except for the maven in which the second project is deployed. A third-party jar package other than the jar package contained in the repository.

具体地,所述第二处理模块302,用于对所述目标工程的源码进行聚合前,获取所述第二工程的源码并保存在根目录;依次获取所述至少一个第一工程的源码,在所述根目录下创建至少一个子目录;一个所述子目录对应保存一个所述第一工程的源码;根据所述根目录和所述至少一个子目录获得树状目录。Specifically, the second processing module 302 is configured to obtain the source code of the second project and save it in the root directory before aggregating the source code of the target project; sequentially obtain the source code of the at least one first project, At least one subdirectory is created under the root directory; one of the subdirectories corresponds to save a source code of the first project; a tree-like directory is obtained according to the root directory and the at least one subdirectory.

具体地,所述第二处理模块302,用于根据所述树状目录对所述目标工程的源码进行逐层聚合,根据聚合结果获得针对所述至少一个第一工程的项目聚合报告。Specifically, the second processing module 302 is configured to perform layer-by-layer aggregation of the source code of the target project according to the tree-like directory, and obtain a project aggregation report for the at least one first project according to the aggregation result.

需要说明的是:上述实施例提供的项目聚合报告的生成装置在进行项目聚合报告的生成方法时,仅以上述各程序模块的划分进行举例说明,实际应用中,可以根据需要而将上述处理分配由不同的程序模块完成,即将装置的内部结构划分成不同的程序模块,以完成以上描述的全部或者部分处理。另外,上述实施例提供的项目聚合报告的生成装置与项目聚合报告的生成方法实施例属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。It should be noted that when the device for generating an item aggregation report provided by the above embodiment performs the method for generating an item aggregation report, only the division of the above program modules is used as an example for illustration. In practical applications, the above processing may be allocated as required. It is completed by different program modules, that is, the internal structure of the device is divided into different program modules, so as to complete all or part of the processing described above. In addition, the device for generating an item aggregation report provided by the above embodiment and the embodiment of the method for generating an item aggregation report belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.

图4为本发明实施例提供的另一种项目聚合报告的生成装置的结构示意图。所述装置40包括:处理器401和用于存储能够在所述处理器上运行的计算机程序的存储器402;其中,所述处理器401用于运行所述计算机程序时,执行:获得至少一个项目,根据所述至少一个项目确定至少一个第一工程;将所述至少一个第一工程添加至预设的第二工程;将添加有所述至少一个第一工程的第二工程作为目标工程,对所述目标工程的源码进行聚合,获得针对所述至少一个第一工程的项目聚合报告。FIG. 4 is a schematic structural diagram of another device for generating an item aggregation report according to an embodiment of the present invention. The apparatus 40 includes: a processor 401 and a memory 402 for storing a computer program that can be executed on the processor; wherein, the processor 401 is configured to, when running the computer program, execute: obtain at least one item , determine at least one first project according to the at least one project; add the at least one first project to a preset second project; take the second project to which the at least one first project is added as a target project, The source code of the target project is aggregated to obtain a project aggregation report for the at least one first project.

在一实施例中,所述处理器401还用于运行所述计算机程序时,执行:将所述至少一个第一工程添加至预设的第二工程前,在所述第二工程的配置文件中,添加所述至少一个第一工程对所述第二工程的父依赖描述;根据所述父依赖描述,建立所述至少一个第一工程与所述第二工程的父子依赖关系。In one embodiment, the processor 401 is further configured to, when running the computer program, execute: before adding the at least one first project to a preset second project, in the configuration file of the second project , adding a parent dependency description of the at least one first project to the second project; and establishing a parent-child dependency relationship between the at least one first project and the second project according to the parent dependency description.

在一实施例中,所述处理器401还用于运行所述计算机程序时,执行:对所述目标工程的源码进行聚合前,确定所述第一工程所需的至少一个第一jar包;所述第一jar包为所述第一工程无法通过底层公共包获取的jar包;在所述第二工程的配置文件中添加针对所述至少一个第一jar包的依赖描述,所述第一工程根据所述配置文件中的依赖描述获取所述至少一个第一jar包。In one embodiment, the processor 401 is further configured to, when running the computer program, execute: before aggregating the source code of the target project, determine at least one first jar package required by the first project; The first jar package is a jar package that the first project cannot obtain through the underlying public package; a dependency description for the at least one first jar package is added to the configuration file of the second project, and the first jar package is The project obtains the at least one first jar package according to the dependency description in the configuration file.

在一实施例中,所述处理器401还用于运行所述计算机程序时,执行:对所述目标工程的源码进行聚合前,确定所述至少一个第一工程中包含公共工程、且所述公共工程依赖第二jar包时,修改所述公共工程的配置文件中针对jar包的依赖描述,以取消所述公共工程对所述第二jar包的依赖关系;所述第二jar包为除部署有所述第二工程的maven私有仓库包含的jar包外的第三方jar包。In one embodiment, the processor 401 is further configured to, when running the computer program, execute: before aggregating the source code of the target project, determine that the at least one first project includes a public project, and the When the public project depends on the second jar package, modify the dependency description for the jar package in the configuration file of the public project to cancel the public project's dependency on the second jar package; A third-party jar package other than the jar package contained in the maven private repository of the second project is deployed.

在一实施例中,所述处理器401还用于运行所述计算机程序时,执行:对所述目标工程的源码进行聚合前,获取所述第二工程的源码并保存在根目录;依次获取所述至少一个第一工程的源码,在所述根目录下创建至少一个子目录;一个所述子目录对应保存一个所述第一工程的源码;根据所述根目录和所述至少一个子目录获得树状目录。In one embodiment, the processor 401 is further configured to, when running the computer program, execute: before aggregating the source code of the target project, obtain the source code of the second project and save it in the root directory; obtain the source code in sequence; For the source code of the at least one first project, create at least one subdirectory under the root directory; one of the subdirectories corresponds to save the source code of the first project; according to the root directory and the at least one subdirectory Get a tree-like directory.

在一实施例中,所述处理器401还用于运行所述计算机程序时,执行:根据所述树状目录对所述目标工程的源码进行逐层聚合,根据聚合结果获得针对所述至少一个第一工程的项目聚合报告。In one embodiment, the processor 401 is further configured to perform, when running the computer program: perform layer-by-layer aggregation on the source code of the target project according to the tree-like directory, and obtain the at least one target project according to the aggregation result. Project aggregation report of the first project.

需要说明的是:上述实施例提供的项目聚合报告的生成装置与项目聚合报告的生成方法实施例属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。It should be noted that the device for generating an item aggregation report provided by the above embodiment and the embodiment of the method for generating an item aggregation report belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.

实际应用时,所述装置40还可以包括:至少一个网络接口403。项目聚合报告的生成装置40中的各个组件通过总线系统404耦合在一起。可理解,总线系统404用于实现这些组件之间的连接通信。总线系统404除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。但是为了清楚说明起见,在图4中将各种总线都标为总线系统404。其中,所述处理器404的个数可以为至少一个。网络接口403用于项目聚合报告的生成装置40与其他设备之间有线或无线方式的通信。In practical application, the apparatus 40 may further include: at least one network interface 403 . The various components in the generating device 40 of the project aggregation report are coupled together by a bus system 404 . It will be appreciated that the bus system 404 is used to implement the connection communication between these components. In addition to the data bus, the bus system 404 also includes a power bus, a control bus, and a status signal bus. However, for clarity of illustration, the various buses are labeled as bus system 404 in FIG. 4 . The number of the processors 404 may be at least one. The network interface 403 is used for wired or wireless communication between the item aggregation report generating apparatus 40 and other devices.

本发明实施例中的存储器402用于存储各种类型的数据以支持项目聚合报告的生成装置40的操作。The memory 402 in the embodiment of the present invention is used for storing various types of data to support the operation of the generating apparatus 40 for the item aggregation report.

上述本发明实施例揭示的方法可以应用于处理器401中,或者由处理器401实现。处理器401可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器401中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器401可以是通用处理器、数字信号处理器(DSP,DiGital Signal Processor),或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。处理器401可以实现或者执行本发明实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者任何常规的处理器等。结合本发明实施例所公开的方法的步骤,可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于存储介质中,该存储介质位于存储器402,处理器401读取存储器402中的信息,结合其硬件完成前述方法的步骤。The methods disclosed in the above embodiments of the present invention may be applied to the processor 401 or implemented by the processor 401 . The processor 401 may be an integrated circuit chip with signal processing capability. In the implementation process, each step of the above-mentioned method can be completed by an integrated logic circuit of hardware in the processor 401 or an instruction in the form of software. The above-mentioned processor 401 may be a general-purpose processor, a digital signal processor (DSP, DiGital Signal Processor), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, and the like. The processor 401 may implement or execute the methods, steps, and logical block diagrams disclosed in the embodiments of the present invention. A general purpose processor may be a microprocessor or any conventional processor or the like. The steps of the method disclosed in combination with the embodiments of the present invention can be directly embodied as being executed by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software module may be located in a storage medium, and the storage medium is located in the memory 402, and the processor 401 reads the information in the memory 402, and completes the steps of the foregoing method in combination with its hardware.

在示例性实施例中,项目聚合报告的生成装置40可以被一个或多个应用专用集成电路(ASIC,Application Specific Integrated Circuit)、DSP、可编程逻辑器件(PLD,Programmable Logic Device)、复杂可编程逻辑器件(CPLD,Complex Programmable LogicDevice)、现场可编程门阵列(FPGA,Field-Programmable Gate Array)、通用处理器、控制器、微控制器(MCU,Micro Controller Unit)、微处理器(Microprocessor)、或其他电子元件实现,用于执行前述方法。In an exemplary embodiment, the generating device 40 of the item aggregation report may be implemented by one or more application-specific integrated circuits (ASIC, Application Specific Integrated Circuit), DSP, Programmable Logic Device (PLD, Programmable Logic Device), complex programmable Logic Device (CPLD, Complex Programmable LogicDevice), Field Programmable Gate Array (FPGA, Field-Programmable Gate Array), General Purpose Processor, Controller, Microcontroller (MCU, Micro Controller Unit), Microprocessor (Microprocessor), or other electronic components to implement the aforementioned method.

本发明实施例还提供了一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器运行时,执行:获得至少一个项目,根据所述至少一个项目确定至少一个第一工程;将所述至少一个第一工程添加至预设的第二工程;将添加有所述至少一个第一工程的第二工程作为目标工程,对所述目标工程的源码进行聚合,获得针对所述至少一个第一工程的项目聚合报告。Embodiments of the present invention further provide a computer-readable storage medium, on which a computer program is stored, and when the computer program is run by a processor, execute: obtain at least one item, and determine at least one first item according to the at least one item project; adding the at least one first project to a preset second project; taking the second project to which the at least one first project is added as a target project, and aggregating the source code of the target project to obtain A project aggregation report describing at least one first project.

在一实施例中,所述计算机程序被处理器运行时,执行:将所述至少一个第一工程添加至预设的第二工程前,在所述第二工程的配置文件中,添加所述至少一个第一工程对所述第二工程的父依赖描述;根据所述父依赖描述,建立所述至少一个第一工程与所述第二工程的父子依赖关系。In one embodiment, when the computer program is run by the processor, execute: before adding the at least one first project to a preset second project, in the configuration file of the second project, add the A parent dependency description of at least one first project on the second project; and a parent-child dependency relationship between the at least one first project and the second project is established according to the parent dependency description.

在一实施例中,所述计算机程序被处理器运行时,执行:对所述目标工程的源码进行聚合前,确定所述第一工程所需的至少一个第一jar包;所述第一jar包为所述第一工程无法通过底层公共包获取的jar包;在所述第二工程的配置文件中添加针对所述至少一个第一jar包的依赖描述,所述第一工程根据所述配置文件中的依赖描述获取所述至少一个第一jar包。In one embodiment, when the computer program is run by the processor, execute: before aggregating the source code of the target project, determine at least one first jar package required by the first project; the first jar The package is a jar package that the first project cannot obtain through the underlying public package; a dependency description for the at least one first jar package is added to the configuration file of the second project, and the first project is based on the configuration The dependency description in the file obtains the at least one first jar package.

在一实施例中,所述计算机程序被处理器运行时,执行:对所述目标工程的源码进行聚合前,确定所述至少一个第一工程中包含公共工程、且所述公共工程依赖第二jar包时,修改所述公共工程的配置文件中针对jar包的依赖描述,以取消所述公共工程对所述第二jar包的依赖关系;所述第二jar包为除部署有所述第二工程的maven私有仓库包含的jar包外的第三方jar包。In one embodiment, when the computer program is run by the processor, execute: before aggregating the source code of the target project, determine that the at least one first project includes a public project, and the public project depends on the second project. jar package, modify the dependency description for the jar package in the configuration file of the public project to cancel the dependency of the public project on the second jar package; The third-party jar package outside the jar package contained in the maven private repository of the second project.

在一实施例中,所述计算机程序被处理器运行时,执行:对所述目标工程的源码进行聚合前,获取所述第二工程的源码并保存在根目录;依次获取所述至少一个第一工程的源码,在所述根目录下创建至少一个子目录;一个所述子目录对应保存一个所述第一工程的源码;根据所述根目录和所述至少一个子目录获得树状目录。In one embodiment, when the computer program is run by the processor, execute: before aggregating the source code of the target project, obtain the source code of the second project and save it in the root directory; sequentially obtain the at least one first project. For the source code of a project, at least one subdirectory is created under the root directory; one of the subdirectories correspondingly stores a source code of the first project; a tree-like directory is obtained according to the root directory and the at least one subdirectory.

在一实施例中,所述计算机程序被处理器运行时,执行:根据所述树状目录对所述目标工程的源码进行逐层聚合,根据聚合结果获得针对所述至少一个第一工程的项目聚合报告。In one embodiment, when the computer program is run by the processor, execute: perform layer-by-layer aggregation on the source code of the target project according to the tree-like directory, and obtain a project for the at least one first project according to the aggregation result Aggregated reports.

在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。以上所描述的设备实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,如:多个单元或组件可以结合,或可以集成到另一个系统,或一些特征可以忽略,或不执行。另外,所显示或讨论的各组成部分相互之间的耦合、或直接耦合、或通信连接可以是通过一些接口,设备或单元的间接耦合或通信连接,可以是电性的、机械的或其它形式的。In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other manners. The device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined, or Can be integrated into another system, or some features can be ignored, or not implemented. In addition, the coupling, or direct coupling, or communication connection between the components shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be electrical, mechanical or other forms. of.

上述作为分离部件说明的单元可以是、或也可以不是物理上分开的,作为单元显示的部件可以是、或也可以不是物理单元,即可以位于一个地方,也可以分布到多个网络单元上;可以根据实际的需要选择其中的部分或全部单元来实现本实施例方案的目的。The unit described above as a separate component may or may not be physically separated, and the component displayed as a unit may or may not be a physical unit, that is, it may be located in one place or distributed to multiple network units; Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.

另外,在本发明各实施例中的各功能单元可以全部集成在一个处理单元中,也可以是各单元分别单独作为一个单元,也可以两个或两个以上单元集成在一个单元中;上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present invention may all be integrated into one processing unit, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above-mentioned integration The unit can be implemented either in the form of hardware or in the form of hardware plus software functional units.

本领域普通技术人员可以理解:实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成,前述的程序可以存储于一计算机可读取存储介质中,该程序在执行时,执行包括上述方法实施例的步骤;而前述的存储介质包括:移动存储设备、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。Those of ordinary skill in the art can understand that all or part of the steps of implementing the above method embodiments can be completed by program instructions related to hardware, the aforementioned program can be stored in a computer-readable storage medium, and when the program is executed, execute Including the steps of the above-mentioned method embodiment; and the aforementioned storage medium includes: a mobile storage device, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk and other various A medium on which program code can be stored.

或者,本发明上述集成的单元如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明实施例的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机、服务器、或者网络设备等)执行本发明各个实施例所述方法的全部或部分。而前述的存储介质包括:移动存储设备、ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。Alternatively, if the above-mentioned integrated unit of the present invention is implemented in the form of a software function module and sold or used as an independent product, it may also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of the present invention may be embodied in the form of software products in essence or the parts that make contributions to the prior art. The computer software products are stored in a storage medium and include several instructions for A computer device (which may be a personal computer, a server, or a network device, etc.) is caused to execute all or part of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes: a removable storage device, a ROM, a RAM, a magnetic disk or an optical disk and other mediums that can store program codes.

以上所述,仅为本发明的较佳实施例而已,并非用于限定本发明的保护范围,凡在本发明的精神和原则之内所作的任何修改、等同替换和改进等,均应包含在本发明的保护范围之内。The above are only preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present invention shall be included in the within the protection scope of the present invention.

Claims (10)

1.一种项目聚合报告的生成方法,其特征在于,所述方法包括:1. a generation method of project aggregation report, is characterized in that, described method comprises: 获得至少一个项目,根据所述至少一个项目确定至少一个第一工程;将所述至少一个第一工程添加至预设的第二工程;obtaining at least one project, and determining at least one first project according to the at least one project; adding the at least one first project to a preset second project; 将添加有所述至少一个第一工程的第二工程作为目标工程,对所述目标工程的源码进行聚合,获得针对所述至少一个第一工程的项目聚合报告。The second project to which the at least one first project is added is used as a target project, and the source code of the target project is aggregated to obtain a project aggregation report for the at least one first project. 2.根据权利要求1所述的方法,其特征在于,所述将所述至少一个第一工程添加至预设的第二工程前,所述方法还包括:2. The method according to claim 1, wherein, before the adding the at least one first project to the preset second project, the method further comprises: 在所述第二工程的配置文件中,添加所述至少一个第一工程对所述第二工程的父依赖描述;In the configuration file of the second project, add a description of the parent dependency of the at least one first project to the second project; 根据所述父依赖描述,建立所述至少一个第一工程与所述第二工程的父子依赖关系。According to the parent dependency description, a parent-child dependency relationship between the at least one first project and the second project is established. 3.根据权利要求1所述的方法,其特征在于,所述对所述目标工程的源码进行聚合前,所述方法包括:3. The method according to claim 1, wherein, before the source code of the target project is aggregated, the method comprises: 确定所述第一工程所需的至少一个第一jar包;所述第一jar包为所述第一工程无法通过底层公共包获取的jar包;Determine at least one first jar package required by the first project; the first jar package is a jar package that the first project cannot obtain through the underlying public package; 在所述第二工程的配置文件中添加针对所述至少一个第一jar包的依赖描述,所述第一工程根据所述配置文件中的依赖描述获取所述至少一个第一jar包。A dependency description for the at least one first jar package is added to the configuration file of the second project, and the first project acquires the at least one first jar package according to the dependency description in the configuration file. 4.根据权利要求1所述的方法,其特征在于,所述对所述目标工程的源码进行聚合前,所述方法包括:4. The method according to claim 1, wherein before the source code of the target project is aggregated, the method comprises: 确定所述至少一个第一工程中包含公共工程、且所述公共工程依赖第二jar包时,修改所述公共工程的配置文件中针对jar包的依赖描述,以取消所述公共工程对所述第二jar包的依赖关系;所述第二jar包为除部署有所述第二工程的maven私有仓库包含的jar包外的第三方jar包。When it is determined that the at least one first project contains a public project and the public project depends on the second jar package, modify the dependency description for the jar package in the configuration file of the public project to cancel the public project's effect on the Dependency of the second jar package; the second jar package is a third-party jar package except the jar package included in the maven private repository where the second project is deployed. 5.根据权利要求1所述的方法,其特征在于,所述对所述目标工程的源码进行聚合前,所述方法还包括:5. The method according to claim 1, wherein before the source code of the target project is aggregated, the method further comprises: 获取所述第二工程的源码并保存在根目录;Obtain the source code of the second project and save it in the root directory; 依次获取所述至少一个第一工程的源码,在所述根目录下创建至少一个子目录;一个所述子目录对应保存一个所述第一工程的源码;Obtain the source code of the at least one first project in turn, and create at least one subdirectory under the root directory; one of the subdirectories corresponds to save a source code of the first project; 根据所述根目录和所述至少一个子目录获得树状目录。A tree-like directory is obtained from the root directory and the at least one subdirectory. 6.根据权利要求5所述的方法,其特征在于,所述对所述目标工程的源码进行聚合,获得针对所述至少一个第一工程的项目聚合报告,包括:6. The method according to claim 5, wherein the aggregating the source code of the target project to obtain a project aggregation report for the at least one first project, comprising: 根据所述树状目录对所述目标工程的源码进行逐层聚合,根据聚合结果获得针对所述至少一个第一工程的项目聚合报告。The source code of the target project is aggregated layer by layer according to the tree-like directory, and a project aggregation report for the at least one first project is obtained according to the aggregation result. 7.一种项目聚合报告的生成装置,其特征在于,所述装置包括:第一处理模块、第二处理模块;其中,7. An apparatus for generating an item aggregation report, wherein the apparatus comprises: a first processing module and a second processing module; wherein, 所述第一处理模块,用于获得至少一个项目,根据所述至少一个项目确定至少一个第一工程;将所述至少一个第一工程添加至预设的第二工程;The first processing module is configured to obtain at least one project, and determine at least one first project according to the at least one project; add the at least one first project to a preset second project; 所述第二处理模块,用于将添加有所述至少一个第一工程的第二工程作为目标工程,对所述目标工程的源码进行聚合,获得针对所述至少一个第一工程的项目聚合报告。The second processing module is configured to use the second project added with the at least one first project as a target project, aggregate the source code of the target project, and obtain a project aggregation report for the at least one first project . 8.根据权利要求7所述的装置,其特征在于,所述第二处理模块,具体用于对所述目标工程的源码进行聚合前,获取所述第二工程的源码并保存在根目录;依次获取所述至少一个第一工程的源码,在所述根目录下创建至少一个子目录;一个所述子目录对应保存一个所述第一工程的源码;根据所述根目录和所述至少一个子目录获得树状目录;根据所述树状目录对所述目标工程的源码进行逐层聚合,根据聚合结果获得针对所述至少一个第一工程的项目聚合报告。8. The device according to claim 7, wherein the second processing module is specifically configured to obtain the source code of the second project and save it in the root directory before aggregating the source code of the target project; Obtain the source code of the at least one first project in turn, and create at least one subdirectory under the root directory; one of the subdirectories corresponds to save the source code of one of the first projects; according to the root directory and the at least one A tree-like directory is obtained from the sub-directory; the source code of the target project is aggregated layer by layer according to the tree-like directory, and a project aggregation report for the at least one first project is obtained according to the aggregation result. 9.一种项目聚合报告的生成装置,其特征在于,所述装置包括:处理器和用于存储能够在处理器上运行的计算机程序的存储器;其中,9. An apparatus for generating an item aggregation report, wherein the apparatus comprises: a processor and a memory for storing a computer program that can be run on the processor; wherein, 所述处理器用于运行所述计算机程序时,执行权利要求1至6任一项所述方法的步骤。When the processor is configured to run the computer program, the steps of the method according to any one of claims 1 to 6 are executed. 10.一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1至6任一项所述方法的步骤。10. A computer-readable storage medium on which a computer program is stored, characterized in that, when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
CN201811638819.5A 2018-12-29 2018-12-29 Project aggregation report generation method and device and storage medium Pending CN109766128A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811638819.5A CN109766128A (en) 2018-12-29 2018-12-29 Project aggregation report generation method and device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811638819.5A CN109766128A (en) 2018-12-29 2018-12-29 Project aggregation report generation method and device and storage medium

Publications (1)

Publication Number Publication Date
CN109766128A true CN109766128A (en) 2019-05-17

Family

ID=66453034

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811638819.5A Pending CN109766128A (en) 2018-12-29 2018-12-29 Project aggregation report generation method and device and storage medium

Country Status (1)

Country Link
CN (1) CN109766128A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111782191A (en) * 2020-06-29 2020-10-16 京东数字科技控股有限公司 A method and device for creating a project project

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040255265A1 (en) * 2003-03-26 2004-12-16 Brown William M. System and method for project management
CN101540022A (en) * 2008-01-22 2009-09-23 埃森哲环球服务有限公司 Knowledge transfer in a project environment

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040255265A1 (en) * 2003-03-26 2004-12-16 Brown William M. System and method for project management
CN101540022A (en) * 2008-01-22 2009-09-23 埃森哲环球服务有限公司 Knowledge transfer in a project environment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
IT_小翼: "一个多maven项目聚合的实例", 《HTTPS://MY.OSCHINA.NET/XUQIANG/BLOG/99854》 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111782191A (en) * 2020-06-29 2020-10-16 京东数字科技控股有限公司 A method and device for creating a project project

Similar Documents

Publication Publication Date Title
CN110532189B (en) Continuous integration system, method and device
CN102693183B (en) Method and system for realizing automatic software testing
US20230236809A1 (en) Ios application program construction method and apparatus, electronic device, and storage medium
CN104854558B (en) For using compiling and deployment services to carry out system, the method and computer program product of software building and load processing
CN103530137B (en) A kind of Java web applications dispositions method and device
CN107896244B (en) Version file distribution method, client and server
US8843904B2 (en) Automated building and retargeting of architecture-dependent assets
CN108964968B (en) Service access management method and system in container cloud environment
CN106559438A (en) A kind of program method for uploading and device based on objective network platform
US9952835B2 (en) Generation of hybrid enterprise mobile applications in cloud environment
CN105335173A (en) Method, apparatus and system for initializing intelligent terminal device
CN110888794B (en) Interface testing method and device
CN110083342B (en) Program generation method and device and computer readable storage medium
CN112581201A (en) Mobile open platform for industrial interconnection manufacturing and implementation method
CN108319460A (en) Method, device, electronic device and storage medium for generating application installation package
US20240078103A1 (en) Generating and distributing customized embedded operating systems
CN114253547A (en) Frame generation method and device, storage medium and electronic device
US20130125093A1 (en) Generating object-oriented programming language code from a multi-domain dynamic simulation model
CN112445513A (en) Installation package processing method and device
CN102256242A (en) System and method for processing service application
US12314693B2 (en) Visual generation of software deployment pipelines using recommendations of development and operations blueprints
CN116679912A (en) Code generation method, apparatus, device, storage medium, and computer program
CN103678485B (en) Virtual experiment process node driving and movable packaging system
CN109766128A (en) Project aggregation report generation method and device and storage medium
CN113805878B (en) Plug-in engineering method, device, computer system and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20190517