当前位置: 首页 > news >正文

maven-war-plugin插件 overlays maven-war-plugin翻译

说明

翻译maven-war-plugin插件的部分内容

官方地址为:https://maven.apache.org/plugins/maven-war-plugin/index.html


Overview

概述

Introduction

介绍

Apache Maven WAR Plugin

apache maven war 插件

The WAR Plugin is responsible for collecting all artifact dependencies, classes and resources of the web application and packaging them into a web application archive.

war插件负责收集web工程中所有的依赖引用、class文件和资源文件,并将它们打包到一个web工程存档中

Goals Overview

目标概述

  • war:war is the default goal invoked during the package phase for projects with a packaging type of war. It builds a WAR file.

  • 当项目的打包类型为war时,war:war是一个默认的目标在package执行阶段被调用

  • war:exploded is generally used to speed up testing during the developement phase by creating an exploded webapp in a specified directory.

  • war:exploded用来在指定的目录下创建一个解包的webapp,这通常用来在开发阶段提升测试速度

  • war:inplace another variation of war:explode where the webapp is instead generated in the web application source directory, which is src/main/webapp by default.

  • war:inplace是war:explode的一个变体,会在web工程的源目录下创建webapp,默认的目录是src/main/webapp

Usage

用法

General instructions on how to use the WAR Plugin can be found on the usage page. Some more specific use cases are described in the examples given below. To share common resources across multiple web applications, see the documentation about using overlays.

关于如何使用war插件的整体介绍在usage页面可以找到。后面的examples中会给出一些更具体的使用案例。要在多个web工程中共享公共资源,请参阅有关使用overlays的文档

In case you still have questions regarding the plugin’s usage, please have a look at the FAQ and feel free to contact the user mailing list. The posts to the mailing list are archived and could already contain the answer to your question as part of an older thread. Hence, it is also worth browsing/searching the mail archive.

If you feel like the plugin is missing a feature or has a defect, you can fill a feature request or bug report in our issue tracker. When creating a new issue, please provide a comprehensive description of your concern. Especially for fixing bugs it is crucial that the developers can reproduce your problem. For this reason, entire debug logs, POMs or most preferably little demo projects attached to the issue are very much appreciated. Of course, patches are welcome, too. Contributors can check out the project from our source repository and will find supplementary information in the guide to helping with Maven.

Goals

Plugin Documentation

Goals available for this plugin:

GoalDescription
war:explodedCreate an exploded webapp in a specified directory.
war:helpDisplay help information on maven-war-plugin. Call mvn war:help -Ddetail=true -Dgoal= to display parameter details.
war:inplaceGenerate the webapp in the WAR source directory.
war:warBuild a WAR file.

System Requirements

The following specifies the minimum requirements to run this Maven plugin:

Maven3.1.0
JDK1.7
MemoryNo minimum requirement.
Disk SpaceNo minimum requirement.

Usage

用法

You should specify the version in your project’s plugin configuration:

您应该明确指定项目中所使用插件的版本

<project>...<build><!-- To define the plugin version in your parent POM --><pluginManagement><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-war-plugin</artifactId><version>3.3.2</version></plugin>...</plugins></pluginManagement><!-- To use the plugin goals in your POM or parent POM --><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-war-plugin</artifactId><version>3.3.2</version></plugin>...</plugins></build>...
</project>

For more information, see “Guide to Configuring Plug-ins”

Usage

Usage

There are 4 ways to use the WAR Plugin:

  • using the package phase with the project package type as war

  • 当项目的打包方式为war包时,使用package阶段

  • invocation of the war:war goal

  • 调用war:war目标

  • invocation of the war:exploded goal

  • 调用war:exploded目标

  • invocation of the war:inplace goal

  • 调用war:inplace目标

Note: When using the war: goals it is assumed that the compile phase is already done. The WAR Plugin is not responsible for compiling the java sources or copying the resources.

注意:当使用war:目标时,假设compile阶段已经完成,war插件不负责编译源代码或者复制resources资源

