CN112379916A - Method and device for modifying version number of maven project - Google Patents
Method and device for modifying version number of maven project Download PDFInfo
- Publication number
- CN112379916A CN112379916A CN202011265179.5A CN202011265179A CN112379916A CN 112379916 A CN112379916 A CN 112379916A CN 202011265179 A CN202011265179 A CN 202011265179A CN 112379916 A CN112379916 A CN 112379916A
- Authority
- CN
- China
- Prior art keywords
- version number
- shell script
- project
- changing
- executing
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
- G06F8/71—Version control; Configuration management
Abstract
One or more embodiments of the present specification provide a method and an apparatus for modifying a version number of a maven project, where the method for modifying includes: executing a first shell script for changing the version number of the branch under the root path; obtaining pom.xml under the root path; executing a second shell script in the pom.xml for changing the version number of the target engineering dependent jar package; and submitting the execution result of the first shell script and the execution result of the second shell script to the code warehouse for saving. The embodiment of the invention detects the acquired branched codes and acquires the root paths of the codes, then executes the edited first shell script under the root paths, and then executes the edited second shell script in the pom.xml acquired under the root paths, so that the modification of the version number of the project and the version number of the project dependent jar package can be completed simultaneously, thereby reducing the operation amount of modifying the maven project version number, avoiding the situations of missed modification and wrong modification and improving the modification efficiency of the version number.
Description
Technical Field
One or more embodiments of the present disclosure relate to the field of maven engineering technologies, and in particular, to a method and an apparatus for modifying a version number of a maven engineering.
Background
A healthy maven project usually has a version evolution process, in which version iteration inevitably occurs, and in which version number changes are involved.
In the prior art, a developer needs to manually modify the version number of a maven project, if there are many sub-projects under the current maven project, a large amount of operations for adjusting the version number are needed, and the current maven can modify the version number of the project; however, if the dependency of multiple projects is involved, the version number needs to be modified in each dependent project, and the operation amount is too large, which easily causes the situations of missed modification and wrong modification, and seriously reduces the modification efficiency of the version number.
Disclosure of Invention
In view of this, one or more embodiments of the present disclosure provide a method and an apparatus for modifying a version number of a maven project, so as to solve the problem of inefficient change of the version number.
In view of the above, one or more embodiments of the present specification provide a method for modifying a version number of a maven project, including:
acquiring the name of a target project and a corresponding new version number;
acquiring a corresponding target project from a code warehouse according to the name of the target project;
pulling a new branch from the trunk of the target project;
detecting the codes of the branches through Jenkins to obtain the codes of the branches;
obtaining a root path of the branched code;
executing a first shell script for changing the version number of the branch under the root path;
obtaining pom.xml under the root path;
executing a second shell script in the pom.xml for changing the version number of the target engineering dependent jar package;
and submitting the execution result of the first shell script and the execution result of the second shell script to the code warehouse for saving.
As an optional implementation, the executing the first shell script under the root path for changing the version number of the branch includes:
acquiring a first shell script for changing the version number of the branch;
executing the first shell script under the root path.
Further, the first shell script includes an old version number, the new version number and a modification range of the branch.
As an optional implementation, the executing, in the pom.xml, a second shell script for changing the version number of the target engineering dependent jar package includes:
acquiring a second shell script for changing the version number of the target engineering dependent jar packet;
xml, executing the second shell script.
Further, the second shell script includes the name of the target project and the new version number.
Corresponding to the modification method, an embodiment of the present invention further provides a modification apparatus for a version number of a maven project, including:
a first obtaining module for obtaining the name of the target project and the corresponding new version number
The second acquisition module is used for acquiring the corresponding target project from the code warehouse according to the name of the target project;
the first execution module is used for pulling a new branch from the main trunk of the target project;
the third acquisition module is used for detecting the codes of the branches through Jenkins and acquiring the codes of the branches;
the fourth acquisition module is used for acquiring a root path of the branched code;
the second execution module executes the first shell script used for changing the version number of the branch under the root path;
a fifth obtaining module, configured to obtain pom.xml under the root path;
a third execution module, configured to execute, in the pom.xml, a second shell script that is used to change the version number of the target engineering dependent jar package;
and the storage module is used for submitting the execution result of the first shell script and the execution result of the second shell script to the code warehouse for storage.
As an optional implementation manner, the second execution module includes:
the first shell script unit is used for acquiring a first shell script for changing the version number of the branch;
and the first shell script execution unit is used for executing the first shell script under the root path.
Further, the first shell script includes an old version number, the new version number and a modification range of the branch.
As an optional implementation manner, the third execution module includes:
the second shell script obtaining unit is used for obtaining a second shell script used for changing the version number of the target engineering dependence jar packet;
a second shell script execution unit to execute the second shell script under the pom.
Further, the second shell script includes the name of the target project and the new version number.
As can be seen from the foregoing, in the method and the device for modifying the version number of a maven project provided in one or more embodiments of the present specification, a root path of a code is detected and obtained from an obtained branch code, an edited first shell script is executed under the root path, and an edited second shell script is executed in a pom.xml obtained under the root path, so that changes to the version number of the project and the version number of a project-dependent jar package can be completed simultaneously, thereby reducing the operation amount of modifying the version number of the maven project, avoiding missed changes and wrong changes, and improving the change efficiency of the version number.
Drawings
In order to more clearly illustrate one or more embodiments or prior art solutions of the present specification, the drawings that are needed in the description of the embodiments or prior art will be briefly described below, and it is obvious that the drawings in the following description are only one or more embodiments of the present specification, and that other drawings may be obtained by those skilled in the art without inventive effort from these drawings.
FIG. 1 is a schematic illustration of a method of modifying a version number of one or more embodiments of the specification;
fig. 2 is a schematic diagram of a modifying apparatus for one or more embodiments of the present description.
Detailed Description
To make the objects, technical solutions and advantages of the present disclosure more apparent, the present disclosure is further described in detail below with reference to specific embodiments.
In order to achieve the above object, an embodiment of the present invention provides a method for modifying a version number of a maven project, including:
acquiring the name of a target project and a corresponding new version number;
acquiring a corresponding target project from a code warehouse according to the name of the target project;
pulling a new branch from the trunk of the target project;
detecting the codes of the branches through Jenkins to obtain the codes of the branches;
obtaining a root path of the branched code;
executing a first shell script for changing the version number of the branch under the root path;
obtaining pom.xml under the root path;
executing a second shell script in the pom.xml for changing the version number of the target engineering dependent jar package;
and submitting the execution result of the first shell script and the execution result of the second shell script to the code warehouse for saving.
In the embodiment of the invention, the obtained branch code is detected and the root path of the code is obtained, the edited first shell script is executed under the root path, and then the edited second shell script is executed in the pom.xml obtained under the root path, so that the modification of the version number of the project and the version number of the project dependent jar packet can be completed simultaneously, the operation amount of modification of the maven project version number is reduced, the situations of missed modification and wrong modification are avoided, and the modification efficiency of the version number is improved.
Referring to fig. 1, an embodiment of the present invention provides a method for modifying a version number of a maven project, including:
s100, acquiring the name of the target project and the corresponding new version number.
Optionally, the target project is a project planning to perform code development; the maven is a project management tool that includes a project object model, a set of criteria combinations, a project lifecycle, a dependency management system, and logic for running plug-in objects defined during the lifecycle stages.
And S200, acquiring a corresponding target project from a code warehouse according to the name of the target project.
S300, pulling a new branch from the trunk of the target project.
The main trunk is a target project to be subjected to code development, and the branches are direct operation objects for performing code development.
S400, detecting the codes of the branches through Jenkins, and obtaining the codes of the branches.
Jenkins is an open-source continuous integration tool capable of providing an operation interface, and is mainly used for continuously and automatically constructing and testing software projects and monitoring the running of external tasks.
And S500, acquiring a root path of the branched code.
The root path is the top level directory of the logical drive, i.e., the directory that stores the subdirectories.
S600, executing a first shell script for changing the version number of the branch under the root path.
As an optional implementation, the executing the first shell script under the root path for changing the version number of the branch includes:
acquiring a first shell script for changing the version number of the branch;
executing the first shell script under the root path.
Further, the first shell script includes an old version number, the new version number and a modification range of the branch.
And S700, acquiring pom.
And S800, executing a second shell script for changing the version number of the target engineering dependent jar package in the pom.
As an optional implementation, the executing, in the pom.xml, a second shell script for changing the version number of the target engineering dependent jar package includes:
acquiring a second shell script for changing the version number of the target engineering dependent jar packet;
xml, executing the second shell script.
Further, the second shell script includes the name of the target project and the new version number.
And S900, submitting the execution result of the first shell script and the execution result of the second shell script to the code warehouse for storage.
And the dependency relationship of the target project can be recorded in the background by submitting the execution result of the second shell script to the code warehouse for storage.
After the process of the version number modification method is completed, a developer of the target project can develop the function of the target project.
It should be noted that the method of one or more embodiments of the present disclosure may be performed by a single device, such as a computer or server. The method of the embodiment can also be applied to a distributed scene and completed by the mutual cooperation of a plurality of devices. In such a distributed scenario, one of the devices may perform only one or more steps of the method of one or more embodiments of the present disclosure, and the devices may interact with each other to complete the method.
Based on any one of the above embodiments of the method for modifying the version number of a maven project, the present invention further provides a device for modifying the version number of a maven project, as shown in fig. 2, including:
a first obtaining module 10, configured to obtain a name of a target project and a corresponding new version number
The second obtaining module 20 is configured to obtain a corresponding target project from the code warehouse according to the name of the target project;
a first execution module 30, configured to pull a new branch from the trunk of the target project;
a third obtaining module 40, configured to detect the code of the branch through Jenkins, and obtain the code of the branch;
a fourth obtaining module 50, configured to obtain a root path of the branched code;
a second execution module 60 that executes a first shell script for changing the version number of the branch under the root path;
a fifth obtaining module 70, configured to obtain pom.xml under the root path;
a third executing module 80, configured to execute, in the pom.xml, a second shell script used for changing the version number of the target engineering dependent jar package;
and the storage module 90 is configured to submit the execution result of the first shell script and the execution result of the second shell script to the code repository for storage.
In the embodiment of the invention, the obtained branch code is detected and the root path of the code is obtained, the edited first shell script is executed under the root path, and then the edited second shell script is executed in the pom.xml obtained under the root path, so that the modification of the version number of the project and the version number of the project dependent jar packet can be completed simultaneously, the operation amount of modification of the maven project version number is reduced, the situations of missed modification and wrong modification are avoided, and the modification efficiency of the version number is improved.
As an alternative embodiment, the second execution module 60 includes:
the first shell script unit is used for acquiring a first shell script for changing the version number of the branch;
and the first shell script execution unit is used for executing the first shell script under the root path.
Further, the first shell script includes an old version number, the new version number and a modification range of the branch.
As an alternative embodiment, the third execution module 90 includes:
the second shell script obtaining unit is used for obtaining a second shell script used for changing the version number of the target engineering dependence jar packet;
a second shell script execution unit to execute the second shell script under the pom.
Further, the second shell script includes the name of the target project and the new version number.
It is to be noted that unless otherwise defined, technical or scientific terms used in one or more embodiments of the present specification should have the ordinary meaning as understood by those of ordinary skill in the art to which this disclosure belongs. The use of "first," "second," and similar terms in one or more embodiments of the specification is not intended to indicate any order, quantity, or importance, but rather is used to distinguish one element from another. The word "comprising" or "comprises", and the like, means that the element or item listed before the word covers the element or item listed after the word and its equivalents, but does not exclude other elements or items. The terms "connected" or "coupled" and the like are not restricted to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "upper", "lower", "left", "right", and the like are used merely to indicate relative positional relationships, and when the absolute position of the object being described is changed, the relative positional relationships may also be changed accordingly.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
For convenience of description, the above devices are described as being divided into various modules by functions, and are described separately. Of course, the functionality of the modules may be implemented in the same one or more software and/or hardware implementations in implementing one or more embodiments of the present description.
Those of ordinary skill in the art will understand that: the discussion of any embodiment above is meant to be exemplary only, and is not intended to intimate that the scope of the disclosure, including the claims, is limited to these examples; within the spirit of the present disclosure, features from the above embodiments or from different embodiments may also be combined, steps may be implemented in any order, and there are many other variations of different aspects of one or more embodiments of the present description as described above, which are not provided in detail for the sake of brevity.
While the present disclosure has been described in conjunction with specific embodiments thereof, many alternatives, modifications, and variations of these embodiments will be apparent to those of ordinary skill in the art in light of the foregoing description.
It is intended that the one or more embodiments of the present specification embrace all such alternatives, modifications and variations as fall within the broad scope of the appended claims. Therefore, any omissions, modifications, substitutions, improvements, and the like that may be made without departing from the spirit and principles of one or more embodiments of the present disclosure are intended to be included within the scope of the present disclosure.
Claims (10)
1. A method for modifying version number of maven project is characterized by comprising the following steps:
acquiring the name of a target project and a corresponding new version number;
acquiring a corresponding target project from a code warehouse according to the name of the target project;
pulling a new branch from the trunk of the target project;
detecting the codes of the branches through Jenkins to obtain the codes of the branches;
obtaining a root path of the branched code;
executing a first shell script for changing the version number of the branch under the root path;
obtaining pom.xml under the root path;
executing a second shell script in the pom.xml for changing the version number of the target engineering dependent jar package;
and submitting the execution result of the first shell script and the execution result of the second shell script to the code warehouse for saving.
2. The method of claim 1, wherein executing the first shell script under the root path for changing the version number of the branch comprises:
acquiring a first shell script for changing the version number of the branch;
executing the first shell script under the root path.
3. The method of claim 2, wherein the first shell script comprises an old version number of the branch, the new version number and a modification range.
4. The method of claim 1, wherein executing a second shell script in the pom. xml for changing the version number of the target project-dependent jar package comprises:
acquiring a second shell script for changing the version number of the target engineering dependent jar packet;
xml, executing the second shell script.
5. The method of claim 4, wherein the second shell script comprises a name of the target project and the new version number.
6. A device for modifying version number of maven project is characterized by comprising
A first obtaining module for obtaining the name of the target project and the corresponding new version number
The second acquisition module is used for acquiring the corresponding target project from the code warehouse according to the name of the target project;
the first execution module is used for pulling a new branch from the main trunk of the target project;
the third acquisition module is used for detecting the codes of the branches through Jenkins and acquiring the codes of the branches;
the fourth acquisition module is used for acquiring a root path of the branched code;
the second execution module executes the first shell script used for changing the version number of the branch under the root path;
a fifth obtaining module, configured to obtain pom.xml under the root path;
a third execution module, configured to execute, in the pom.xml, a second shell script that is used to change the version number of the target engineering dependent jar package;
and the storage module is used for submitting the execution result of the first shell script and the execution result of the second shell script to the code warehouse for storage.
7. The apparatus for modifying the version number of a maven project according to claim 6, wherein the second executing module comprises:
the first shell script unit is used for acquiring a first shell script for changing the version number of the branch;
and the first shell script execution unit is used for executing the first shell script under the root path.
8. The apparatus for modifying version number of maven project of claim 7, wherein the first shell script comprises an old version number of the branch, the new version number and a modification range.
9. The apparatus for modifying the version number of a maven project according to claim 6, wherein the third executing module comprises:
the second shell script obtaining unit is used for obtaining a second shell script used for changing the version number of the target engineering dependence jar packet;
a second shell script execution unit to execute the second shell script under the pom.
10. The apparatus for modifying the version number of a maven project according to claim 9, wherein the second shell script comprises the name of the target project and the new version number.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011265179.5A CN112379916A (en) | 2020-11-12 | 2020-11-12 | Method and device for modifying version number of maven project |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011265179.5A CN112379916A (en) | 2020-11-12 | 2020-11-12 | Method and device for modifying version number of maven project |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112379916A true CN112379916A (en) | 2021-02-19 |
Family
ID=74583631
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011265179.5A Pending CN112379916A (en) | 2020-11-12 | 2020-11-12 | Method and device for modifying version number of maven project |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112379916A (en) |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20130174124A1 (en) * | 2011-12-29 | 2013-07-04 | Christina Watters | Version numbering in single development and test environment |
US20140074849A1 (en) * | 2012-09-07 | 2014-03-13 | Ondrej Zizka | Remote artifact repository |
CN106104467A (en) * | 2014-06-30 | 2016-11-09 | 北京新媒传信科技有限公司 | A kind of Automation arranging method and terminal |
CN106155724A (en) * | 2015-04-14 | 2016-11-23 | 阿里巴巴集团控股有限公司 | A kind of upgrade method and device |
CN107577469A (en) * | 2017-08-21 | 2018-01-12 | 厦门悦讯教育科技有限公司 | A kind of Software package method for release management |
CN111142903A (en) * | 2019-12-23 | 2020-05-12 | 杭州安恒信息技术股份有限公司 | Configuration file interactive updating method and device based on file comparison |
CN111666099A (en) * | 2020-06-12 | 2020-09-15 | 江苏云柜网络技术有限公司 | Application service publishing system |
-
2020
- 2020-11-12 CN CN202011265179.5A patent/CN112379916A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20130174124A1 (en) * | 2011-12-29 | 2013-07-04 | Christina Watters | Version numbering in single development and test environment |
US20140074849A1 (en) * | 2012-09-07 | 2014-03-13 | Ondrej Zizka | Remote artifact repository |
CN106104467A (en) * | 2014-06-30 | 2016-11-09 | 北京新媒传信科技有限公司 | A kind of Automation arranging method and terminal |
CN106155724A (en) * | 2015-04-14 | 2016-11-23 | 阿里巴巴集团控股有限公司 | A kind of upgrade method and device |
CN107577469A (en) * | 2017-08-21 | 2018-01-12 | 厦门悦讯教育科技有限公司 | A kind of Software package method for release management |
CN111142903A (en) * | 2019-12-23 | 2020-05-12 | 杭州安恒信息技术股份有限公司 | Configuration file interactive updating method and device based on file comparison |
CN111666099A (en) * | 2020-06-12 | 2020-09-15 | 江苏云柜网络技术有限公司 | Application service publishing system |
Non-Patent Citations (5)
Title |
---|
MOB604756EF1373: "jenkins关联shell命令修改pom项目版本_51CTO博客_jenkins shell", pages 1, Retrieved from the Internet <URL:https://blog.51cto.com/u_15127556/4048050> * |
冯小梅;孙卫宁;曾兰;: "基于selenium和Jenkins的持续集成自动化测试框架的设计和实现", 企业科技与发展, no. 01 * |
周莹;欧中红;李俊;: "基于Jenkins的持续集成自动部署研究", 计算机与数字工程, no. 02 * |
朱志东;张素芬;: "基于Jenkins的软件缺陷持续测试平台设计与实现", 信息化研究, no. 03 * |
王焱;张征;: "基于持续集成的Android自动化测试", 计算机系统应用, no. 05 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9189135B2 (en) | Three-dimensional GUI object stores in automation test tools | |
CN111597243A (en) | Data warehouse-based abstract data loading method and system | |
CN103186463B (en) | Determine the method and system of the test specification of software | |
CN110990048A (en) | Method and system for monitoring resource loss of Unity project | |
CN110908894A (en) | Visual report tool automatic testing method and device based on vuex | |
CN113760462A (en) | Method and device for constructing verification environment of dispatching automation system | |
CN114297056A (en) | Automatic testing method and system | |
CN101894317B (en) | System and method for driving business logic through data changes | |
CN113535481A (en) | Data backtracking method and device and nonvolatile computer readable storage medium | |
CN113364515A (en) | Satellite remote control method, device, equipment and storage medium based on Xstate | |
CN112379916A (en) | Method and device for modifying version number of maven project | |
CN112732237A (en) | Method and system for constructing code-free development technology model | |
CN110287182B (en) | Big data comparison method, device, equipment and terminal | |
CN112162908A (en) | Program call link monitoring implementation method and device based on bytecode injection technology | |
CN108132799B (en) | Inter-process static program analysis information extraction method, device and equipment | |
US9396239B2 (en) | Compiling method, storage medium and compiling apparatus | |
CN113126998B (en) | Incremental source code acquisition method and device, electronic equipment and storage medium | |
US20150370689A1 (en) | Automated defect positioning based on historical data | |
CN114416305A (en) | Robot engine implementation method and system and electronic equipment | |
US11762363B2 (en) | Graph display device, graph display method, and recording medium | |
CN113987044A (en) | Asset data import processing method and device and electronic equipment | |
CN105204866A (en) | Equipment command calling method and system | |
Merchant et al. | Tool for performance tuning and regression analyses of HPC systems and applications | |
CN113392436A (en) | CAE analysis software and office software integrated control method and platform | |
CN104965742A (en) | Automated script and apparatus for processing front-end tasks |
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 |