[go: up one dir, main page]

CN112506561B - Packing method for filter implementation based on maven - Google Patents

Packing method for filter implementation based on maven Download PDF

Info

Publication number
CN112506561B
CN112506561B CN202011482734.XA CN202011482734A CN112506561B CN 112506561 B CN112506561 B CN 112506561B CN 202011482734 A CN202011482734 A CN 202011482734A CN 112506561 B CN112506561 B CN 112506561B
Authority
CN
China
Prior art keywords
configuration
directory
file
env
value
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.)
Active
Application number
CN202011482734.XA
Other languages
Chinese (zh)
Other versions
CN112506561A (en
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.)
Yinsheng Payment Service Co Ltd
Original Assignee
Yinsheng Payment Service 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 Yinsheng Payment Service Co Ltd filed Critical Yinsheng Payment Service Co Ltd
Priority to CN202011482734.XA priority Critical patent/CN112506561B/en
Publication of CN112506561A publication Critical patent/CN112506561A/en
Application granted granted Critical
Publication of CN112506561B publication Critical patent/CN112506561B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a method for packing a filter implementation based on maven, which comprises the following steps of S1, adding a filters directory under a root directory of a java item, S2, adding a configuration file under the filters directory according to packing requirements, S3, adding a configuration item in a key=value format to the configuration file, wherein the key is the configuration item, the value is a value of the configuration item, S4, adding configuration in a pore file corresponding to the maven item, S5, configuring a packing command, deploying a specific value of the platform maven command into the directory, and the specific value is a file name of a file specified according to the packing requirements in the configuration file, and S6, triggering packing operation to finish packing. The maven packing command of different projects is flexibly configured according to packing requirements, automatic packing is realized, and the method is suitable for various project structures.

Description