To handle archiving this version of Maven WAR Plugin uses Maven Archiver 3.5.0.

To handle filtering this version of Maven WAR Plugin uses Maven Filtering 3.1.1.

Using the package phase with the project package type as war / invocation of the war:war goal

当项目的打包方式为war包时使用package阶段/调用war:war目标

This is the normal way of using the WAR Plugin. To illustrate, here’s the pom.xml for our project:

这是war插件的一般使用方式,为了说明,这是我们项目的pom文件

<project>...<groupId>com.example.projects</groupId><artifactId>documentedproject</artifactId><packaging>war</packaging><version>1.0-SNAPSHOT</version><name>Documented Project</name><url>http://example.com</url>...
</project>

The project’s structure looks like this:

项目结构如下

 |-- pom.xml`-- src`-- main|-- java|   `-- com|       `-- example|           `-- projects|               `-- SampleAction.java|-- resources|   `-- images|       `-- sampleimage.jpg`-- webapp|-- WEB-INF|   `-- web.xml|-- index.jsp`-- jsp`-- websource.jsp

Invoking

mvn package

or

mvn compile war:war

will generate the WAR file target/documentedproject-1.0-SNAPSHOT.war. Here are the contents of that WAR file:

documentedproject-1.0-SNAPSHOT.war|-- META-INF|   |-- MANIFEST.MF|   `-- maven|       `-- com.example.projects|           `-- documentedproject|               |-- pom.properties|               `-- pom.xml|-- WEB-INF|   |-- classes|   |   |-- com|   |   |   `-- example|   |   |       `-- projects|   |   |           `-- SampleAction.class|   |   `-- images|   |       `-- sampleimage.jpg|   `-- web.xml|-- index.jsp`-- jsp`-- websource.jsp

Invocation of war:exploded goal

To speed up testing during the developement phase, war:explode can be used to generate the WAR in exploded form. Use the same project as above and invoke:

mvn compile war:exploded

This will generate an exploded version of the WAR in target/documentedproject-1.0-SNAPSHOT. The contents of that directory looks like this:

 documentedproject-1.0-SNAPSHOT|-- META-INF|-- WEB-INF|   |-- classes|   |   |-- com|   |   |   `-- example|   |   |       `-- projects|   |   |           `-- SampleAction.class|   |   `-- images|   |       `-- sampleimage.jpg|   `-- web.xml|-- index.jsp`-- jsp`-- websource.jsp

The default directory for the exploded WAR is target/<finalName>. The finalName is usually in the form of <artifactId>-<version>. This default directory can be overridden by specifying the webappDirectory parameter.

解包的war默认的目录是 target/,finalName通常采用-的形式,可以通过指定webappDirectory参数来覆盖此默认目录

<project>...<build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-war-plugin</artifactId><version>3.3.2</version><configuration><webappDirectory>/sample/servlet/container/deploy/directory</webappDirectory></configuration></plugin></plugins></build>...
</project>

Invocation of war:inplace goal

Another variation of war:exploded is war:inplace. With war:inplace the exploded WAR is created in the webapp source, which defaults to src/main/webapp. Use our sample project above, and invoke:

mvn compile war:inplace

