CN115563010A - Jar package conflict detection method and device, storage medium and computer equipment - Google Patents

Jar package conflict detection method and device, storage medium and computer equipment Download PDF

Info

Publication number
CN115563010A
CN115563010A CN202211330163.7A CN202211330163A CN115563010A CN 115563010 A CN115563010 A CN 115563010A CN 202211330163 A CN202211330163 A CN 202211330163A CN 115563010 A CN115563010 A CN 115563010A
Authority
CN
China
Prior art keywords
jar
conflict
packet
package
determining
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
CN202211330163.7A
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.)
Vipshop Guangzhou Software Co Ltd
Original Assignee
Vipshop Guangzhou Software 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 Vipshop Guangzhou Software Co Ltd filed Critical Vipshop Guangzhou Software Co Ltd
Priority to CN202211330163.7A priority Critical patent/CN115563010A/en
Publication of CN115563010A publication Critical patent/CN115563010A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3604Software analysis for verifying properties of programs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/53Decompilation; Disassembly

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application provides a method and a device for detecting Jar package conflict, a storage medium and computer equipment. The method comprises the following steps: when the triggering condition is met, determining a target application; determining a Jar package catalog corresponding to the target application; scanning each class of each Jar package in the Jar package catalog, and if the Jar packages of the classes depending on the same class name under the same path exist, determining that the Jar packages of the classes depending on the same class name under the same path have package conflict; detecting a called method causing packet conflict in each group of Jar packets with packet conflict; acquiring an increment code of the target application, and judging whether the increment code comprises a called method causing packet conflict or not; and if the incremental code contains a called method causing the packet conflict, generating a conflict alarm. The method and the device can quickly detect the packet conflict and filter the packet conflict, trigger the alarm for the packet conflict needing to be processed in time, and reduce the workload of test and investigation.

Description