Packing method for filter implementation based on maven
Technical Field
The invention relates to the technical field of software, in particular to a packing method for realizing a filter based on maven.
Background
In the prior art, a maven packaging command is generally adopted for packaging, a configuration file directory is designated, and an online war package is generated, but the method is only suitable for items with a single function in an item structure, and many existing item structures depend on different dependent packages to realize different functions.
Disclosure of Invention
In order to overcome the defects of the prior art, the invention provides a packing method realized by a filter based on maven, which aims to solve the technical problems.
The invention discloses a packing method realized by a filter based on maven, which is characterized by comprising the following steps of S1, adding a filters directory under a java project root directory, S2, adding a configuration file under the filters directory according to packing requirements, adding a configuration item to the configuration file according to the packing requirements, S3, adopting a key=value format of the configuration file, wherein the key is the configuration item, the value is the value of the configuration item, S4, adding configuration in the corresponding pom file of the maven project, S5, configuring a packing command, deploying a specific value of the directory which is transmitted by the platform maven command, wherein the specific value is the file name of a file specified according to the packing requirements in the configuration file, S6, triggering packing operation, and finishing packing.
In the above method, step S2 includes the steps of:
S21, adding a deployment environment directory env and a sub-application package directory subpackage under a filters directory;
S22, adding configuration files under the deployment environment catalog env and the sub-application package catalog subpackage, wherein the file names of the configuration files are different.
In the above method, step S3 includes the steps of:
S31, adding configuration items to the configuration files under the deployment environment catalog env in a key=value format;
s32, adding configuration items to the configuration files under the sub-application package catalog subpackage in a key=value format;
S33, judging whether the value of the configuration file under the deployment environment directory env is crossed with the value of the configuration file under the sub-application package directory subpackage, if so, adding an application name configuration app_name in the configuration file under the sub-application package directory subpackage, namely, the application name of each sub-application, jumping to S4, and if not, directly jumping to S4.
In the method, when the key to be configured is determined, the configuration item is directly configured by adopting static configuration, and when the key to be configured is uncertain, the configuration item is dynamically configured and is transmitted through a configuration file or a command.
In the above method, the log_path of the configuration item in the configuration file of the deployment environment directory env is dynamically configured, configured as log_path= $ (app_name), where log_path is the configuration item key in the configuration file under the deployment environment directory env, and app_name is the configuration item key in the configuration file under the sub-application package directory subpackage.
In the above method, step S4 includes the steps of:
S41, adding profile configuration in a pon file corresponding to a maven item, wherein the id value of the profile is the file name of each configuration file under a deployment environment directory env;
S42, adding filter configuration in a pore file corresponding to a maven item, configuring two filters, designating the deployment environment directory env and the sub-application package directory subpackage by two filter labels, designating one configuration file of configuration files under the deployment environment directory env and the sub-application package directory subpackage according to packaging requirements, and dynamically acquiring file names of the configuration files, namely $ (env) and $ (subpackage).
In the above method, in step S5, the specific value is a file name of a configuration file specified according to the packaging requirement in the configuration files under the deployment environment directory env and the sub-application package directory subpackage.
The invention has the advantages of realizing flexible configuration of maven packing commands of different projects according to packing requirements, realizing automatic packing, having strong expandability, being capable of adding configuration files to realize corresponding packing requirements when new packing requirements exist, managing each dependent package of the projects based on version number specification, ensuring that version upgrading is clear at a glance, being suitable for various project structures, and realizing the packing requirements according to configuration whether single function or multiple functions.
Drawings
FIG. 1 is a flow chart of a method of packing a maven-based filter implementation of the present invention.
Detailed Description
The invention will be further described with reference to the drawings and examples.
The conception, specific structure, and technical effects produced by the present invention will be clearly and completely described below with reference to the embodiments and the drawings to fully understand the objects, features, and effects of the present invention. It is apparent that the described embodiments are only some embodiments of the present invention, but not all embodiments, and that other embodiments obtained by those skilled in the art without inventive effort are within the scope of the present invention based on the embodiments of the present invention. In addition, all the coupling/connection relationships referred to in the patent are not direct connection of the single-finger members, but rather, it means that a better coupling structure can be formed by adding or subtracting coupling aids depending on the specific implementation. The technical features in the invention can be interactively combined on the premise of no contradiction and conflict.
Referring to fig. 1, a packing method implemented by a maven-based filter of the present invention includes the steps of:
S1, adding a files directory under the root directory of the java item, wherein the files directory is one directory of the java item and is used for storing configuration files.
S2, adding a catalog according to the packing requirement under the filters catalog, adding a configuration file according to the packing requirement under the catalog,
Specifically, in this embodiment, the deployment environment directory env and the sub-application package directory subpackage are added under the filters directory, and then the configuration files are added under the deployment environment directory env and the sub-application package directory subpackage, where the file names of the configuration files are different.
S3, adding a configuration item to the configuration file in a format of key=value, wherein the format is a general configuration mode of the java configuration file, the key is the configuration item, the value is a value of the configuration item,
Specifically, in this embodiment, a configuration item is added to a configuration file under the deployment environment directory env in a key=value format, a configuration item is added to a configuration file under the sub-application package directory subpackage in a key=value format, when a key to be configured is determined, that is, when a value to be configured is known, the configuration item is configured statically and directly, when the key to be configured is uncertain, other configuration files or commands need to be relied on to be input, and the configuration item is configured dynamically,
When the value of the configuration file under the deployment environment directory env is crossed with the value of the configuration file under the sub-application package directory subpackage, adding an application name configuration app_name in the configuration file under the sub-application package directory subpackage, wherein the app_name is the application name of each sub-application, the sub-application refers to the names of different services, then jumping to the step S4, continuing the downward flow, and adding configuration in the pon file corresponding to the maven item in the step S4;
When the value of the configuration file under the deployment environment directory env and the value of the configuration file under the sub-application package directory subpackage do not cross, directly jumping to the step S4, continuing the downward flow, and increasing the configuration in the pon file corresponding to the maven item in the step S4.
In this embodiment, the log_path of the configuration item in the configuration file of the deployment environment directory env is dynamically configured, and is configured as log_path= $ (app_name), where log_path is a configuration item key in the configuration file under the deployment environment directory env, app_name is a configuration item key in the configuration file under the sub-application package directory subpackage, based on this configuration mode, different environment packages can be implemented, sub-application names can be dynamically obtained, and different applications can be saved to different log paths.
And S4, adding configuration in the pon file corresponding to the maven item. The pon file is a fixed configuration file in the maven item,
Specifically, in this embodiment, a profile configuration is added to a pon file corresponding to a maven item, the profile configuration is a tag in the pon file, the pon file is an xml format file, a profile tag is defined, the id value of the profile is the file name of each profile under the deployment environment directory env, a filter configuration is added to the pon file corresponding to the maven item, the filter configuration is a tag defined by the pon file in the pon file, two filters are configured, the two filter tags specify the deployment environment directory env and the sub-application package directory subpackage, namely, the two filters are the deployment environment directory env and the sub-application package directory subpackage, one profile under the deployment environment directory env and the sub-application package directory subpackage is specified according to packaging requirements, and the file names of the profiles, namely $ (env) and the sub-application package directory subpackage, are dynamically obtained
And (subpackage) associating the deployment environment directory env and the sub-application package directory subpackage with maven items to ensure that configuration files can be obtained in the packaging process.
S5, configuring a packaging command, wherein a specific value of a directory transmitted by a deployment platform maven command is a file name of a file specified according to packaging requirements in a configuration file,
In this embodiment, the specific value is a file name of a configuration file specified according to a packaging requirement in the configuration files under the deployment environment directory env and the sub-application package directory subpackage, so that different packaging commands are configured according to the combination of different env and subpackage, and the packaging requirements of different services in different environments are realized.
S6, triggering packaging operation to finish packaging.
The packing method based on the maven filter implementation realizes flexible configuration of maven packing commands of different projects according to packing requirements, realizes automatic packing, has strong expandability, can increase configuration files to realize corresponding packing requirements when new packing requirements exist, manages each dependence package of the projects based on version number specifications, has clear version upgrading dependence, is suitable for various project structures, has single functions or multiple functions, and can realize the packing requirements according to the configuration.
While the preferred embodiment of the present application has been described in detail, the present application is not limited to the embodiments, and those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the present application, and the equivalent modifications or substitutions are included in the scope of the present application as defined in the appended claims.