This will result in:

 |-- pom.xml|-- src|   `-- main|       |-- java|       |   `-- com|       |       `-- example|       |           `-- projects|       |               `-- SampleAction.java|       |-- resources|       |   `-- images|       |       `-- sampleimage.jpg|       `-- webapp|           |-- META-INF|           |-- WEB-INF|           |   |-- classes|           |   |   |-- com|           |   |   |   `-- example|           |   |   |       `-- projects|           |   |   |           `-- SampleAction.class|           |   |   `-- images|           |   |       `-- sampleimage.jpg|           |   `-- web.xml|           |-- index.jsp|           `-- jsp|               `-- websource.jsp`-- target`-- classes|-- com|   `-- example|       `-- projects|           `-- SampleAction.class`-- images`-- sampleimage.jpg

Configuration

Overlays

Overlays

Overlays are used to share common resources across multiple web applications. The dependencies of a WAR project are collected in WEB-INF/lib, except for WAR artifacts which are overlayed on the WAR project itself.

overlays用于跨多个web应用共享公共资源。除了要在war项目本身做叠加的组件,其它的依赖会被收集在WEB-INF/lib目录下

Overlays at a glance

To demonstrate, given this structure for the project documentedproject:

为了做演示,给出项目documentedproject的格式

 |-- pom.xml`-- src`-- main|-- java|   `-- com|       `-- example|           `-- projects|               `-- SampleAction.java|-- resources|   |-- images|   |   `-- sampleimage.jpg|   `-- sampleresource`-- webapp|-- WEB-INF|   `-- web.xml|-- index.jsp`-- jsp`-- websource.jsp

The project depends on another WAR artifact, documentedprojectdependency-1.0-SNAPSHOT.war, which is declared as a dependency in the project’s pom.xml:

项目依赖另一个war组件,documentedprojectdependency-1.0-SNAPSHOT.war,这个组件在pom.xml文件中,会被声明为一个dependency依赖

<project>...<dependencies><dependency><groupId>com.example.projects</groupId><artifactId>documentedprojectdependency</artifactId><version>1.0-SNAPSHOT</version><type>war</type><scope>runtime</scope></dependency>...</dependencies>...
</project>

The structure for the documentedprojectdependency WAR file looks like this:

documentedprojectdependency组件的结构如下

documentedprojectdependency-1.0-SNAPSHOT.war|-- META-INF|   |-- MANIFEST.MF|   `-- maven|       `-- com.example.projects|           `-- documentedprojectdependency|               |-- pom.properties|               `-- pom.xml|-- WEB-INF|   |-- classes|   |   |-- com|   |   |   `-- example|   |   |       `-- projects|   |   |           `-- SampleActionDependency.class|   |   `-- images|   |       `-- sampleimage-dependency.jpg|   `-- web.xml`-- index-dependency.jsp

The resulting WAR would end up like this:

 |-- META-INF|   |-- MANIFEST.MF|   `-- maven|       `-- com.example.projects|           `-- documentedproject|               |-- pom.properties|               `-- pom.xml|-- WEB-INF|   |-- classes|   |   |-- com|   |   |   `-- example|   |   |       `-- projects|   |   |           |-- SampleAction.class|   |   |           `-- SampleActionDependency.class|   |   `-- images|   |       |-- sampleimage-dependency.jpg|   |       `-- sampleimage.jpg|   `-- web.xml|-- index-dependency.jsp|-- index.jsp`-- jsp`-- websource.jsp

The web.xml file above comes from documentedproject.

上面的web.xml文件来自documentedproject

Overlay types

The WAR Plugin handles both war and zip artifacts as overlays. However, for backward compatibility reasons, zip overlays are handled only if they are defined explicitly in the plugin’s configuration.

war插件可以对wer或者zip组件做覆盖处理。然而,出于向后兼容的原因,只有在插件配置中明确指明了才会进行zip覆盖处理

Configuring Overlays

In previous versions of the WAR Plugin, no configuration was necessary. This is still the case if you are happy with the default settings. However, if you need more control, read on!

在插件的以前版本中,没有一个配置是必须的。如果默认配置感到满意,现在也仍是这样。然而,如果您需要更多的控制,请继续阅读

The element can have the following child elements:

overlay节点可以包含以下的子节点

  • id - the id of the overlay. If none is provided, the WAR Plugin will generate one.

  • id - overlay的id,如果没有,war插件将会生成一个。

  • groupId - the groupId of the overlay artifact you want to configure.

  • groupld - 想要配置的叠加组件的groupId

  • artifactId - the artifactId of the overlay artifact you want to configure.

  • artifactId - 想要配置的叠加组件的artifactId

  • type - the type of the overlay artifact you want to configure. Default value is: war.

  • type - 想要配置的叠加组件的type,默认是:war

  • classifier - the classifier of the overlay artifact you want to configure if multiple artifacts matches the groupId/artifactId.

  • classifier - 想要配置的叠加组件的classifier,如果多个组件匹配groupId/artifactId

  • includes - the files to include. By default, all files are included.

  • 要包含的文件,默认会包含所有文件

  • excludes - the files to exclude. By default, the META-INF/MANIFEST.MF file is excluded.

  • 要排除的文件,默认META-INF/MANIFEST.MF文件会被排除

  • targetPath - the target relative path in the webapp structure, which is only available for overlays of type war. By default, the content of the overlay is added in the root structure of the webapp.

  • targetPath - 目标在webapp结构中的相对路径,仅适用于war类型的覆盖。默认叠加的内容会被添加到webapp结构的根路径

  • skip - set to true to skip this overlay. Default value is: false.

  • skip - 设置为true可以跳过这个overlay,默认值为:false

  • filtered - whether to apply filtering to this overlay. Default value is false.

  • 是否对这个overlay进行过滤,默认值为:false

For instance, to exclude the sampleimage-dependency.jpg of our documentedprojectdependency war overlay above:

例如,叠加documentedprojectdependency.war组件并排除其中的sampleimage-dependency.jpg文件

<project>...<build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-war-plugin</artifactId><version>3.3.2</version><configuration><overlays><overlay><groupId>com.example.projects</groupId><artifactId>documentedprojectdependency</artifactId><excludes><exclude>WEB-INF/classes/images/sampleimage-dependency.jpg</exclude></excludes></overlay></overlays></configuration></plugin></plugins></build>...
</project>

Overlays packaging

Overlays are applied with a first-win strategy (hence if a file has been copied by one overlay, it won’t be copied by another). Overlays are applied in the order in which they are defined in the configuration. If no configuration is provided, the order in which the dependencies are defined in the POM is used (warning: this is not deterministic, especially if you have overlays as transitive dependencies). In case of a mixed situation (e.g. configured overlays and non-configured overlays), non-configured overlays are applied after configured overlays.

叠加采用的是先赢策略(因此,如果一个文件被复制从一个叠加组件复制过来,就不会再从其它组件复制了),按照在overlays配置中定义的顺序进行加载。如果未提供相关的配置,加载的顺序为该依赖在pom文件中被应用的顺序(警告:这是不确定的,尤其当叠加为传递依赖时)。在混合情况下(例如,有配置的叠加和无配置的叠加),先加载有配置的叠加,再加载无配置的叠加

By default, the source of the project (a.k.a the current build) is added first (e.g. before any overlay is applied). The current build is defined as a special overlay with no groupId, artifactId. If overlays need to be applied first, simply configure the current build after those overlays.

默认情况下,项目的源代码(也就是当前构建的项目)会被优先加载(例如,在任何的叠加被加载之前),当前构建的项目被定义为一个没有groupId和artifactId的特殊的叠加,如果有一些叠加需要被首先应用,只需要配置当前构建的项目在这些叠加之后。

For instance, if my-webapp from the com.example.projects group is a dependency of the project and needs to be applied before the project’s own source, do as follows:

举例,如果项目的一个依赖my-webapp,com.example.proects需要在项目自己的源代码之前被应用,请执行以下操作:

<project>...<build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-war-plugin</artifactId><version>3.3.2</version><configuration><overlays><overlay><groupId>com.example.projects</groupId><artifactId>my-webapp</artifactId></overlay><overlay><!-- empty groupId/artifactId represents the current build --></overlay></overlays></configuration></plugin></plugins></build>...
</project>

Note: In the scenario above, any other WAR dependency will be applied after the current build since they have not been configured in the <overlays> element.

注意:在上面的场景中,任何其他WAR依赖项都将在当前构建之后应用,因为它们尚未在<overlays>元素中配置。