Jar package conflict detection method and device, storage medium and computer equipment
Technical Field
The present application relates to the field of software development technologies, and in particular, to a method and an apparatus for detecting Jar package conflict, a storage medium, and a computer device.
Background
In the development of a software application, a large number of class files are typically involved, usually in the form of Jar packages for ease of storage and use. A Jar (Java Archive) package is a compressed package of Java, and may also be considered as a set of a series of class files, and when a Jar package is used in a project, a path of the Jar package needs to be set in relevant parameters for specifying a class loading path, so that a virtual machine can dynamically load classes contained in the Jar package at runtime.
If the version numbers of the code library and the resource package called during development of different parts of a project are not consistent, one class is loaded when the virtual machine runs Java code, and at this time, an error that a certain method call or a member variable does not exist may occur, so that an abnormal operation occurs, which is called package conflict.
However, in the testing process, not all the packet conflicts need to be processed in time, and if all the packet conflicts are prompted to the tester, the testing efficiency of the tester is affected.
Disclosure of Invention
The embodiment of the application provides a method and a device for detecting Jar packet conflicts, a storage medium and computer equipment, which can quickly detect the packet conflicts and filter the packet conflicts, trigger an alarm for the packet conflicts needing to be processed in time, and reduce the workload of test troubleshooting.
In a first aspect, the present application provides a Jar package conflict detection method, including:
when the triggering condition is met, determining a target application;
determining a Jar package catalog corresponding to the target application;
scanning each class of each Jar package in the Jar package catalog, and if the Jar packages of the classes depending on the same class name under the same path exist, determining that the Jar packages of the classes depending on the same class name under the same path have package conflict;
detecting a called method causing packet conflict in each group of Jar packets with packet conflict;
acquiring an incremental code of the target application, and judging whether the incremental code contains a called method causing packet conflict;
and if the incremental code contains a called method causing the packet conflict, generating a conflict alarm.
In one embodiment, the called method for detecting that there is a packet conflict and causing the packet conflict in each group of Jar packets includes:
reading a group of Jar packages to be detected of classes depending on the same class name under the same path, and respectively generating class files corresponding to each Jar package to be detected;
inversely compiling the class file corresponding to each Jar packet to be detected into a java file;
acquiring all called methods in each Jar package to be detected based on the java file corresponding to each Jar package to be detected, and generating a method set corresponding to each Jar package to be detected;
and comparing the method sets of each Jar packet to be detected, identifying codes corresponding to the called methods with differences in the method sets, and storing the codes.
In one embodiment, the comparing the method sets of each Jar package to be detected, identifying and storing codes corresponding to called methods having differences in the method sets includes:
taking intersection of each Jar packet to be detected to obtain an intersection result;
and respectively taking a difference set from each Jar packet to be detected and the intersection result to obtain and store codes corresponding to the called methods with differences in the Jar packets to be detected.
In one embodiment, the called method for detecting that there is a packet conflict and causing the packet conflict in each group of Jar packets includes:
sequencing all groups of Jar packets with packet conflicts according to a preset priority to obtain a detection sequence;
and detecting the called methods causing the packet conflict in each group of Jar packets with the packet conflict in sequence according to the detection sequence.
In one embodiment, the determining the Jar package directory corresponding to the target application includes:
identifying an application type of the target application;
determining a scanning path of the target application according to the corresponding relation between the application type and the application path;
and determining the Jar package catalog under the scanning route as the Jar package catalog corresponding to the target application.
In one embodiment, the determining the target application when the trigger condition is met includes:
when the application deployment is recognized to be successful and the application state is available, determining the application as a target application;
or
And when a detection instruction is received, determining a target application according to the detection instruction.
In one embodiment, the method further comprises:
determining alarm personnel according to the target application;
and sending the conflict alarm to the alarm personnel.
In a second aspect, the present application provides a Jar package conflict detection apparatus, including:
the first determining module is used for determining the target application when the triggering condition is met;
the second determining module is used for determining a Jar package catalog corresponding to the target application;
the scanning module is used for scanning each class of each Jar package in the Jar package catalog, and if the Jar packages of the classes depending on the same class name under the same path exist, determining that the Jar packages of the classes depending on the same class name under the same path have package conflict;
the detection module is used for detecting a called method causing the package conflict in each group of Jar packages with the package conflict;
the code judging module is used for acquiring the incremental code of the target application and judging whether the incremental code comprises a called method causing packet conflict;
and the alarm generating module is used for generating a conflict alarm when the increment code contains a called method causing the package conflict.
In a third aspect, the present application provides a storage medium having stored therein computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps of the method for detecting a Jar packet conflict as described in any one of the above embodiments.
In a fourth aspect, the present application provides a computer device comprising: one or more processors, and a memory;
the memory has stored therein computer readable instructions which, when executed by the one or more processors, perform the steps of the Jar package conflict detection method as in any of the embodiments above.
According to the technical scheme, the embodiment of the application has the following advantages:
the method, the device, the storage medium and the computer equipment for detecting the Jar package conflict determine a target application which needs to be detected currently when a trigger condition is met, determine a corresponding Jar package directory according to the target application, scan each class of each Jar package in the Jar package directory, identify whether the Jar package depending on the class with the same class name under the same path exists, if the Jar package depending on the class with the same class name under the same path exists, determine that the Jar package depending on the class with the same class name under the same path exists as a package conflict, detect each group of Jar packages with the package conflict, detect a called method causing the package conflict, judge an increment code of the target application, judge whether a detected called method causing the package conflict exists, if the called method causes the package conflict, indicate that the increment code causes the package conflict, and need to be processed in time, generate a conflict alarm at the moment, can quickly detect the package conflict and filter the conflict packages, trigger the alarm for the package conflict which needs to be processed in time, and reduce the workload of test and investigation.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the description below are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without inventive labor.
FIG. 1 is a flow diagram illustrating a method for Jar package conflict detection in one embodiment;
FIG. 2 is a flowchart illustrating the steps of a method called to detect a packet conflict arising in each set of Jar packets for which a packet conflict exists, in accordance with one embodiment;
FIG. 3 is a block diagram of an embodiment of a Jar packet collision detection apparatus;
FIG. 4 is a diagram of the internal structure of a computer device in one embodiment.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
As shown in fig. 1, an embodiment of the present application provides a method for detecting a Jar package conflict, where the method includes steps S101 to S107, where:
and step S101, when the trigger condition is met, determining the target application.
The target application refers to an application which needs to perform Jar package conflict detection. In one embodiment, when the application deployment is successful and the application state is available, the application is determined as the target application, namely when the application deployment is successful and the application state is detected to be available, the detection of the application is automatically triggered. In another embodiment, upon receiving a detection instruction, the target application is determined according to the detection instruction, i.e. detection of the application to which the detection instruction is directed is passively triggered according to the received detection instruction.
Step S102, determining a Jar package catalog corresponding to the target application.
And obtaining the corresponding Jar package directory according to the class loading path corresponding to the target application.
In one embodiment, the determining the Jar package directory corresponding to the target application includes: identifying an application type of the target application; determining a scanning path of the target application according to the corresponding relation between the application type and the application path; and determining the Jar package catalog under the scanning route as the Jar package catalog corresponding to the target application. Different application types can configure different loading paths, the loading path corresponding to the application type is determined according to the application type of the target application, and the scanning efficiency can be improved.
Step S103, scanning each class of each Jar package in the Jar package catalog, and if the Jar packages of the classes depending on the same class name under the same path exist, determining that the Jar packages of the classes depending on the same class name under the same path have package conflict.
For the condition that the same Jar package appears in different versions and the same class appears in different Jar packages, conflicts can be caused, so that the application cannot load the correct class during running, and the behavior of the application is inconsistent with the expected behavior. And preliminarily positioning the Jar packages with package conflicts by scanning out the Jar packages of the classes depending on the same class name under the same path. During scanning, the class with only one jar packet can be filtered first, and then the rest classes are scanned.
Step S104, detecting the called method causing the package conflict in each group of Jar packages with the package conflict.
That is, the called method with the conflict is detected, that is, the method in the Jar package with the package conflict, which may cause the loading error, for example, the same method with different versions or the same method with different types. The same method of different types includes a method of the same method name and return type but different participation types, and a method of the same method name and participation type but different return types.
Step S105, obtaining the increment code of the target application, and judging whether the increment code contains a called method causing packet conflict.
The incremental code refers to a new part of the target application compared with the code modified last time, and can be compared by recording the code submitted by an engineer each time. The method for judging whether the incremental code contains the called method causing the packet conflict can be detected by detecting whether the called method exists in the incremental code, identifying the name of the method, performing regular identification on the incremental code and the like.
And step S106, if the incremental code contains the called method causing the package conflict, generating a conflict alarm.
And step S107, if the incremental code does not contain the called method causing the packet conflict, no conflict alarm is generated.
For the packet conflict caused by the incremental code, timely processing is needed, so if the incremental code contains the called method causing the packet conflict, a conflict alarm is generated for prompting a tester; and filtering the package sending conflict caused by the non-incremental code, and not prompting, or prompting in other modes with lower priority, so that the condition that the package conflict caused by the incremental code can be processed by a tester preferentially is ensured, and the test and troubleshooting workload is further reduced.
In this embodiment, when a trigger condition is met, a target application which needs to be detected currently is determined, a corresponding Jar packet directory is determined according to the target application, each class of each Jar packet in the Jar packet directory is scanned, whether Jar packets which depend on classes with the same class name in the same path exist is identified, if yes, jar packets which depend on classes with the same class name in the same path are determined to be a packet conflict exists, each group of Jar packets with the packet conflict exists is detected, a called method which causes the packet conflict is detected, an increment code of the target application is judged, whether a detected called method which causes the packet conflict exists is judged, if yes, it is indicated that the increment code causes the packet conflict, and the packet conflict needs to be processed in time, at this time, a conflict alarm is generated, the conflict alarm can be detected quickly and filtered, the alarm is triggered only for the packet conflict which needs to be processed in time, and the workload of testing and troubleshooting is reduced.
As shown in fig. 2, in one embodiment, the called method for detecting that there is a packet conflict in each group Jar packet that causes a packet conflict includes steps S201 to S204, where:
step S201, reading a group of Jar packages to be detected of classes depending on the same class name under the same path, and respectively generating class files corresponding to each Jar package to be detected.
And respectively reading each jar packet to be detected to obtain a class input stream, writing the input stream into the directory of the local container, and generating a class file of each jar packet to be detected.
And S202, inversely compiling the class file corresponding to each Jar packet to be detected into a java file.
The class file is decompiled to java file using java command.
Step S203, acquiring all called methods in each Jar package to be detected based on the java file corresponding to each Jar package to be detected, and generating a method set corresponding to each Jar package to be detected.
Reading each java file, identifying all called methods in the java file, and summarizing codes of the called methods of each java file to generate a method set corresponding to each Jar package to be detected.
And step S204, comparing the method sets of each Jar packet to be detected, identifying codes corresponding to the called methods with differences in the method sets, and storing the codes.
The called methods that cause conflicts are identified through set operations, including the same method in different versions or the same method in different types. Because the conflict called methods have differences, the Jar package can have conflicts, so that class cannot be loaded correctly, and except the called method part causing the conflict, other part codes of the conflict Jar package are the same, so that different parts can be identified through set operation and stored. The saved called method causing the conflict can be sent to the tester through the conflict alarm, so that the tester can process the conflict quickly.
In one embodiment, the comparing the method sets of each Jar package to be detected, identifying and storing codes corresponding to called methods having differences in the method sets includes:
taking intersection of each Jar packet to be detected to obtain an intersection result;
and respectively taking a difference set from each Jar packet to be detected and the intersection result to obtain and store codes corresponding to the called methods with differences in the Jar packets to be detected.
In this embodiment, intersection operation is performed on a group of Jar packets to be detected, an intersection result is the same called method, a difference set is taken between each Jar packet to be detected and the intersection result based on the intersection result, the difference set is the called method in which each Jar packet to be detected is different, and a difference set result obtained by each Jar packet to be detected is stored. In this way, the detection range for the collision method can be expanded, and Jar packages which have the same signature and are not detected in the conventional detection method but have collision can be detected.
In one embodiment, the called method for detecting that there is a packet conflict and causing the packet conflict in each group of Jar packets includes:
sequencing all groups of Jar packets with packet conflicts according to a preset priority to obtain a detection sequence;
and detecting the called methods causing the packet conflict in each group of Jar packets with the packet conflict in sequence according to the detection sequence.
In this embodiment, detection priorities are configured, jar packets are detected according to the priority order, the number of concurrent detections is reduced, detection is delayed for later Jar packets with higher priorities, the scanning time for Jar packets with important concerns is shortened, and the testing efficiency is improved.
In one embodiment, the method further comprises:
determining alarm personnel according to the target application;
and sending the conflict alarm to the alarm personnel.
In the implementation, the alarm personnel for receiving the alarm can be configured in advance, specifically, the alarm personnel can be configured by taking a domain as a unit, and the conflict alarm is sent to the corresponding alarm personnel according to the domain to which the target application belongs; in some embodiments, the corresponding relationship between the alarm personnel and the application may also be configured according to other rules, and the collision alarm is sent to the tester who needs to pay attention to the collision once when the collision alarm is generated.
It should be understood that, although the steps in the flowcharts related to the embodiments as described above are sequentially displayed as indicated by arrows, the steps are not necessarily performed sequentially as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a part of the steps in the flowcharts related to the embodiments described above may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the execution order of the steps or stages is not necessarily sequential, but may be performed alternately or alternately with other steps or at least a part of the steps or stages in other steps.
The Jar package conflict detection apparatus provided in the embodiment of the present application is described below, and the Jar package conflict detection apparatus described below and the Jar package conflict detection method described above may be referred to in correspondence with each other.
As shown in fig. 3, an embodiment of the present application provides a Jar package conflict detection apparatus 300, including:
a first determining module 301, configured to determine a target application when a trigger condition is met;
a second determining module 302, configured to determine a Jar package directory corresponding to the target application;
the scanning module 303 is configured to scan each class of each Jar package in the Jar package directory, and if Jar packages that depend on classes with the same class name in the same path exist, determine that a package conflict exists in Jar packages that depend on classes with the same class name in the same path;
the detection module 304 is configured to detect a called method causing a packet conflict in each group of Jar packets in which a packet conflict exists;
a code determining module 305, configured to obtain an incremental code of the target application, and determine whether the incremental code includes a called method that causes a packet conflict;
and the alarm generating module 306 is configured to generate a conflict alarm when the delta code contains a called method causing a packet conflict.
In one embodiment, the detection module comprises:
the Class file generating unit is used for reading a group of Jar packages to be detected which depend on classes with the same Class name under the same path, and respectively generating Class files corresponding to each Jar package to be detected;
the decompiling unit is used for decompiling the class file corresponding to each Jar packet to be detected into a java file;
the set generating unit is used for acquiring all called methods in each Jar package to be detected based on the java file corresponding to each Jar package to be detected and generating a method set corresponding to each Jar package to be detected;
and the identification unit is used for comparing the method sets of each Jar packet to be detected, identifying and storing codes corresponding to the called methods with differences in the method sets.
In one embodiment, the identification unit is configured for performing the steps of:
taking intersection of each Jar packet to be detected to obtain an intersection result;
and respectively taking a difference set from each Jar packet to be detected and the intersection result to obtain and store codes corresponding to the called methods with differences in the Jar packets to be detected.
In one embodiment, the detection module comprises:
the sequencing unit is used for sequencing all groups of Jar packages with package conflicts according to a preset priority to obtain a detection sequence;
and the method detection unit is used for sequentially detecting the called methods causing the packet conflict in each group of Jar packets with the packet conflict according to the detection sequence.
In one embodiment, the first determination module is configured to perform the steps of:
when the application deployment is recognized to be successful and the application state is available, determining the application as a target application;
or
And when a detection instruction is received, determining a target application according to the detection instruction.
In one embodiment, the second determining module is configured to perform the steps of:
identifying an application type of the target application;
determining a scanning path of the target application according to the corresponding relation between the application type and the application path;
and determining the Jar package catalog under the scanning route as the Jar package catalog corresponding to the target application.
In one embodiment, the Jar packet collision detection device further includes:
the third determining module is used for determining alarm personnel according to the target application;
and the alarm sending module is used for sending the conflict alarm to the alarm personnel.
The division of each module in the Jar packet conflict detection apparatus is merely for illustration, and in other embodiments, the Jar packet conflict detection apparatus may be divided into different modules as needed to complete all or part of the functions of the Jar packet conflict detection apparatus. The modules in the Jar packet collision detection device can be wholly or partially realized by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent of a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, the present application further provides a storage medium having computer-readable instructions stored therein, which when executed by one or more processors, cause the one or more processors to perform the steps of:
when the triggering condition is met, determining a target application;
determining a Jar package catalog corresponding to the target application;
scanning each class of each Jar package in the Jar package catalog, and if the Jar packages of the classes depending on the same class name under the same path exist, determining that the Jar packages of the classes depending on the same class name under the same path have package conflict;
detecting a called method causing packet conflict in each group of Jar packets with packet conflict;
acquiring an increment code of the target application, and judging whether the increment code comprises a called method causing packet conflict or not;
and if the incremental code contains the called method causing the packet conflict, generating a conflict alarm.
In one embodiment, the computer readable instructions when executed by the processor further implement the steps of:
reading a group of Jar packages to be detected of classes depending on the same class name under the same path, and respectively generating class files corresponding to each Jar package to be detected;
inversely compiling the class file corresponding to each Jar packet to be detected into a java file;
acquiring all called methods in each Jar package to be detected based on the java file corresponding to each Jar package to be detected, and generating a method set corresponding to each Jar package to be detected;
and comparing the method sets of each Jar packet to be detected, identifying codes corresponding to the called methods with differences in the method sets, and storing the codes.
In one embodiment, the computer readable instructions when executed by the processor further implement the steps of:
taking intersection of each Jar packet to be detected to obtain an intersection result;
and respectively taking a difference set from each Jar packet to be detected and the intersection result to obtain and store codes corresponding to the called methods with differences in the Jar packets to be detected.
In one embodiment, the computer readable instructions when executed by the processor further implement the steps of:
sequencing all groups of Jar packets with packet conflicts according to a preset priority to obtain a detection sequence;
and sequentially detecting the called methods causing the packet conflict in each group of Jar packets with the packet conflict according to the detection sequence.
In one embodiment, the computer readable instructions when executed by the processor further implement the steps of:
identifying an application type of the target application;
determining a scanning path of the target application according to the corresponding relation between the application type and the application path;
and determining the Jar package catalog under the scanning route as the Jar package catalog corresponding to the target application.
In one embodiment, the computer readable instructions when executed by the processor further implement the steps of:
when the application deployment is recognized to be successful and the application state is available, determining the application as a target application;
or
And when a detection instruction is received, determining a target application according to the detection instruction.
In one embodiment, the computer readable instructions when executed by the processor further implement the steps of:
determining alarm personnel according to the target application;
and sending the conflict alarm to the alarm personnel.
In one embodiment, the present application further provides a computer device having computer-readable instructions stored therein, which when executed by the one or more processors, perform the steps of:
when the triggering condition is met, determining a target application;
determining a Jar package catalog corresponding to the target application;
scanning each class of each Jar package in the Jar package catalog, and if the Jar packages of the classes depending on the same class name under the same path exist, determining that the Jar packages of the classes depending on the same class name under the same path have package conflict;
detecting a called method causing packet conflict in each group of Jar packets with packet conflict;
acquiring an increment code of the target application, and judging whether the increment code comprises a called method causing packet conflict or not;
and if the incremental code contains a called method causing the packet conflict, generating a conflict alarm.
In one embodiment, the processor, when executing the computer readable instructions, further performs the steps of:
reading a group of Jar packages to be detected of classes depending on the same class name under the same path, and respectively generating class files corresponding to each Jar package to be detected;
inversely compiling the class file corresponding to each Jar packet to be detected into a java file;
acquiring all called methods in each Jar package to be detected based on the java file corresponding to each Jar package to be detected, and generating a method set corresponding to each Jar package to be detected;
and comparing the method sets of each Jar packet to be detected, identifying codes corresponding to the called methods with differences in the method sets, and storing the codes.
In one embodiment, the processor, when executing the computer readable instructions, further performs the steps of:
taking intersection of each Jar packet to be detected to obtain an intersection result;
and respectively taking a difference set from each Jar packet to be detected and the intersection result to obtain and store codes corresponding to the called methods with differences in the Jar packets to be detected.
In one embodiment, the processor, when executing the computer readable instructions, further performs the steps of:
sequencing all groups of Jar packets with packet conflicts according to a preset priority to obtain a detection sequence;
and sequentially detecting the called methods causing the packet conflict in each group of Jar packets with the packet conflict according to the detection sequence.
In one embodiment, the processor, when executing the computer readable instructions, further performs the steps of:
identifying an application type of the target application;
determining a scanning path of the target application according to the corresponding relation between the application type and the application path;
and determining the Jar package catalog under the scanning route as the Jar package catalog corresponding to the target application.
In one embodiment, the processor, when executing the computer readable instructions, further performs the steps of:
when the application deployment is recognized to be successful and the application state is available, determining the application as a target application;
or
And when a detection instruction is received, determining a target application according to the detection instruction.
In one embodiment, the processor, when executing the computer readable instructions, further performs the steps of:
determining alarm personnel according to the target application;
and sending the conflict alarm to the alarm personnel.
Illustratively, in one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 4. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used for storing data. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a Jar package conflict detection method.
Those skilled in the art will appreciate that the architecture shown in fig. 4 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high-density embedded nonvolatile Memory, resistive Random Access Memory (ReRAM), magnetic Random Access Memory (MRAM), ferroelectric Random Access Memory (FRAM), phase Change Memory (PCM), graphene Memory, and the like. Volatile Memory can include Random Access Memory (RAM), external cache Memory, and the like. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others. The databases involved in the embodiments provided herein may include at least one of relational and non-relational databases. The non-relational database may include, but is not limited to, a block chain based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, quantum computing based data processing logic devices, etc., without limitation.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising a … …" does not exclude the presence of another identical element in a process, method, article, or apparatus that comprises the element.
Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or to implicitly indicate the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of the present application, "plurality" means at least two, e.g., two, three, etc., unless explicitly specified otherwise.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, the embodiments may be combined as needed, and the same and similar parts may be referred to each other.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A method for detecting Jar packet collision, the method comprising:
when the triggering condition is met, determining a target application;
determining a Jar package catalog corresponding to the target application;
scanning each class of each Jar package in the Jar package catalog, and if the Jar packages of the classes depending on the same class name under the same path exist, determining that the Jar packages of the classes depending on the same class name under the same path have package conflict;
detecting a called method causing packet conflict in each group of Jar packets with packet conflict;
acquiring an increment code of the target application, and judging whether the increment code comprises a called method causing packet conflict or not;
and if the incremental code contains the called method causing the packet conflict, generating a conflict alarm.
2. The method according to claim 1, wherein the detecting the called method causing the packet conflict in each group of Jar packets where the packet conflict exists comprises:
reading a group of Jar packages to be detected of classes depending on the same class name under the same path, and respectively generating class files corresponding to each Jar package to be detected;
inversely compiling the class file corresponding to each Jar packet to be detected into a java file;
acquiring all called methods in each Jar package to be detected based on the java file corresponding to each Jar package to be detected, and generating a method set corresponding to each Jar package to be detected;
and comparing the method sets of each Jar packet to be detected, identifying codes corresponding to the called methods with differences in the method sets, and storing the codes.
3. The method according to claim 2, wherein the comparing the method sets of each Jar package to be detected, and identifying and storing codes corresponding to called methods having differences in each method set comprises:
taking intersection of each Jar packet to be detected to obtain an intersection result;
and respectively taking a difference set from each Jar packet to be detected and the intersection result to obtain and store codes corresponding to the called methods with differences in the Jar packets to be detected.
4. The method for detecting the conflict between the Jar packages according to claim 2 or 3, wherein the method for detecting the called method causing the package conflict in each group of Jar packages with the package conflict comprises:
sequencing all groups of Jar packets with packet conflicts according to a preset priority to obtain a detection sequence;
and detecting the called methods causing the packet conflict in each group of Jar packets with the packet conflict in sequence according to the detection sequence.
5. The method according to claim 1, wherein the determining the Jar package directory corresponding to the target application comprises:
identifying an application type of the target application;
determining a scanning path of the target application according to the corresponding relation between the application type and the application path;
and determining the Jar package catalog under the scanning route as the Jar package catalog corresponding to the target application.
6. The Jar package conflict detection method according to claim 1, wherein the determining a target application when the trigger condition is satisfied comprises:
when the application deployment is recognized to be successful and the application state is available, determining the application as a target application;
or
And when a detection instruction is received, determining a target application according to the detection instruction.
7. The Jar package conflict detection method of claim 1, wherein the method further comprises:
determining alarm personnel according to the target application;
and sending the conflict alarm to the alarm personnel.
8. A Jar packet collision detection apparatus, comprising:
the first determining module is used for determining the target application when the triggering condition is met;
the second determining module is used for determining a Jar package catalog corresponding to the target application;
the scanning module is used for scanning each class of each Jar package in the Jar package catalog, and if the Jar packages of the classes depending on the same class name under the same path exist, determining that the Jar packages of the classes depending on the same class name under the same path have package conflict;
the detection module is used for detecting the called method causing the packet conflict in each group of Jar packets with the packet conflict;
the code judging module is used for acquiring the incremental code of the target application and judging whether the incremental code contains a called method causing packet conflict;
and the alarm generating module is used for generating a conflict alarm when the increment code contains a called method causing the package conflict.
9. A storage medium, characterized by: the storage medium having stored therein computer readable instructions which, when executed by one or more processors, cause the one or more processors to perform the steps of the Jar packet collision detection method of any of claims 1 to 7.
10. A computer device, comprising: one or more processors, and a memory;
the memory has stored therein computer readable instructions which, when executed by the one or more processors, perform the steps of the Jar packet collision detection method according to any of claims 1 to 7.
CN202211330163.7A 2022-10-27 2022-10-27 Jar package conflict detection method and device, storage medium and computer equipment Pending CN115563010A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211330163.7A CN115563010A (en) 2022-10-27 2022-10-27 Jar package conflict detection method and device, storage medium and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211330163.7A CN115563010A (en) 2022-10-27 2022-10-27 Jar package conflict detection method and device, storage medium and computer equipment

