构建系统maven
1 前言
说真的,我是真的不想看构建了,因为真的太多了。又多又乱。Maven、Gradle、Make、CMake、Meson、Ninja,Android BP。。。感觉学不完,根本学不完。。。
但是没办法最近又要用一下Maven,所以咬着牙再简单整理一下。
安装:
sudo apt update
sudo apt install maven
mvn -v
功能:
功能 | 说明 |
---|---|
📦 依赖管理 | 自动下载并管理第三方 JAR 包 |
🔨 项目构建 | 编译 Java、打包成 JAR/WAR 等 |
📁 项目结构标准化 | 统一目录结构,便于协作 |
🔁 生命周期管理 | 统一管理编译、测试、打包、部署流程 |
📜 插件系统 | 可通过插件扩展(如编译器、测试、部署) |
核心就是POM(Project Object Model),一个XML配置文件。然后maven工具读取这个xml,根据上面的配置进行处理。
maven有三个生命周期
clean生命周期: clean
|
default生命周期: validate → compile → test → package → verify → install → deploy
|
site生命周期:site→ site-deploy 生成文档部署文档
所以典型命令是:
mvn clean package
这个命令就是首先清理之前的构建,再进行新的打包。
三个周期中最重要的是default周期,命令如下:
阶段(Phase) | 作用 |
---|---|
compile | 编译源码 |
test | 编译并运行单元测试 |
package | 打包(生成 JAR/WAR) |
install | 安装到本地仓库 |
deploy | 部署到远程仓库 |
2 POM.XML的配置
下面是典型的配置
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><!-- 项目信息 --><groupId>com.example</groupId><artifactId>demo-project</artifactId><version>1.0.0</version><packaging>jar</packaging> <!-- 可选:jar / war / pom --><name>Demo Project</name><description>这是一个示例 Maven 项目</description><url>http://www.example.com</url><!-- Java版本控制 --><properties><maven.compiler.source>1.8</maven.compiler.source><maven.compiler.target>1.8</maven.compiler.target></properties><!-- 依赖 --><dependencies><dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId><version>5.3.30</version></dependency></dependencies><!-- 插件 --><build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>3.11.0</version><configuration><source>${maven.compiler.source}</source><target>${maven.compiler.target}</target></configuration></plugin></plugins></build></project>
常用配置如下:
区块 | 用途 |
---|---|
<groupId> | 项目的组织标识,一般为域名倒写,如:com.company.project |
<artifactId> | 项目的模块名,是打包后的文件名 |
<version> | 项目的版本号,如 1.0.0-SNAPSHOT |
<packaging> | 打包类型(如:jar 、war 、pom ) |
<dependencies> | 项目的所有依赖库 |
<build> | 构建相关配置(插件、目标目录等) |
<repositories> | 添加第三方仓库(如果 Maven 中央仓库没有你要的包) |
<profiles> | 配置多种构建环境(例如 dev/test/prod) |
<properties> | 定义全局属性,便于统一管理,比如 Java 版本、编码等 |
依赖:
<dependencies><dependency><groupId>org.slf4j</groupId><artifactId>slf4j-api</artifactId><version>2.0.9</version></dependency>
</dependencies>
子项 | 说明 |
---|---|
<scope> | 依赖作用范围(compile , test , provided , runtime ) |
<optional> | 是否为可选依赖 |
<exclusions> | 排除传递性依赖 |
构建
<build><sourceDirectory>src/main/java</sourceDirectory><resources><resource><directory>src/main/resources</directory></resource></resources><plugins><!-- 编译插件 --><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>3.11.0</version><configuration><source>1.8</source><target>1.8</target></configuration></plugin></plugins>
</build>
插件名 | 作用 |
---|---|
maven-jar-plugin | 生成 JAR 包 |
maven-surefire-plugin | 执行单元测试 |
maven-assembly-plugin | 打包为带依赖的 JAR/ZIP |
maven-site-plugin | 生成项目文档 |
构建
<build><sourceDirectory>src/main/java</sourceDirectory><resources><resource><directory>src/main/resources</directory></resource></resources><plugins><!-- 编译插件 --><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>3.11.0</version><configuration><source>1.8</source><target>1.8</target></configuration></plugin></plugins>
</build>
插件名 | 作用 |
---|---|
maven-jar-plugin | 生成 JAR 包 |
maven-surefire-plugin | 执行单元测试 |
maven-assembly-plugin | 打包为带依赖的 JAR/ZIP |
maven-site-plugin | 生成项目文档 |
属性
<properties><java.version>17</java.version><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
仓库配置
<repositories><repository><id>aliyun-central</id><url>https://maven.aliyun.com/repository/central</url></repository>
</repositories>
构建环境
<profiles><profile><id>dev</id><properties><env>development</env></properties></profile><profile><id>prod</id><properties><env>production</env></properties></profile>
</profiles>
mvn clean install -P dev
3 一些实际例子
3.1 Hello
代码结构:
helloworld/
├── pom.xml
└── src/
└── main/
└── java/
└── com/example/
└── App.java
pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>com.example</groupId><artifactId>helloworld</artifactId><version>1.0-SNAPSHOT</version><packaging>jar</packaging><name>HelloWorld</name><build><plugins><!-- 编译和运行入口 --><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>3.11.0</version><configuration><source>17</source><target>17</target></configuration></plugin></plugins></build>
</project>
App.java
package com.example;public class App {public static void main(String[] args) {System.out.println("Hello, Maven!");}
}
编译打包命令是mvn package
从log可以看出,maven自动下载的内容真的非常多。
ubuntu@VM-8-10-ubuntu:~/java$ mvn package
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------------< com.example:helloworld >-----------------------
[INFO] Building HelloWorld 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.6/maven-resources-plugin-2.6.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.6/maven-resources-plugin-2.6.pom (8.1 kB at 2.7 kB/s)...Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.5.0/plexus-utils-3.5.0.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compiler-api/2.13.0/plexus-compiler-api-2.13.0.jar (27 kB at 4.9 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compiler-manager/2.13.0/plexus-compiler-manager-2.13.0.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compiler-manager/2.13.0/plexus-compiler-manager-2.13.0.jar (4.7 kB at 735 B/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compiler-javac/2.13.0/plexus-compiler-javac-2.13.0.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compiler-javac/2.13.0/plexus-compiler-javac-2.13.0.jar (23 kB at 2.4 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/commons-io/commons-io/2.6/commons-io-2.6.jar (215 kB at 21 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.5.0/plexus-utils-3.5.0.jar (267 kB at 16 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/org/ow2/asm/asm/9.4/asm-9.4.jar (122 kB at 6.3 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/com/thoughtworks/qdox/qdox/2.0.3/qdox-2.0.3.jar (334 kB at 13 kB/s)
[INFO] Changes detected - recompiling the module! :source
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 1 source file with javac [debug target 17] to target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ helloworld ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/ubuntu/java/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.11.0:testCompile (default-testCompile) @ helloworld ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ helloworld ---
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-plugin-api/2.0.9/maven-plugin-api-2.0.9.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-plugin-api/2.0.9/maven-plugin-api-2.0.9.pom (1.5 kB at 3.9 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven/2.0.9/maven-2.0.9.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven/2.0.9/maven-2.0.9.pom (19 kB at 14 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-parent/8/maven-parent-8.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-parent/8/maven-parent-8.pom (24 kB at 9.8 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/apache/4/apache-4.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/apache/4/apache-4.pom (4.5 kB at 1.7 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-booter/2.12.4/surefire-booter-2.12.4.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-booter/2.12.4/surefire-booter-2.12.4.pom (3.0 kB at 2.4 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-api/2.12.4/surefire-api-2.12.4.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-api/2.12.4/surefire-api-2.12.4.pom (2.5 kB at 2.8 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/maven-surefire-common/2.12.4/maven-surefire-common-2.12.4.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/maven-surefire-common/2.12.4/maven-surefire-common-2.12.4.pom (5.5 kB at 4.8 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugin-tools/maven-plugin-annotations/3.1/maven-plugin-annotations-3.1.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugin-tools/maven-plugin-annotations/3.1/maven-plugin-annotations-3.1.pom (1.6 kB at 2.1 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugin-tools/maven-plugin-tools/3.1/maven-plugin-tools-3.1.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugin-tools/maven-plugin-tools/3.1/maven-plugin-tools-3.1.pom (16 kB at 8.4 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-artifact/2.0.9/maven-artifact-2.0.9.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-artifact/2.0.9/maven-artifact-2.0.9.pom (1.6 kB at 4.3 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0.8/plexus-utils-3.0.8.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0.8/plexus-utils-3.0.8.pom (3.1 kB at 4.3 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus/3.2/plexus-3.2.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus/3.2/plexus-3.2.pom (19 kB at 16 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/sonatype/spice/spice-parent/17/spice-parent-17.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/sonatype/spice/spice-parent/17/spice-parent-17.pom (6.8 kB at 11 kB/s)...Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-archiver/2.1/plexus-archiver-2.1.jar (184 kB at 19 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0/plexus-utils-3.0.jar (226 kB at 15 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/commons-lang/commons-lang/2.1/commons-lang-2.1.jar (208 kB at 9.8 kB/s)
[INFO] Building jar: /home/ubuntu/java/target/helloworld-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 04:17 min
[INFO] Finished at: 2025-06-01T22:14:24+08:00
[INFO] ------------------------------------------------------------------------
编译完成之后直接用java运行即可。
ubuntu@VM-8-10-ubuntu:~/java$ java -cp target/helloworld-1.0-SNAPSHOT.jar com.example.App
Hello, Maven!
3.2 添加第三方依赖(如 Gson)
在pom.xml中增加,并且指示编译成fat jar
<project xmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>com.example</groupId><artifactId>helloworld</artifactId><version>1.0-SNAPSHOT</version><packaging>jar</packaging><name>HelloWorld</name><dependencies><dependency><groupId>com.google.code.gson</groupId><artifactId>gson</artifactId><version>2.10.1</version></dependency></dependencies><build><plugins><!-- Java 编译器插件 --><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>3.11.0</version><configuration><source>17</source><target>17</target></configuration></plugin><!-- 打包为 fat jar --><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-shade-plugin</artifactId><version>3.5.0</version><executions><execution><phase>package</phase><goals><goal>shade</goal></goals><configuration><transformers><transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"><mainClass>com.example.App</mainClass></transformer></transformers></configuration></execution></executions></plugin></plugins></build>
</project>
修改代码App.java
package com.example;
import com.google.gson.Gson;public class App {public static void main(String[] args) {Gson gson = new Gson();String json = gson.toJson(new int[]{1, 2, 3});System.out.println(json); // 输出:[1,2,3]}
}
之后编译时会自动下载新的依赖。
buntu@VM-8-10-ubuntu:~/java$ mvn package
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------------< com.example:helloworld >-----------------------
[INFO] Building HelloWorld 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from central: https://repo.maven.apache.org/maven2/com/google/code/gson/gson/2.10.1/gson-2.10.1.pom
Downloaded from central: https://repo.maven.apache.org/maven2/com/google/code/gson/gson/2.10.1/gson-2.10.1.pom (9.4 kB at 1.0 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/com/google/code/gson/gson-parent/2.10.1/gson-parent-2.10.1.pom
Downloaded from central: https://repo.maven.apache.org/maven2/com/google/code/gson/gson-parent/2.10.1/gson-parent-2.10.1.pom (13 kB at 5.2 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/com/google/code/gson/gson/2.10.1/gson-2.10.1.jar
Downloaded from central: https://repo.maven.apache.org/maven2/com/google/code/gson/gson/2.10.1/gson-2.10.1.jar (283 kB at 10.0 kB/s)
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ helloworld ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/ubuntu/java/src/main/resources
运行:
ubuntu@VM-8-10-ubuntu:~/java$ java -cp target/helloworld-1.0-SNAPSHOT.jar com.example.App
[1,2,3]
3.3 多POM
项目结构:
myproject/
├── pom.xml <-- 父项目
├── module-a/
│ └── pom.xml
└── module-b/
└── pom.xml
父pom.xml
<modules><module>module-a</module><module>module-b</module>
</modules>
4 对比
最后列一下这一堆构建工具的对比。
特性/工具 | Maven | Gradle | Make | CMake | Meson | Ninja |
---|---|---|---|---|---|---|
🔧 主要用于语言 | Java, Kotlin | Java, Kotlin, Groovy | C/C++、Fortran | C/C++、CUDA | C/C++、Python、Rust 等 | C/C++(需搭配生成器) |
⚙️ 配置方式 | XML | Groovy/Kotlin DSL | 手写 Makefile | CMakeLists.txt(专有语法) | meson.build(Python-like) | .ninja (自动生成) |
📦 依赖管理 | ✅ 内置依赖管理(Maven Central) | ✅ 更灵活支持 Maven/Gradle 仓库 | ❌ 无内置 | ❌ 无,依赖手动或外部工具 | 🔄 可接入 wrapdb、pkg-config | ❌ 无 |
🚀 性能 | 较慢(XML解析、顺序执行) | 快(增量构建、多线程) | 慢(无并行、无依赖缓存) | 中等(生成效率好,构建慢) | 快(配合 Ninja 后端) | 极快(专注高效执行) |
🔁 增量构建 | 支持(但较粗) | ✅ 高级支持(内建缓存) | ❌ 无内建 | ❌ 无内建 | ✅ 支持 | ✅ 由生成器控制 |
🧱 多模块支持 | ✅ 优秀 | ✅ 优秀 | ❌ 需手动 | ✅ 通过 add_subdirectory | ✅ 支持 | ❌ 不支持 |
🔌 插件/扩展 | ✅ 丰富插件系统 | ✅ 插件和自定义 Task 多 | ❌ 无插件 | ✅ 一些模块 | 少量内建模块 | ❌ 无插件系统 |
📚 文档与社区 | 📘 成熟,企业多 | 📘 成熟,现代项目多 | 📙 历史悠久 | 📘 主流开源工具使用 | 📘 新兴,GN、Gnome 使用 | 📙 少,偏底层 |
📈 学习曲线 | 中(XML配置略繁琐) | 中高(DSL强大但复杂) | 低(语法简单) | 中(语法非标准) | 低-中(简洁清晰) | 低(但手动写复杂) |
🧩 常用场景 | Java EE、Spring Boot 项目 | Android、Kotlin、Java 项目 | Linux 内核、小项目 | Qt、Vulkan、LLVM 项目 | GNOME、系统包项目 | Chromium、LLVM 构建后端 |
选用指南
你是… | 推荐工具 | 理由 |
---|---|---|
Java 开发者 | Maven 或 Gradle | Java 生态标准构建工具 |
Android 开发者 | Gradle | Android Studio 默认工具,支持 DSL |
C/C++ 项目开发者 | CMake + Ninja | 广泛支持 IDE,效率高 |
嵌入式或 Linux 驱动开发者 | Make | 简洁、可控,资源占用少 |
现代 C/C++ 工程、GNOME/GTK | Meson + Ninja | 更快、更现代的构建系统 |
要最高性能的构建执行 | Ninja | 超快速构建执行器(需搭配生成器使用) |
相关文章:

构建系统maven
1 前言 说真的,我是真的不想看构建了,因为真的太多了。又多又乱。Maven、Gradle、Make、CMake、Meson、Ninja,Android BP。。。感觉学不完,根本学不完。。。 但是没办法最近又要用一下Maven,所以咬着牙再简单整理一下…...

day13 leetcode-hot100-23(链表2)
206. 反转链表 - 力扣(LeetCode) 1.迭代 思路 这个题目很简单,最主要的就是了解链表的数据结构。 链表由多个节点构成,每个节点包括值与指针,其中指针指向下一个节点(单链表)。 方法就是将指…...
Java面试八股(Java基础,Spring,SpringBoot篇)
java基础 JDK,JRE,JVMJava语言的特点Java常见的运行时异常Java为什么要封装自增自减的隐式转换移位运算符1. 左移运算符(<<)2. 带符号右移运算符(>>)3. 无符号右移运算符(>>>) 可变…...
Python编程基础(二)| 列表简介
引言:很久没有写 Python 了,有一点生疏。这是学习《Python 编程:从入门到实践(第3版)》的课后练习记录,主要目的是快速回顾基础知识。 练习1: 姓名 将一些朋友的姓名存储在一个列表中…...
支持向量机(SVM):解锁数据分类与回归的强大工具
在机器学习的世界中,支持向量机(Support Vector Machine,简称 SVM)一直以其强大的分类和回归能力而备受关注。本文将深入探讨 SVM 的核心功能,以及它如何在各种实际问题中发挥作用。 一、SVM 是什么? 支持…...

代谢组数据分析(二十五):代谢组与蛋白质组数据分析的异同
禁止商业或二改转载,仅供自学使用,侵权必究,如需截取部分内容请后台联系作者! 文章目录 介绍蛋白质组定义与基因的关系蛋白质组学(Proteomics)检测技术蛋白质的鉴定与定量分析蛋白质“鉴定”怎么做蛋白质“定量”怎么做蛋白质鉴定与定量对比应用领域代谢组定义代谢组学(M…...

002 flutter基础 初始文件讲解(1)
在学习flutter的时候,要有“万物皆widget”的思想,这样有利于你的学习,话不多说,开始今天的学习 1.创建文件 进入trae后,按住ctrlshiftP,输入Flutter:New Project,回车,…...
AI 让无人机跟踪更精准——从视觉感知到智能预测
AI 让无人机跟踪更精准——从视觉感知到智能预测 无人机跟踪技术正在经历一场前所未有的变革。曾经,我们只能依靠 GPS 或简单的视觉识别来跟踪无人机,但如今,人工智能(AI)结合深度学习和高级视觉算法,正让无人机的跟踪变得更加智能化、精准化。 尤其是在自动驾驶、安防监…...

Launcher3体系化之路
👋 欢迎来到Launcher 3 背景 车企对于桌面的排版布局好像没有手机那般复杂,但也有一定的需求。部分场景下,要考虑的上下文比手机要多一些,比如有如下的一些场景: 手车互联。HiCar,CarPlay,An…...

用wireshark抓了个TCP通讯的包
昨儿个整理了下怎么用wireshark抓包,链接在这里:捋捋wireshark 今天打算抓个TCP通讯的包试试,整体来说比较有收获,给大家汇报一下。 首先就是如何搞到可以用来演示TCP通讯的客户端、服务端,问了下deepseek,…...

VR/AR 显示瓶颈将破!铁电液晶技术迎来关键突破
在 VR/AR 设备逐渐走进大众生活的今天,显示效果却始终是制约其发展的一大痛点。纱窗效应、画面拖影、眩晕感…… 传统液晶技术的瓶颈让用户体验大打折扣。不过,随着铁电液晶技术的重大突破,这一局面有望得到彻底改变。 一、传统液晶技术瓶颈…...
【前端】Vue中实现pdf逐页转图片,图片再逐张提取文字
给定场景:后端无法实现pdf转文字,由前端实现“pdf先转图片再转文字”。 方法: 假设我们在< template>中有一个元素存放我们处理过的canvas集合 <div id"canvasIDpdfs" />我们给定一个按钮,编写click函数&…...
焦虑而烦躁的上午
半年了,每逢周末或者节假日都被催着去医院。 今天早上依旧,还在睡梦之中,就被喊醒“赶紧得,抢上儿童医院的票了!” 无奈,从床上爬起来,草草用过早餐之后,奔赴儿童医院!…...

Python使用
Python学习,从安装,到简单应用 前言 Python作为胶水语言在web开发,数据分析,网络爬虫等方向有着广泛的应用 一、Python入门 相关基础语法直接使用相关测试代码 Python编译器版本使用3以后,安装参考其他教程…...

分类预测 | Matlab实现CNN-LSTM-Attention高光谱数据分类
分类预测 | Matlab实现CNN-LSTM-Attention高光谱数据分类 目录 分类预测 | Matlab实现CNN-LSTM-Attention高光谱数据分类分类效果功能概述程序设计参考资料 分类效果 功能概述 代码功能 该MATLAB代码实现了一个结合CNN、LSTM和注意力机制的高光谱数据分类模型,核心…...

【解决方案-RAGFlow】RAGFlow显示Task is queued、 Microsoft Visual C++ 14.0 or greater is required.
目录 一、长时间显示:Task is queued 二、GraphRAG消耗大量Token 三、error: Microsoft Visual C 14.0 or greater is required. Get it with “Microsoft C Build Tools“ 四、ModuleNotFoundError: No module named infinity.common; infinity is not a package 五…...

爬虫到智能数据分析:Bright Data × Kimi 智能洞察亚马逊电商产品销售潜力
前言 电商数据分析在现代商业中具有重要的战略价值,通过对消费者行为、销售趋势、商品价格、库存等数据的深入分析,企业能够获得对市场动态的精准洞察,优化运营决策,预测市场趋势、优化广告投放、提升供应链效率,并通…...

高级前端工程师必备的 JS 设计模式入门教程,常用设计模式案例分享
目录 高级前端工程师必备的 JS 设计模式入门教程,常用设计模式案例分享 一、什么是设计模式?为什么前端也要学? 1、设计模式是什么 2、设计模式的产出 二、设计模式在 JS 里的分类 三、常用设计模式实战讲解 1、单例模式(S…...
unix/linux source 命令,其发展历程详细时间线、由来、历史背景
追本溯源,探究技术的历史背景和发展脉络,能够帮助我们更深刻地理解其设计哲学和存在的意义。source 命令(或者说它的前身和等效形式)的历史,与 Unix Shell 本身的发展紧密相连。 让我们一起踏上这段追溯之旅,探索 source 命令的由来和发展历程。 早期 Unix Shell 与命令…...

2023年电赛C题——电感电容测量装置
一、赛题 二、题目分析——损耗角正切值 对于一个正常的正弦波信号,如果通过的是一个电阻或一条导线,那么它的电流信号和电压信号是一致的(有电压才有电流),没有相位差。 但是如果正弦波经过了一个电感或电容…...

pycharm打印时不换行,方便对比观察
原来: 优化: import torch torch.set_printoptions(linewidth200) 优化结果:...

因泰立科技:镭眸T51激光雷达,打造智能门控新生态
在高端门控行业,安全与效率是永恒的追求。如今,随着科技的飞速发展,激光雷达与TOF相机技术的融合,为门控系统带来了前所未有的智能感知能力,开启了精准守护的新时代。因泰立科技的镭眸T51激光雷达,作为这一…...

Microsoft Fabric - 尝试一下Data Factory一些新的特性(2025年5月)
1.简单介绍 Microsoft Fabric是微软提供的一个数据管理和分析的统一平台,感觉最近的新特性也挺多的。 Data Factory是Microsoft Fabric的一个功能模块,也是一个cloud service。Data Factory可以和多种数据源进行连接,同时提供了data movemen…...
NodeJS全栈开发面试题讲解——P10微服务架构(Node.js + 多服务协作)
✅ 10.1 单体架构和微服务的主要区别是什么? 维度单体架构微服务架构模块组织所有功能打包在一个代码仓库中拆分为多个独立服务部署方式部署一次包含全部逻辑各服务独立部署、独立扩缩容开发协作多人协作易冲突团队按服务划分,职责清晰可维护性功能多时…...

【前端】javascript和Vue面试八股
面试暂时没有遇到过考这么深的,一般还是问一些生命周期和性能相关。 Q:什么情况下“ a 1 && a 2 && a 3 ”同时成立 A:对象的valueOf与toString方法:当一个对象与一个原始值(如数字)进…...

WEB3——区块链留言板(留言上链),查看web3日志-入门项目推荐
区块链留言板(留言上链) 目标:构建一个用户可以“写入留言、读取历史留言”的 DApp。 内容: Solidity 编写留言合约,存储留言内容和发送者地址。 提供 API: GET /messages:获取留言列表 POST…...
开源库免费API服务平台 ALLBEAPI
开源库API化平台 ALLBEAPI 🌊 GitHub仓库地址:https://github.com/TingjiaInFuture/allbeapi 为优秀开源库提供免费 API 服务,让开发者无需安装和部署即可直接调用。 🌐 API 接入地址 基础 URL: https://res.allbeapi.top 所…...

【配置vscode默认终端为git bash】
配置vscode默认终端为git bash 点击左下角小齿轮,点击设置,搜索terminal.integrated.profiles.windows,点击在setting.json中编辑 第一部分是当前的所有的终端,第二部分是配置默认的终端"terminal.integrated.defaultProfi…...
Cloudflare
Cloudflare 是一个网络基础设施和网站安全服务提供商,它的主要作用是让网站 更快、更安全、更可靠。简单来说,它是一个“护盾 加速器”。 🧩 Cloudflare 的主要功能: 1. 🚀 加速网站访问(CDN)…...

Cypress + TypeScript + Vue3
🚀 从零构建 Cypress + TypeScript + Vue3 组件测试环境【详细实战教程】 组件测试是前端开发中不可忽视的一环,它能够帮助我们在开发阶段就发现 UI 与交互逻辑问题。本文将带你手把手搭建基于 Cypress + TypeScript + Vue3 的组件测试环境,包含完整目录结构、配置文件、组…...