To perform an even more fine grained overwriting policy, overlays can be packaged multiple times with different includes/excludes. For instance if the index.jsp file of the overlay my-webapp must be set in the webapp but other files can be controlled the regular way, define two overlay configurations for my-webapp:

为了执行更细粒度的覆盖策略,可以使用不同的包含/排除对叠加进行多次打包。例如,如果my-webapp中的index.jsp文件必须设置在webapp中,但其他文件可以用常规的方式控制,可以为my-webapp定义两个叠加配置:

<project>...<build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-war-plugin</artifactId><version>3.3.2</version><configuration><overlays><overlay><id>my-webapp-index.jsp</id><groupId>com.example.projects</groupId><artifactId>my-webapp</artifactId><includes><include>index.jsp</include></includes></overlay><overlay><!-- empty groupId/artifactId represents the current build --></overlay><!-- Other overlays here if necessary --><overlay><id>my-webapp</id><groupId>com.example.projects</groupId><artifactId>my-webapp</artifactId></overlay></overlays></configuration></plugin></plugins></build>...
</project>

Overlay global settings

The following settings can be specified globally and modify the way all overlays are applied.

下面的配置是全局配置,修改会对所有的叠加应用

  • dependentWarIncludes - sets the default includes to apply to all overlays. Any overlay that has no specific includes element will inherit this setting by default.

  • dependentWarIncludes - 对所有的叠加设置默认的包含目录。默认情况下,任何没有指定includes元素的叠加都将继承此设置。

    <project>...<plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-war-plugin</artifactId><version>3.3.2</version><configuration><dependentWarIncludes>**/IncludeME,**/images</dependentWarIncludes></configuration></plugin></plugins>...
    </project>
    
  • dependentWarExcludes - sets the default excludes to apply to all overlays. Any overlay that has no specific excludes element will inherit this setting by default.

  • dependentWarExcludes - 对所有的叠加设置默认的排除目录。默认情况下,任何没有指定excludes元素的叠加都将继承此设置。

    <project>...<plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-war-plugin</artifactId><version>3.3.2</version><configuration><dependentWarExcludes>WEB-INF/web.xml,index.*</dependentWarExcludes></configuration></plugin></plugins>...
    </project>
    
  • workDirectory - sets the directory where overlays will be temporarily extracted.

  • workDirectory - 设置临时提取叠加的目录

    <project>...<plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-war-plugin</artifactId><version>3.3.2</version><configuration><!-- default value is target/war/work --><workDirectory>/tmp/extract_here</workDirectory></configuration></plugin></plugins>...
    </project>
    

Zip dependencies with overlays

To use a zip dependency as an overlay you have to configure it explicitly in the plugin’s configuration. For instance to inject the content of a zip overlay in the scripts directory of the webapp, do as follows:

要使用zip依赖作为叠加,您必须在插件的配置中明确配置它。例如,要在webapp的scripts目录中添加一个zip叠加的内容,请执行以下操作:

<project>...<plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-war-plugin</artifactId><version>3.3.2</version><configuration><overlays><overlay><groupId>zipGroupId</groupId><artifactId>zipArtifactId</artifactId><type>zip</type><targetPath>scripts</targetPath></overlay></overlays></configuration></plugin></plugins>...
</project>

相关文章:

maven-war-plugin插件 overlays maven-war-plugin翻译

说明 翻译maven-war-plugin插件的部分内容 官方地址为&#xff1a;https://maven.apache.org/plugins/maven-war-plugin/index.html Overview 概述 Introduction 介绍 Apache Maven WAR Plugin apache maven war 插件 The WAR Plugin is responsible for collecting all artifa…...

【数据结构】初识二叉树(二叉树的入门知识)

初识二叉树一、树概念及结构1、树的概念2、树的相关概念3、树的表示4、树在实际中的运用&#xff08;表示文件系统的目录树结构&#xff09;二、二叉树概念及结构1、概念2、特殊的二叉树3、二叉树的性质4、二叉树的存储结构三、结语一、树概念及结构 1、树的概念 树是一种非线…...