Claims (2)

1.一种基于maven的filter实现的打包方法,其特征在于:包括以下的步骤:1. A packaging method based on Maven filter implementation, characterized in that it includes the following steps: S1、在java项目的根目录下增加filters目录;S1. Add the filters directory to the root directory of the Java project; S2、在filters目录下按打包需求增加目录,在目录下按打包需求增加配置文件;S2. Add directories under the filters directory according to packaging requirements, and add configuration files under the directories according to packaging requirements; 所述步骤S2,包括以下步骤:The step S2 comprises the following steps: S21、在filters目录下增加部署环境目录env和子应用包目录subpackage;S21. Add the deployment environment directory env and the sub-application package directory subpackage under the filters directory; S22、在部署环境目录env和子应用包目录subpackage下增加配置文件,配置文件的文件名均不相同;S22. Add configuration files under the deployment environment directory env and the sub-application package directory subpackage. The file names of the configuration files are different. S3、对配置文件采用key=value的格式增加配置项,key为配置项,value为配置项的值;S3. Add configuration items to the configuration file in the format of key=value, where key is the configuration item and value is the value of the configuration item; 所述步骤S3包括以下的步骤:The step S3 comprises the following steps: S31、对部署环境目录env下的配置文件采用key=value的格式增加配置项;S31. Add configuration items to the configuration file in the deployment environment directory env in the format of key=value; S32、对子应用包目录subpackage下的配置文件采用key=value的格式增加配置项;S32, adding configuration items to the configuration file under the sub-application package directory subpackage in the format of key=value; S33、判断部署环境目录env下的配置文件的value与子应用包目录subpackage下的配置文件的value是否存在交叉,当存在时,则在子应用包目录subpackage下的配置文件中增加应用名称配置app_name,app_name即每个子应用的应用名,跳转至S4;当不存在时,则直接跳转至S4;S33, determine whether the value of the configuration file under the deployment environment directory env and the value of the configuration file under the sub-application package directory subpackage overlap, if so, add the application name configuration app_name to the configuration file under the sub-application package directory subpackage, where app_name is the application name of each sub-application, and jump to S4; if not, jump directly to S4; 当需要配置的key确定时,配置项采用静态配置直接配置;当需要配置的key不确定时,配置项则采用动态配置,通过配置文件或命令传入;When the key to be configured is determined, the configuration item is directly configured using static configuration; when the key to be configured is uncertain, the configuration item is dynamically configured and passed in through a configuration file or command; 部署环境目录env的配置文件中的配置项日志路径log_path为动态配置,配置为log_path=$(app_name),其中log_path为部署环境目录env下的配置文件中的配置项key,app_name为子应用包目录subpackage下的配置文件中的配置项key;The configuration item log path log_path in the configuration file of the deployment environment directory env is a dynamic configuration, which is configured as log_path = $(app_name), where log_path is the configuration item key in the configuration file under the deployment environment directory env, and app_name is the configuration item key in the configuration file under the sub-application package directory subpackage; S4、在maven项目对应的pom文件中增加配置;S4. Add configuration to the pom file corresponding to the Maven project; 所述步骤S4包括以下的步骤:The step S4 comprises the following steps: S41、在maven项目对应的pom文件中增加profile配置,profile的id取值为部署环境目录env下的每个配置文件的文件名称;S41. Add profile configuration in the pom file corresponding to the Maven project. The profile id value is the file name of each configuration file in the deployment environment directory env. S42、在maven项目对应的pom文件中增加filter配置,配置两条filter,两条filter标签指定所述部署环境目录env和子应用包目录subpackage,按打包需求指定部署环境目录env和子应用包目录subpackage下的配置文件中的一个配置文件,并动态获取该配置文件的文件名,即$(env)和$(subpackage);S42. Add filter configuration in the pom file corresponding to the Maven project, configure two filters, the two filter tags specify the deployment environment directory env and the sub-application package directory subpackage, specify one of the configuration files under the deployment environment directory env and the sub-application package directory subpackage according to the packaging requirements, and dynamically obtain the file name of the configuration file, namely $(env) and $(subpackage); S5、配置打包命令,部署平台maven命令传入目录的具体值,具体值为配置文件中按打包需求指定的文件的文件名;S5. Configure the packaging command, and deploy the specific value of the Maven command input directory of the platform. The specific value is the file name of the file specified in the configuration file according to the packaging requirements; S6、触发打包操作,完成打包。S6. Trigger the packaging operation and complete the packaging. 2.如权利要求1所述的一种基于maven的filter实现的打包方法,其特征在于:所述步骤S5中,所述具体值为部署环境目录env和子应用包目录subpackage下的配置文件中按打包需求指定的配置文件的文件名。2. A packaging method based on Maven filter implementation as described in claim 1, characterized in that: in the step S5, the specific value is the file name of the configuration file specified according to the packaging requirements in the configuration files under the deployment environment directory env and the sub-application package directory subpackage.
CN202011482734.XA 2020-12-15 2020-12-15 Packing method for filter implementation based on maven Active CN112506561B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011482734.XA CN112506561B (en) 2020-12-15 2020-12-15 Packing method for filter implementation based on maven

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011482734.XA CN112506561B (en) 2020-12-15 2020-12-15 Packing method for filter implementation based on maven

