深圳上市公司网站建设公司/不知怎么入门
文章目录
- Available Plugins
- 开源项目中的使用
- 插件介绍
- maven-jar-plugin
- maven-assembly-plugin
- maven-shade-plugin
- Shade 插件 - 标签
- artifactSet
- relocations
- filters
- 完整配置

Available Plugins
https://maven.apache.org/plugins/index.html
Maven 是一个开源的软件构建工具,它支持多种插件,用于帮助开发人员更方便地管理构建过程中所需的各种资源。以下是一些常用的 Maven 插件:
- Maven-clean-plugin:用于清除项目目录中的垃圾文件和临时文件。
- Maven-compile-plugin:用于编译项目源代码,生成目标代码。
- Maven-dependency-plugin:用于管理项目依赖关系,可以自动下载依赖库,并解决依赖冲突。
- Maven-jar-plugin:用于打包项目,生成 JAR 文件。
- Maven-javadoc-plugin:用于生成项目 Javadoc 文档。
- Maven-install-plugin:用于安装项目依赖库,可以将依赖库安装到本地仓库中。
- Maven-deploy-plugin:用于部署项目,可以将项目打包成可执行的包,并上传到远程仓库中。
- Maven-site-plugin:用于生成项目网站,可以自动生成 HTML 文档,并上传到远程仓库中。
- Maven-scm-plugin:用于管理项目版本,可以与版本控制系统集成,实现代码的版本控制。
- Maven-release-plugin:用于发布项目,可以将项目打包成可执行的包,并上传到远程仓库中,同时发布版本更新信息。
这些插件可以帮助开发人员更方便地管理构建过程中所需的各种资源,提高软件构建的效率和质量。
开源项目中的使用
我们来看下nacos这个开源项目的plugin是如何使用的。 不得不说还是非常丰富的 。
<!-- =========================================================Build plugins================================================ --><!-- == --><build><plugins><plugin><groupId>org.codehaus.mojo</groupId><artifactId>versions-maven-plugin</artifactId><version>${versions-maven-plugin.version}</version></plugin><plugin><groupId>com.github.vongosling</groupId><artifactId>dependency-mediator-maven-plugin</artifactId><version>${dependency-mediator-maven-plugin.version}</version></plugin><plugin><groupId>org.codehaus.mojo</groupId><artifactId>clirr-maven-plugin</artifactId><version>${clirr-maven-plugin.version}</version></plugin><plugin><artifactId>maven-enforcer-plugin</artifactId><version>${maven-enforcer-plugin.version}</version><executions><execution><id>enforce-ban-circular-dependencies</id><goals><goal>enforce</goal></goals></execution></executions><configuration><rules><banCircularDependencies/></rules><fail>true</fail></configuration><dependencies><dependency><groupId>org.codehaus.mojo</groupId><artifactId>extra-enforcer-rules</artifactId><version>${extra-enforcer-rules.version}</version></dependency></dependencies></plugin><plugin><artifactId>maven-compiler-plugin</artifactId><version>${maven-compiler-plugin.version}</version><configuration><source>${maven.compiler.source}</source><target>${maven.compiler.target}</target><compilerVersion>${maven.compiler.source}</compilerVersion><showDeprecation>true</showDeprecation><showWarnings>true</showWarnings></configuration></plugin><plugin><artifactId>maven-javadoc-plugin</artifactId><version>${maven-javadoc-plugin.version}</version><configuration><charset>UTF-8</charset></configuration><executions><execution><id>attach-javadocs</id><goals><goal>jar</goal></goals></execution></executions></plugin><plugin><artifactId>maven-source-plugin</artifactId><version>${maven-source-plugin.version}</version><executions><execution><id>attach-sources</id><goals><goal>jar</goal></goals></execution></executions></plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-pmd-plugin</artifactId><version>${maven-pmd-plugin.version}</version><configuration><rulesets><ruleset>rulesets/java/ali-comment.xml</ruleset><ruleset>rulesets/java/ali-concurrent.xml</ruleset><ruleset>rulesets/java/ali-constant.xml</ruleset><ruleset>rulesets/java/ali-exception.xml</ruleset><ruleset>rulesets/java/ali-flowcontrol.xml</ruleset><ruleset>rulesets/java/ali-naming.xml</ruleset><ruleset>rulesets/java/ali-oop.xml</ruleset><ruleset>rulesets/java/ali-orm.xml</ruleset><ruleset>rulesets/java/ali-other.xml</ruleset><ruleset>rulesets/java/ali-set.xml</ruleset></rulesets><printFailingErrors>true</printFailingErrors><excludes><exclude>**/consistency/entity/*.java</exclude><exclude>**/istio/model/mcp/*.java</exclude><exclude>**/istio/model/naming/*.java</exclude><exclude>**/istio/model/*.java</exclude><exclude>**/api/grpc/auto/*.java</exclude><exclude>**/istio/mcp/**</exclude><exclude>**/istio/networking/**</exclude><exclude>**/google/protobuf/**</exclude></excludes></configuration><executions><execution><goals><goal>check</goal></goals></execution></executions><dependencies><dependency><groupId>com.alibaba.p3c</groupId><artifactId>p3c-pmd</artifactId><version>${p3c-pmd.version}</version></dependency></dependencies></plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-checkstyle-plugin</artifactId><version>${maven-checkstyle-plugin.version}</version><configuration><configLocation>style/NacosCheckStyle.xml</configLocation><includeTestSourceDirectory>true</includeTestSourceDirectory><encoding>UTF-8</encoding><consoleOutput>true</consoleOutput><failsOnError>true</failsOnError><excludes>**/consistency/entity/**,**/nacos/test/**,**/api/grpc/auto/**,**/istio/**,**/protobuf/**</excludes></configuration><executions><execution><id>validate</id><phase>validate</phase><goals><goal>check</goal></goals></execution></executions></plugin><plugin><groupId>org.apache.rat</groupId><artifactId>apache-rat-plugin</artifactId><version>${apache-rat-plugin.version}</version><configuration><excludes><exclude>.editorconfig</exclude><exclude>.travis.yml</exclude><exclude>CONTRIBUTING.md</exclude><exclude>CODE_OF_CONDUCT.md</exclude><exclude>CHANGELOG.md</exclude><exclude>style/codeStyle.md</exclude><exclude>REPORTING-BUGS.md</exclude><exclude>README.md</exclude><exclude>.github/**/*</exclude><exclude>doc/*</exclude><exclude>derby.log</exclude><exclude>logs/*</exclude><exclude>src/main/resources/static/**</exclude><exclude>**/istio/model/**</exclude><exclude>**/consistency/entity/**</exclude><exclude>**/*.txt</exclude><exclude>**/*.factories</exclude><exclude>/console-ui/**</exclude><exclude>**/gogo.proto</exclude><exclude>**/any.proto</exclude></excludes></configuration><executions><execution><phase>verify</phase><goals><goal>check</goal></goals></execution></executions></plugin><plugin><artifactId>maven-resources-plugin</artifactId><version>${maven-resources-plugin.version}</version><configuration><!-- We are not suppose to setup the customer resources here --><encoding>${project.build.sourceEncoding}</encoding></configuration></plugin><plugin><groupId>org.eluder.coveralls</groupId><artifactId>coveralls-maven-plugin</artifactId><version>${coveralls-maven-plugin.version}</version></plugin><plugin><groupId>org.jacoco</groupId><artifactId>jacoco-maven-plugin</artifactId><version>${jacoco-maven-plugin.version}</version><executions><execution><id>default-prepare-agent</id><goals><goal>prepare-agent</goal></goals><configuration><destFile>${project.build.directory}/jacoco.exec</destFile></configuration></execution><execution><id>default-prepare-agent-integration</id><phase>pre-integration-test</phase><goals><goal>prepare-agent-integration</goal></goals><configuration><destFile>${project.build.directory}/jacoco-it.exec</destFile><propertyName>failsafeArgLine</propertyName></configuration></execution><execution><id>default-report</id><goals><goal>report</goal></goals></execution><execution><id>default-report-integration</id><goals><goal>report-integration</goal></goals></execution></executions></plugin><plugin><artifactId>maven-surefire-plugin</artifactId><version>${maven-surefire-plugin.version}</version></plugin><plugin><groupId>org.codehaus.mojo</groupId><artifactId>findbugs-maven-plugin</artifactId><version>${findbugs-maven-plugin.version}</version></plugin><plugin><groupId>org.sonarsource.scanner.maven</groupId><artifactId>sonar-maven-plugin</artifactId><version>${sonar-maven-plugin.version}</version></plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-assembly-plugin</artifactId><version>${maven-assembly-plugin.version}</version></plugin><plugin><groupId>org.codehaus.mojo</groupId><artifactId>flatten-maven-plugin</artifactId><version>${maven-flatten-version}</version><configuration><updatePomFile>true</updatePomFile><flattenMode>resolveCiFriendliesOnly</flattenMode><pomElements><dependencies>expand</dependencies></pomElements></configuration><executions><execution><id>flatten</id><phase>process-resources</phase><goals><goal>flatten</goal></goals></execution><execution><id>flatten.clean</id><phase>clean</phase><goals><goal>clean</goal></goals></execution></executions></plugin></plugins></build>
插件介绍
maven-jar-plugin
https://maven.apache.org/plugins/maven-jar-plugin/
maven-jar-plugin 是 Maven 的一个插件,用于创建 JAR 文件。它可以将项目的源代码、依赖项和配置文件打包成一个 JAR 文件,以便在应用程序中使用。该插件使用 Apache Maven 的默认构建系统,因此可以使用 Maven 的所有功能,如依赖项管理、构建脚本等。
使用 maven-jar-plugin 的主要优点是可以轻松地创建 JAR 文件,而不必手动编写 Ant 脚本或使用其他工具。此外,该插件还支持一些高级功能,如资源过滤、代码混淆和 Javadoc 文档生成等。这些功能可以使 JAR 文件更加强大和易于使用。
maven-jar-plugin 通常与 Maven 的其他插件一起使用,如 maven-compiler-plugin 和 maven-resources-plugin,以构建复杂的应用程序。例如,可以使用 maven-jar-plugin 将编译后的源代码打包成 JAR 文件,并使用 maven-resources-plugin 将资源文件打包成 JAR 文件。
这些插件可以一起使用,以构建具有各种功能和依赖项的应用程序。
假设我们要创建一个名为my-project
的 JAR 文件,其中包含项目中的源代码、依赖项和一些资源文件。我们可以使用 maven-jar-plugin 来完成这个任务。以下是一个具体的使用案例:
- 首先,在 Maven 项目中添加 maven-jar-plugin 插件。在
pom.xml
文件中的<build>
标签内添加以下内容:
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>3.2</version> <executions> <execution> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> </plugins>
</build>
- 配置
maven-jar-plugin
的参数。在<execution>
标签内,我们可以添加以下内容:
<execution> <goals> <goal>jar</goal> </goals> <configuration> <artifactId>my-project</artifactId> <version>1.0</version> <includes> <include>src/main/java/**</include> <include>src/main/resources/**</include> </includes> </configuration>
</execution>
在这个例子中,我们设置了artifactId
为my-project
,version
为1.0
。此外,我们还指定了要包含的源代码和资源文件的路径。
- 执行 Maven 构建。在项目根目录下运行以下命令:
mvn clean package
这将清理项目目录并构建 JAR 文件。
- 查看生成的 JAR 文件。在
target
目录下,你应该会看到生成的my-project-1.0.jar
文件。
通过这个案例,我们已经成功地使用 maven-jar-plugin 创建了一个 JAR 文件,其中包含项目的源代码和资源文件。这个例子展示了如何简单地使用 maven-jar-plugin 来打包 Maven 项目。在实际项目中,你可能还需要配置其他参数以满足不同的需求。
看个 nacos的类似的配置
这段代码是在pom.xml
中的<build>
标签内添加了一个maven-jar-plugin
插件的配置。以下是各个部分的解释:
<plugin>
:开始定义一个插件。<artifactId>maven-jar-plugin</artifactId>:指定插件的 artifactId 为
maven-jar-plugin`。<configuration>
:开始定义插件的配置。<archive>
:开始定义归档(archive)配置。<manifest>
:开始定义 manifest 配置。<addDefaultImplementationEntries>true</addDefaultImplementationEntries>:设置为
true以在 manifest 中添加默认实现入口。这将告诉 Java 运行时使用指定的类(通常是
main` 类)作为应用程序的入口点。<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>:设置为
true以在 manifest 中添加默认规范入口。这将告诉 Java 运行时使用指定的类(通常是
main` 类)作为应用程序的入口点,同时还会添加一些额外的规范信息。- :结束 manifest 配置。
- :结束归档(archive)配置。
- :结束插件的配置。
- :结束插件的定义。
这个插件配置的主要目的是设置 JAR 文件的 manifest,以便在运行时使用指定的类作为应用程序的入口点。通过添加默认实现入口和默认规范入口,可以确保应用程序能够正确地运行并提供一些额外的规范信息。这通常用于创建可执行 JAR 文件,其中包含应用程序的主类。
再看个类似的配置
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.3.1</version> <configuration> <archive> <manifest> <mainClass>com.artisan.MyTest</mainClass> <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries><addDefaultImplementationEntries>true</addDefaultImplementationEntries> </manifest><!-- 配置额外属性信息 --><manifestEntries> <Plugin-Id>demo-plugin</Plugin-Id> <Plugin-Version>1.0.0</Plugin-Version> </manifestEntries> </archive> </configuration>
</plugin>
在之前的工程 POM 文件中添加上述构建插件重新进行打包,可以看到 MANIFEST.MF 文件中即添加了我们配置的额外属性。
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: great
Build-Jdk: 1.8.0_202
# Specification entries
Specification-Title: maven-v1
Specification-Version: 1.0-SNAPSHOT
# Implementation entries
Implementation-Title: maven-v1
Implementation-Version: 1.0-SNAPSHOT
Implementation-Vendor-Id: com.artisan
# Manifest
Main-Class: com.artisan.MyTest
# ManifestEntries
Plugin-Id: demo-plugin
Plugin-Version: 1.0.0
maven-assembly-plugin
https://maven.apache.org/plugins/maven-assembly-plugin/
https://maven.apache.org/plugins/maven-assembly-plugin/examples/index.html
在普通 Maven 工程打包时默认仅会编译工程中新建的 java 文件并存储其 .class 文件,对于 POM 文件中引用的第三方依赖并不会一同打包。
如新建一个 Maven 工程并在依赖中导入 Jackson 依赖库并进行打包编译,可以看到下图编译后的 JAR 文件中只有工程中新建的 MyTest.class 文件,项目中所导入的依赖并没有被一起打包 .
而通过 assembly 插件即可将 POM 配置中的所有依赖一同打包编译至 JAR 文件中。
其中 execution 标签定义了 assembly 插件的作用阶段,如这里设置了在 Maven package 即打包阶段生效
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <version>3.1.0</version> <configuration> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> <!-- Set jar file name --><finalName>${project.artifactId}-${project.version}-all</finalName> <appendAssemblyId>false</appendAssemblyId> <attach>false</attach> <archive> <manifest> <mainClass>fully.qualified.MainClass</mainClass> <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries><addDefaultImplementationEntries>true</addDefaultImplementationEntries> </manifest> </archive> </configuration> <executions> <execution> <!-- Set effect phase --><id>make-assembly</id> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions>
</plugin>
在工程 POM 配置中添加上述信息并重新编译打包工程,可以看到此时 JAR 文件中除了自定义创建的 MyTest.clss 文件外同时包含了依赖的第三方库。
另外一个Demo : Creating fat JARs using the Maven Assembly plugin
- Go to the pom.xml file and make sure the main application class is specified:
<properties><main.class>com.example.ApplicationKt</main.class>
</properties>
- If you use EngineMain without the explicit main function, the application’s main class depends on the used engine and might look as follows: io.ktor.server.netty.EngineMain.
Add maven-assembly-plugin to the plugins block as follows:
<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-assembly-plugin</artifactId><version>2.6</version><configuration><descriptorRefs><descriptorRef>jar-with-dependencies</descriptorRef></descriptorRefs><archive><manifest><addClasspath>true</addClasspath><mainClass>${main.class}</mainClass></manifest></archive></configuration><executions><execution><id>assemble-all</id><phase>package</phase><goals><goal>single</goal></goals></execution></executions>
</plugin>
- Build an assembly
To build an assembly for the application, open the terminal and execute the following command:
mvn package
When this build completes, you should see the tutorial-server-get-started-maven-0.0.1-jar-with-dependencies.jar file in the target directory.
- Run the application
To run the built application:
Open the terminal and execute the following command to run the application:
java -jar target/tutorial-server-get-started-maven-0.0.1-jar-with-dependencies.jar
Wait until the following message is shown:
[main] INFO Application - Responding at http://0.0.0.0:8080
You can click the link to open the application in a default browser:
maven-shade-plugin
https://maven.apache.org/plugins/maven-shade-plugin/
Shade 插件的功能更为强大,其提供了两个功能:
-
第一个即与 assembly 类似可实现依赖的打包编译,与 assembly 不同的是 Shade 提供了更灵活的执行策略,可指定需要打包编译的依赖集合。
-
另一个即实现包的重命名功能,我们都知道 Maven 并不允许在一共工程中同时引入单个依赖的不同版本,而通过 Shade 插件即可实现二次包装从而绕开该限制。
Shade 插件 - 标签
下面介绍一下 Shade 插件中各标签的使用。
artifactSet
通过 includes 标签可以指定需要一同打包编译的第三方依赖。
定义的格式为:groupId:artifactId。
<artifactSet> <includes> <include>groupId:artifactId</include> </includes>
</artifactSet>
relocations
通过 relocations 标签即可实现模块的重命名功能。
其中 pattern 为需要重命名的模块包, shadedPattern 为重命名后的模块名。
<relocations> <relocation> <pattern>old.package.name</pattern> <shadedPattern>new.package.name</shadedPattern> </relocation>
</relocations>
filters
通过 filters 标签可以实现非必要文件的排除,如常见的协议文件等,可通过文件名或类型实现匹配。
<filters> <filter> <artifact>*:*</artifact> <excludes> <exclude>filename</exclude> <exclude>file pattern</exclude> </excludes> </filter>
</filters>
完整配置
Shade 同样可以通过 execution 设置作用阶段,上述介绍标签的完整配置内容如下:
<plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>3.2.0</version> <executions> <!-- Working phase --> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> </execution> </executions> <configuration> <minimizeJar>true</minimizeJar> <!-- Defined what dependencies to pull into the uber JAR --> <artifactSet> <includes> <include>com.fasterxml.jackson.core:jackson-core</include> </includes> </artifactSet> <!-- Rename the package --> <relocations> <relocation> <!-- Old name --> <pattern>com.fasterxml.jackson.core</pattern> <!-- New name --> <shadedPattern>com.ibudai.fasterxml.jackson.core</shadedPattern> </relocation> </relocations> <!-- Exclude the file that didn't want --> <filters> <filter> <artifact>*:*</artifact> <excludes> <exclude>META-INF/license/**</exclude> <exclude>META-INF/*</exclude> <exclude>LICENSE</exclude> <exclude>NOTICE</exclude> </excludes> </filter> </filters> </configuration> </plugin>
</plugins>
在之前的工程中添加上述配置并重新打包,可以看到编译后的 Jackson 模块包层级已经变成我们自定义的内容,而 Java 的类加载即通过类的完成限定名(包名+类名)来区分是否为同一个类,因此通过 Shade 插件即可实现 Maven 的单一工程多版本引入。
官方文档
https://maven.apache.org/plugins/maven-shade-plugin/examples/class-relocation.html
相关文章:

Maven - 统一构建规范:Maven 插件管理最佳实践
文章目录 Available Plugins开源项目中的使用插件介绍maven-jar-pluginmaven-assembly-pluginmaven-shade-pluginShade 插件 - 标签artifactSetrelocationsfilters 完整配置 Available Plugins https://maven.apache.org/plugins/index.html Maven 是一个开源的软件构建工具&…...

对接海康明眸门禁设备-删除人员信息
对接海康明眸门禁设备-删除人员信息 文中登录 退出登录 长连接和海康hCNetSDK等接口 见文章 初始SDK和登录 /*** 删除人脸 IotCommDataResult 自定义类 收集结果*/Overridepublic List<IotCommDataResult> deleteFace(IotCameraParam camera, Collection<Long> us…...

LEADTOOLS Imaging SDK Crack
LEADTOOLS Imaging SDK Crack 高级开发人员工具包包括ActiveX和WPF/XAML控件。 LEADTOOLS Imaging SDK为文件格式导入/导出、图像压缩、图像显示和效果、颜色转换、图像处理、TWAIN扫描、图像通用对话框、数据库集成、打印和互联网提供了基本和高级的彩色图像功能。 LEADTOOLS …...

2023并发之八股文——面试题
基础知识 并发编程的优缺点为什么要使用并发编程(并发编程的优点) 充分利用多核CPU的计算能力:通过并发编程的形式可以将多核CPU 的计算能力发挥到极致,性能得到提升方便进行业务拆分,提升系统并发能力和性能&#x…...

操作记录日志保存设计实现
定义一个切面类 @Aspect @Slf4j @Component @RequiredArgsConstructor public class OperateLogAopConfig {private final ISysOperateLogService sysOperateLogService;@Around("@annotation(operateLog)")public Object operateLog(ProceedingJoinPoint point, Op…...

PL 侧驱动和fpga 重加载的方法
可以解决很多的问题 时钟稳定后加载特定fpga ip (要不内核崩的一塌糊涂)fpga 稳定复位软件决定fpga ip 加载的时序 dluash load /usr/local/scripts/si5512_setup.lua usleep 30 mkdir -p /lib/firmware cp -rf /usr/local/firmare/{*.bit.bin,*.dtbo} …...

【2023最新爬虫】用python爬取知乎任意问题下的全部回答
老规矩,先上结果: 爬取了前200多页,每页5条数据,共1000多条回答。(程序设置的自动判断结束页,我是手动break的) 共爬到13个字段,包含: 问题id,页码,答主昵称,答主性别,…...

Bingchat和ChatGPT主要区别
Bing Chat由chatgpt GPT-4技术提供支持,这是流行的ChatGPT的最新语言模型。Bing Chat通过更具交互性和上下文联动的响应来优化搜索引擎。它允许用户提出问题并获得更人性化、精确化或创造力的答案。用户还可以在答案末尾查看的参考来源。该工具可以充当个人研究、计…...

Docker容器:docker镜像的创建及dockerfile
Docker容器:docker镜像的创建及dockerfile案例 一.docker镜像的三种创建方法 创建镜像有三种方法:基于现有镜像创建、基于本地模板创建及基于dockerfile创建 1.基于现有镜像创建 1.1 启动镜像 #首先启动一个镜像,在容器里做修改 docker …...

Vue3 父子组件数据传递
1、父组件向子组件传递数据 1.1、传递多个简单变量给到子组件 父组件使用 <TitleView title"标题" :name"name" :isCollect"isCollect" collect-event"collectEvent" /><script setup>const name ref(名字)const isCol…...

Eureka:集群环境配置
创建三个集群 导包 <!-- 导包--><dependencies><!-- Eureka -server --><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-eureka-server</artifactId><version>1.…...

springboot之多数据源配置
文章目录 一、多数据源的典型使用场景1 业务复杂(数据量大)2 读写分离 二、如何实现多数据源通过AbstractRoutingDataSource动态指定数据源多数据源切换方式AOPMyBatis插件 三、spring集成多个Mybatis框架 实现多数据源控制四、dynamic-datasource 多数据…...

无涯教程-PHP - 静态变量函数
静态变量 静态变量在函数退出时值不会丢失,您只需将关键字STATIC放在变量名称的前面,即可将变量声明为静态变量。 <?phpfunction keep_track() {STATIC $count0;$count;print $count;print "<br />";}keep_track();keep_track();keep_track(); ?> 这…...

2023-08-20力扣今日二题
链接: 1312. 让字符串成为回文串的最少插入次数 题意: 如题 解: 动态规划,枚举回文串中点并递增回文串长度 初始状态若LR则单个字符为中点,需要添加0个字符成为回文串;若L1R则如果S[L]S[R]则需要添加…...

【地理专题】2023年最新全国A级景区数
数据来源:中国文化和旅游部时间跨度:2023年区域范围:全国范围数据字段: 景区名称;地址;等级;城市;经度;纬度 该图基于自然资源部地图技术审查中心标准地图服务网站下载…...

Elasticsearch实战(一):Springboot实现Elasticsearch统一检索功能
文章目录 系列文章索引一、准备工作1、搭建docker环境2、安装eskibana3、es安装ik分词器(1)下载安装(2)测试 4、Springboot(1)引包(2)客户端公共方法(3)公共实…...

更改计算机睡眠时间
控制面板–>系统和安全–>电源选项下的更改计算机睡眠时间 如果关闭显示器时间小于使计算机进入睡眠状态时间,时间先到达关闭显示器时间,显示器关闭,这时电脑还在正常工作状态。如果此时敲击键盘显示器出现画面,无需输入密…...

Matplotlib数据可视化(一)
目录 1.Matplotlib简介 2.Matplotlib绘图基础 2.1 创建画布与子图 2.2 添加画布属性 2.3 绘图的保存与显示 1.Matplotlib简介 Matplotlib是一个用于绘制数据可视化图表的Python库。它提供了广泛的功能和灵活性,可以创建各种类型的图表,包括折线图、…...

LLM提示词工程和提示词工程师Prompting and prompt engineering
你输入模型的文本被称为提示,生成文本的行为被称为推断,输出文本被称为完成。用于提示的文本或可用的内存的全部量被称为上下文窗口。尽管这里的示例显示模型表现良好,但你经常会遇到模型在第一次尝试时无法产生你想要的结果的情况。你可能需…...

Python开发环境(Visual Studio Code、Anaconda、PyInstaller、Enigma Virtual Box)
Python开发环境 [Anaconda、PyInstaller、Enigma Virtual Box] AnacondaAnaconda安装搭建Python环境Anaconda命令 Visual Studio CodeVisual Studio Code中Python设置Visual Studio Code中使用Qt Designer Python打包发布.exe可执行文件PyinstallerEnigma Virtual Box Anaconda…...

Unreal Engine 测试总结
Android 项目打包应选择哪种纹理格式?打包模式区别? 根据官网文档介绍,建议使用 ETC2:所有OpenGL 3.x 类型的设备都支持,并且支持alpha压缩 打包模式包括:内部测试阶段的开发模式,对外发布的发行…...

Air780EG —— 合宙4G定位解决方案
定位模式: 外部单片机控制模式(常见于AT固件客户): 开机 -> 搜星 -> 定位成功 -> 上报 -> 关机 780E自行控制模式(常见于二次开发客户,AT用户也可以使用): 开机 -> 搜星 -> 定位成功 -> 模块休眠,关闭GP…...

【算法刷题之数组篇(2)】
目录 1.leetcode-35. 搜索插入位置(简单)2.leetcode-74. 搜索二维矩阵(中等)3.leetcode-73. 矩阵置零(中等)4.leetcode-56. 合并区间(中等)5.leetcode-54. 螺旋矩阵(中等…...

chromedriver.exe 的所有版本下载地址
Chrome for Testing availability 上面的网址是V115 v116.... 以上的。 CNPM Binaries Mirror 上面这个是V115版本以下的。 这个文章没有任何实际价值,记录的原因是因为突然发现过去的py无法运行,原因是chrome浏览器偷偷升级到V115,于是找…...

C++ 网络编程项目fastDFS分布式文件系统(四)-fastCGI项目相关技术以及linux搜狗输入法相关问题。
目录 1. Nginx作为web服务器处理请求 2. http协议复习 Get方式提交数据 Post方式提交数据 3. fastCGI 3.1 CGI 3.2 fastCGI 3.3 fastCGI和spawn-fcgi安装 1. 安装fastCGI 2. 安装spawn-fcgi 3.4 nginx && fastcgi 4其他知识点 1. fastCGI环境变量 - fas…...

【HarmonyOS】服务卡片 API6 JSUI跳转不同页面
【引言】 “JS卡片支持为组件设置action,包括router事件和message事件,其中router事件用于应用跳。若设置router事件,则action属性值为"router";abilityName为卡片提供方应用的跳转目标Ability名;params中的…...

【linux】debian10安装vim
debian10.0上用apt vim安装vim提示依赖的版本冲突。后来发现是软件源没有添加更新源buster-updates。 以下是问答。 问:debian10怎么安装vim? 答: 在 Debian 10 系统上安装 Vim 的方法很简单,主要有以下两种: 1. 使用 apt 命令安装 bash sudo apt u…...

文件同步工具rsync
文章目录 作用特性安装命令服务端启动增加安全认证及免密登录 实时推送源服务器配置结合inotify实现实时推送 参数详解 学些过程中遇到的问题 作用 rsync是linux系统下的数据镜像备份工具。使用快速增量备份工具Remote Sync可以远程同步,支持本地复制,或…...

【嵌入式开发 Linux 常用命令系列 12 -- linux 下 log 输出重定向 详细介绍 】
文章目录 Linux 输出重定向使用背景Linux 重定向使用介绍 上篇文章:嵌入式开发 Linux 常用命令系列 11 – linux 下 任务与CPU绑定命令 taskset 详细介绍 Linux 输出重定向使用背景 在Linux中,输入和输出重定向是非常常见的操作,它们可以用…...

gin中关于参数注入问题
关于参数注入的问题 如果在开发中一旦发小参数没有按照既定的要求注入到结构体的话,这个时候就一定要看请求方式什么?如果是post请求、 前端—post—json{id:1,pageSize:10,page:1}———————————- 参数注入方法:ShouldBindJSON p…...