RV1126笔记三十二:基于 FastDeploy 在 RV1126 上的部署示例(RV1126 上部署 YOLOv5 检测模型测试)

若该文为原创文章,转载请注明原文出处。 FastDeploy是一款全场景、易用灵活、极致高效的AI推理部署工具, 支持云边端部署。提供超过 🔥160+ Text,Vision, Speech和跨模态模型📦开箱即用的部署体验,并实现🔚端到端的推理性能优化。包括 物体检测、字符识别(OCR)、…...

JVM垃圾回收——G1垃圾收集器

目录 一、什么是G1垃圾收集器 二、G1垃圾收集器的内存划分 三、G1垃圾收集器的收集过程 四、G1收集器的优缺点 五、G1收集器的JVM参数配置 一、什么是G1垃圾收集器 Garbage First(简称G1)收集器是垃圾收集器技术发展史上里程碑式的成果&#xff0c;它摒弃了传统垃圾收集器的…...

C语言深度剖析:关键字

C语言深度剖析:关键字C语言深度剖析:关键字前言定义与声明&#xff08;补充内容&#xff09;最宏大的关键字-auto最快的关键字-register关键字static被冤枉的关键字-sizeof整型在内存中的存储原码、反码、补码大小端补充理解变量内容的存储和取出为什么都是补码整型取值范围关于…...

聊一聊过度设计!

文章目录什么是过度设计&#xff1f;过度设计的坏处如何避免过度设计充分理解问题本身保持简单小步快跑征求其他人的意见总结新手程序员在做设计时&#xff0c;因为缺乏经验&#xff0c;很容易写出欠设计的代码&#xff0c;但有一些经验的程序员&#xff0c;尤其是在刚学习过设…...

程序员在小公司(没有大牛,人少)怎么成长?

大多数小公司都是创业公司&#xff0c;所以它们有着非常独特的“创业心态”。所谓创业心态通常表现为关注快速增长&#xff0c;竭尽所能让公司盈利&#xff0c;或者达成其他一些迫切目标。 在这样一家公司工作的软件开发人员&#xff0c;你极有可能要身兼多职&#xff0c;不能…...

【Fastdfs实战】在本地如何将文件上传到Linux虚拟机

作者&#xff1a;狮子也疯狂 专栏&#xff1a;《Fastdfs连续剧》 坚持做好每一步&#xff0c;幸运之神自然会驾凌在你的身上 目录一. &#x1f981; 前言二. &#x1f981; 上传原理Ⅰ. &#x1f407; 原理图解Ⅱ. &#x1f407; 传输原理三. &#x1f981; 实战演示Ⅰ. &…...

ERP 系统的应用对企业财务会计信息系统内部控制的影响

(一)对企业的财务信息数据进行实时和动态管理传统的财务会计信息系统一般都是采用单一的软件系统&#xff0c;所以在信息的传递及处理上常常不能满足企业的需要&#xff0c;信息与其他部门存在不对称及滞后的现象。而ERP 系统是通过有效的技术手段将企业的各种分散的数据进行完…...

智慧物联网源码带手机端源码 物联网系统源码

在智慧工厂领域&#xff0c;智慧城市领域&#xff0c;都需要对设备进行监控。比如工厂需要对周围环境温度、湿度、气压、电压&#xff0c;灯的开关进行监控。这时候就需要物联网平台来进行管理。 推荐一个基于java开发的物联网平台&#xff0c;前端HTML带云组态、可接入视频监…...

AI绘画进军三次元,有人用它打造赛博女友?(diffusion)

目录0 写在前面1 AI绘画技术飞跃2 效果展示3 环境配置3.1 下载基础模型3.2 更新.NET和模型3.3 下载绘画模型3.4 启动项目3.5 标签配置4 结语0 写在前面 机器学习强基计划聚焦深度和广度&#xff0c;加深对机器学习模型的理解与应用。“深”在详细推导算法模型背后的数学原理&a…...