Publications (2)

Publication Number Publication Date
CN112506561A CN112506561A (en) 2021-03-16
CN112506561B true CN112506561B (en) 2025-01-17

Family

ID=74972319

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011482734.XA Active CN112506561B (en) 2020-12-15 2020-12-15 Packing method for filter implementation based on maven

Country Status (1)

Country Link
CN (1) CN112506561B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN120406991B (en) * 2025-07-04 2025-09-26 浪潮通用软件有限公司 Patch automatic production method and system based on low-code SDK (software development kit)

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7559059B2 (en) * 2001-09-21 2009-07-07 Bea Systems, Inc. Method and apparatus for smart directories for application deployment
CN107707625A (en) * 2017-09-05 2018-02-16 江苏电力信息技术有限公司 Foreground resource based on Maven is packed and carries out version management and the method used
CN108958753B (en) * 2018-07-13 2022-04-12 中国银行股份有限公司 Code packaging deployment method and device
CN110968357B (en) * 2018-09-30 2023-04-07 北京国双科技有限公司 Method and device for packaging maven item, storage medium and processor
CN111813439B (en) * 2020-07-17 2024-03-29 前海人寿保险股份有限公司 Distribution material quality control method, device, equipment and computer storage medium

Also Published As

Publication number Publication date
CN112506561A (en) 2021-03-16

Similar Documents

Publication Publication Date Title
US11467854B2 (en) Method and apparatus for loading multiple differing versions of a native library into a native environment
JP5542796B2 (en) Method and apparatus for managing mobile device software
US8275795B2 (en) Model extension framework
US8516464B2 (en) Computer system and method for resolving dependencies in a computer system
US8266588B2 (en) Creating projects in a rational application developer workspace
US20040088397A1 (en) System and method for management of software applications
JP6881948B2 (en) Bidirectional synchronization of data between Product Lifecycle Management (PLM) and Source Code Management (SCM) systems
EP3166029B1 (en) Exporting hierarchical data from a source code management (scm) system to a product lifecycle management (plm) system
JP6673359B2 (en) System construction support system, method and program
CN113434194A (en) Continuous integration and delivery system, method, electronic device and storage medium
CN102339219A (en) System and method for supporting object-oriented script tool
US7325240B2 (en) Method for generating calling convention transformation process
CN112506561B (en) Packing method for filter implementation based on maven
CN105373406A (en) Android platform based application layout dynamic switching method and system
CN107133055A (en) A kind of method that customized development is realized based on ClassLoader
CN102200918B (en) The method of server disposition application program and device
US20220207438A1 (en) Automatic creation and execution of a test harness for workflows
EP3166030B1 (en) Exporting hierarchical data from a product lifecycle management (plm) system to a source code management (scm) system
CN112965714B (en) Method, device and equipment for quickly updating code and storage medium
CN101344858A (en) J2EE engineering deploying method and device
CN111176652A (en) Method, apparatus, device and medium for application management
CN114936049A (en) Hot-pluggable data fusion platform operator dynamic extension method
JP2024147348A (en) Pipeline setting update device, pipeline setting update method, and program
Zandstra Continuous Integration
CN114064151A (en) Cross-platform high-performance cluster application software management and use method

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
GR01 Patent grant
GR01 Patent grant