Publications (1)

Publication Number Publication Date
CN115563010A true CN115563010A (en) 2023-01-03

Family

ID=84767769

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211330163.7A Pending CN115563010A (en) 2022-10-27 2022-10-27 Jar package conflict detection method and device, storage medium and computer equipment

Country Status (1)

Country Link
CN (1) CN115563010A (en)

Similar Documents

Publication Publication Date Title
US20190324772A1 (en) Method and device for processing smart contracts
CN106933733B (en) Method and device for determining memory leak position
CN105630463B (en) For detecting the method and device of JAR packet conflict
KR101410099B1 (en) Function Test Apparatus based on Unit Test Cases Reusing and Function Test Method thereof
CN108399132B (en) Scheduling test method, device and storage medium
CN110460460B (en) Service link fault positioning method, device and equipment
US20040194063A1 (en) System and method for automated testing of a software module
CN108763089B (en) Test method, device and system
US7552422B2 (en) Test case inheritance controlled via attributes
CN110765026A (en) Automatic testing method and device, storage medium and equipment
Panigrahi et al. Model-based regression test case prioritization
CN107179982B (en) Cross-process debugging method and device
CN112965913A (en) Method for automatically repairing dependency conflict problem of Java software
US7340725B1 (en) Smart test attributes and test case scenario in object oriented programming environment
CN110928777B (en) Test case processing method, device, equipment and storage medium
CN114328168A (en) Anomaly detection method and device, computer equipment and storage medium
CN115563010A (en) Jar package conflict detection method and device, storage medium and computer equipment
CN115757172A (en) Test execution method and device, storage medium and computer equipment
CN114500249B (en) Root cause positioning method and device
CN111367796B (en) Application program debugging method and device
CN113360389A (en) Performance test method, device, equipment and storage medium
CN114791884A (en) Test environment construction method and device, storage medium and electronic equipment
CN109240906B (en) Database configuration information adaptation method and device, computer equipment and storage medium
CN108845932B (en) Unit testing method and device of network library, storage medium and terminal
CN114661432A (en) Task scheduling method, device, equipment and storage 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