计算机网络高频知识点

目录 一、http状态码 二、浏览器怎么数据缓存 三、强缓存与协商缓存 1、强缓存 2、协商缓存 四、简单请求与复杂请求 五、PUT 请求类型 六、GET请求类型 七、GET 和 POST 的区别 八、跨域 1、什么时候会跨域 2、解决方式 九、计算机网络的七层协议与五层协议分别指…...

谈谈前端性能优化-面试版

前言 当我们去面试的时候&#xff0c;很大概率会被面试官问这么一个问题&#xff1a;你有尝试过对项目做性能优化吗&#xff1f;或者你了解哪些性能优化的方法&#xff1f;听到这个问题的你可能是这样的&#xff1a; 似曾相识但又说不清楚&#xff0c;往往只能零散地说出那么几…...

JAVA连接数据库——JDBC的简单使用

JDBC即Java数据库连接.用来实现Java程序对数据库增删查改。 为了对接Java程序和数据库&#xff0c;java.sql提供了很多api包含在java.sql和javax.sql里面 结构: DriverManager接口: 每一个数据库的驱动程序都必须去到DriverManager注册&#xff0c;生成一个Connection Conn…...

Pandas数据查询

Pandas数据查询 Pandas查询数据的几种方法 df.loc方法&#xff0c;根据行、列的标签值查询 df.iloc方法&#xff0c;根据行、列的数字位置查询 df.where方法 df.query方法 .loc既能查询&#xff0c;又能覆盖写入&#xff0c;强烈推荐&#xff01; Pandas使用df.loc查询数据…...

NLP-统计词频之处理停用词

前言 本文是该专栏的第1篇,后面会持续分享NLP的各种干货知识,值得关注。 一般来说,自然语言处理(NLP)就是开发能够理解人类语言的应用程序或者应用服务。 举个例子,如Facebook News Feed这种社交网站推送,它的算法知道你的兴趣是自然语言处理,就会推送相关的广告或者…...

sort 定制排序规则(配合functools.cmp_to_key())

sort 定制排序规则&#xff08;配合functools.cmp_to_key()&#xff09; 配合例题学习 题目链接&#xff1a;179. 最大数 题目大意&#xff1a;给定一组非负整数 nums&#xff0c;重新排列每个数的顺序&#xff08;每个数不可拆分&#xff09;使之组成一个最大的整数。 注意&a…...

【华为OD机试模拟题】用 C++ 实现 - 内存池(2023.Q1)

最近更新的博客 【华为OD机试模拟题】用 C++ 实现 - 去重求和(2023.Q1) 文章目录 最近更新的博客使用说明内存池题目输入输出示例一输入输出说明Code使用说明 参加华为od机试,一定要注意不要完全背诵代码,需要理解之后模仿写出,通过率才会高。 华为 OD 清单查看地址:…...

Python--深入浅出的装饰器--1

本章一起深入浅出一下装饰器。前面我们讲过一章装饰器了。不知道各位看懂了多少。每太看懂也没关系&#xff0c;本章就一起实操一下。简单的例子例1例2上述的两个例子&#xff0c;执行结果为&#xff1a;1423.为什么呢&#xff1f;&#xff1f;&#xff1f;解析语法糖&#xff…...

如何从0创建Spring Cloud Alibaba(多模块)

以一个父工程带两个Module&#xff08;test1、test2&#xff09;为例。 一、创建父工程 由于是模块化项目&#xff0c;那么父工程不需要实际的代码逻辑&#xff0c;因此无需创建src&#xff0c;那么可以有几种方式创建&#xff0c;例如&#xff1a; 使用Spring Initializr脚…...

KubeSphere 容器平台高可用:环境搭建与可视化操作指南

Linux_k8s篇 欢迎来到Linux的世界&#xff0c;看笔记好好学多敲多打&#xff0c;每个人都是大神&#xff01; 题目&#xff1a;KubeSphere 容器平台高可用&#xff1a;环境搭建与可视化操作指南 版本号: 1.0,0 作者: 老王要学习 日期: 2025.06.05 适用环境: Ubuntu22 文档说…...

手游刚开服就被攻击怎么办?如何防御DDoS?

开服初期是手游最脆弱的阶段&#xff0c;极易成为DDoS攻击的目标。一旦遭遇攻击&#xff0c;可能导致服务器瘫痪、玩家流失&#xff0c;甚至造成巨大经济损失。本文为开发者提供一套简洁有效的应急与防御方案&#xff0c;帮助快速应对并构建长期防护体系。 一、遭遇攻击的紧急应…...

spring:实例工厂方法获取bean

spring处理使用静态工厂方法获取bean实例&#xff0c;也可以通过实例工厂方法获取bean实例。 实例工厂方法步骤如下&#xff1a; 定义实例工厂类&#xff08;Java代码&#xff09;&#xff0c;定义实例工厂&#xff08;xml&#xff09;&#xff0c;定义调用实例工厂&#xff…...

vulnyx Blogger writeup

信息收集 arp-scan nmap 获取userFlag 上web看看 一个默认的页面&#xff0c;gobuster扫一下目录 可以看到扫出的目录中得到了一个有价值的目录/wordpress&#xff0c;说明目标所使用的cms是wordpress&#xff0c;访问http://192.168.43.213/wordpress/然后查看源码能看到 这…...

Java求职者面试指南:Spring、Spring Boot、Spring MVC与MyBatis技术解析

Java求职者面试指南&#xff1a;Spring、Spring Boot、Spring MVC与MyBatis技术解析 一、第一轮基础概念问题 1. Spring框架的核心容器是什么&#xff1f;它的作用是什么&#xff1f; Spring框架的核心容器是IoC&#xff08;控制反转&#xff09;容器。它的主要作用是管理对…...

Python训练营-Day26-函数专题1:函数定义与参数

题目1&#xff1a;计算圆的面积 任务&#xff1a; 编写一个名为 calculate_circle_area 的函数&#xff0c;该函数接收圆的半径 radius 作为参数&#xff0c;并返回圆的面积。圆的面积 π * radius (可以使用 math.pi 作为 π 的值)要求&#xff1a;函数接收一个位置参数 radi…...

智能职业发展系统:AI驱动的职业规划平台技术解析

智能职业发展系统&#xff1a;AI驱动的职业规划平台技术解析 引言&#xff1a;数字时代的职业革命 在当今瞬息万变的就业市场中&#xff0c;传统的职业规划方法已无法满足个人和企业的需求。据统计&#xff0c;全球每年有超过2亿人面临职业转型困境&#xff0c;而企业也因此遭…...

前端开发者常用网站

Can I use网站&#xff1a;一个查询网页技术兼容性的网站 一个查询网页技术兼容性的网站Can I use&#xff1a;Can I use... Support tables for HTML5, CSS3, etc (查询浏览器对HTML5的支持情况) 权威网站&#xff1a;MDN JavaScript权威网站&#xff1a;JavaScript | MDN...

验证redis数据结构

一、功能验证 1.验证redis的数据结构&#xff08;如字符串、列表、哈希、集合、有序集合等&#xff09;是否按照预期工作。 2、常见的数据结构验证方法&#xff1a; ①字符串&#xff08;string&#xff09; 测试基本操作 set、get、incr、decr 验证字符串的长度和内容是否正…...

python可视化:俄乌战争时间线关键节点与深层原因

俄乌战争时间线可视化分析&#xff1a;关键节点与深层原因 俄乌战争是21世纪欧洲最具影响力的地缘政治冲突之一&#xff0c;自2022年2月爆发以来已持续超过3年。 本文将通过Python可视化工具&#xff0c;系统分析这场战争的时间线、关键节点及其背后的深层原因&#xff0c;全面…...