構建系統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 一些實際例子

2.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!

2.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]

2.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>

3 對比

最后列一下這一堆構建工具的對比。

特性/工具MavenGradleMakeCMakeMesonNinja
🔧 主要用于語言Java, KotlinJava, Kotlin, GroovyC/C++、FortranC/C++、CUDAC/C++、Python、Rust 等C/C++(需搭配生成器)
?? 配置方式XMLGroovy/Kotlin DSL手寫 MakefileCMakeLists.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 或 GradleJava 生態標準構建工具
Android 開發者GradleAndroid Studio 默認工具,支持 DSL
C/C++ 項目開發者CMake + Ninja廣泛支持 IDE,效率高
嵌入式或 Linux 驅動開發者Make簡潔、可控,資源占用少
現代 C/C++ 工程、GNOME/GTKMeson + Ninja更快、更現代的構建系統
要最高性能的構建執行Ninja超快速構建執行器(需搭配生成器使用)

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/pingmian/83180.shtml
繁體地址,請注明出處:http://hk.pswp.cn/pingmian/83180.shtml
英文地址,請注明出處:http://en.pswp.cn/pingmian/83180.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

UE5藍圖暴露變量,在游戲運行時修改變量實時變化、看向目標跟隨目標Find Look at Rotation、修改玩家自身彈簧臂

UE5藍圖中暴露變量&#xff0c;類似Unity中public一個變量&#xff0c;在游戲運行時修改變量實時變化 1&#xff0c;添加變量 2&#xff0c;設置變量的值 3&#xff0c;點開小眼睛&#xff0c;此變量顯示在編輯器中&#xff0c;可以運行時修改 看向目標跟隨目標Find Look at R…

proteus美觀與偏好設置

本文主要講&#xff1a; 1 快捷鍵修改&#xff08;復制&#xff0c;粘貼&#xff0c;原件旋轉&#xff09; 2 背景顏色替換 3 模塊分區 一 快捷鍵的設置 設置復制粘貼和旋轉三個 這里只是強調一下要分配 二 背景顏色 原來的背景顏色&#xff1a; 之后的背景顏色&#xff1a;…

Arm處理器調試采用jlink硬件調試器的命令使用大全

arm處理器分為cortex-a&#xff0c;cortex-r&#xff0c;cortex-m等3個內核系列&#xff0c;其中m系列一般是單片機&#xff0c;例如stm32等&#xff0c;工控用得挺多。a系列一般是消費娛樂產品等使用較多&#xff0c;例如手機處理器。r系列是高端實時類型處理器&#xff0c;價…

如何將圖像插入 PDF:最佳工具比較

無論您是編輯營銷材料、寫報告還是改寫原來的PDF文件&#xff0c;將圖像插入 PDF 都至關重要。幸運的是&#xff0c;有多種在線和離線工具可以簡化此任務。在本文中&#xff0c;我們將比較一些常用的 PDF 添加圖像工具&#xff0c;并根據您的使用場景推薦最佳解決方案&#xff…

4、獲取樹莓派溫度

打開終端&#xff0c;使用指令查看CPU溫度&#xff0c;依次輸入以下指令&#xff1a; 1.進入操作目錄 cd /sys/class/thermal/thermal_zone0 2.查看溫度 cat temp 樹莓派的返回值 51540 返回值除以1000為當前CPU溫度值。即當前溫度為51攝氏度。

Leetcode 269. 火星詞典

1.題目基本信息 1.1.題目描述 現有一種使用英語字母的外星文語言&#xff0c;這門語言的字母順序與英語順序不同。 給定一個字符串列表 words &#xff0c;作為這門語言的詞典&#xff0c;words 中的字符串已經 按這門新語言的字母順序進行了排序 。 請你根據該詞典還原出此…

使用vscode進行c/c++開發的時候,輸出報錯亂碼、cpp文件本身亂碼的問題解決

使用vscode進行c/c開發的時候&#xff0c;輸出報錯亂碼、cpp文件本身亂碼的問題解決 問題描述解決方案問題1的解決方案問題2解決方案 問題描述 本篇文章解決兩個問題&#xff1a; 1.當cpp文件出現錯誤的時候&#xff0c;編譯時報錯&#xff0c;但是報錯內容缺是亂碼&#xff0…

現代數據湖架構全景解析:存儲、表格式、計算引擎與元數據服務的協同生態

本文全面剖析現代數據湖架構的核心組件,深入探討對象存儲(OSS/S3)、表格式(Iceberg/Hudi/Delta Lake)、計算引擎(Spark/Flink/Presto)及元數據服務(HMS/Amoro)的協作關系,并提供企業級選型指南。 一、數據湖架構演進與核心價值 數據湖架構演進歷程 現代數據湖核心價…

主數據編碼體系全景解析:從基礎到高級的編碼策略全指南

在數字化轉型的浪潮中&#xff0c;主數據管理&#xff08;MDM&#xff09;已成為企業數字化轉型的基石。而主數據編碼作為MDM的核心環節&#xff0c;其設計質量直接關系到數據管理的效率、系統的可擴展性以及業務決策的準確性。本文將系統性地探討主數據編碼的七大核心策略&…

Mac電腦上本地安裝 MySQL并配置開啟自啟完整流程

文章目錄 一、mysql安裝1.1 使用 Homebrew 安裝&#xff08;推薦&#xff09;1.2 手動下載 MySQL 社區版1.3 常見問題1.4 圖形化管理工具&#xff08;可選&#xff09; 二、Mac 上配置 MySQL 開機自動啟動2.1 使用 launchd 系統服務&#xff08;原生支持&#xff09;2.2 通過 H…

SQL Server 事務詳解:概念、特性、隔離級別與實踐

一、事務的基本概念 事務&#xff08;Transaction&#xff09;是數據庫操作的基本單位&#xff0c;它是由一組SQL語句組成的邏輯工作單元。事務具有以下關鍵特性&#xff0c;通常被稱為ACID特性&#xff1a; ??原子性&#xff08;Atomicity&#xff09;??&#xff1a;事務…

【C語言極簡自學筆記】項目開發——掃雷游戲

一、項目概述 1.項目背景 掃雷是一款經典的益智游戲&#xff0c;由于它簡單而富有挑戰性的玩法深受人們喜愛。在 C 語言學習過程中&#xff0c;開發掃雷游戲是一個非常合適的實踐項目&#xff0c;它能夠綜合運用 C 語言的多種基礎知識&#xff0c;如數組、函數、循環、條件判…

unix/linux source 命令,其發展歷程詳細時間線、由來、歷史背景

追本溯源,探究技術的歷史背景和發展脈絡,能夠幫助我們更深刻地理解其設計哲學和存在的意義。source 命令(或者說它的前身和等效形式)的歷史,與 Unix Shell 本身的發展緊密相連。 讓我們一起踏上這段追溯之旅,探索 source 命令的由來和發展歷程。 早期 Unix Shell 與命令…

720全景展示:VR全景的技術原理及應用

VR720全景展示&#xff1a;技術原理及應用探索 720全景技術&#xff0c;作為當前全球范圍內迅速崛起流行的視覺新技術&#xff0c;為用戶帶來了全新的真實現場感和交互式的體驗。憑借全方位、無死角的視覺展示特性&#xff0c;在VR&#xff08;虛擬現實&#xff09;領域中得到…

Python爬蟲實戰:研究Requests-HTML庫相關技術

1. 引言 1.1 研究背景與意義 隨著互聯網數據量的爆炸式增長,網絡爬蟲已成為數據獲取的重要工具,廣泛應用于市場調研、輿情分析、學術研究等領域。傳統爬蟲技術在面對現代 JavaScript 動態渲染網頁時面臨挑戰,而 Requests-HTML 庫通過集成瀏覽器渲染引擎,為解決這一問題提…

VectorStore 組件深入學習與檢索方法

考慮到目前市面上的向量數據庫眾多&#xff0c;每個數據庫的操作方式也無統一標準&#xff0c;但是仍然存在著一些公共特征&#xff0c;LangChain 基于這些通用的特征封裝了 VectorStore 基類&#xff0c;在這個基類下&#xff0c;可以將方法劃分成 6 種&#xff1a; 相似性搜…

【PyQt5】從零開始的PyQt5 - QLabel篇

從零開始的PyQt5 - QLabel篇 引言一、簡述二、例程2.1 顯示到QWidget窗口上2.2 重新設置Label大小和對齊方式2.3 添加內容&#xff0c;設置邊框2.4 顯示富文本 三、參考 引言 QLabel主要用于顯示文本或圖像&#xff0c;不提供用戶交互功能。本文主要簡述PyQt5中的QLabel以及展…

論文略讀:Uncertainty-Aware Graph Structure Learning

WWW 2025 1 intro 傳統GNN忽視了圖結構自身存在的缺陷: 圖結構常常會出現錯誤邊和缺失邊等數據問題&#xff0c;從而限制模型的效果 —>為了解決上述問題&#xff0c;產生了圖結構學習算法&#xff08;GSL&#xff09; 目的在于優化結點連接和邊權重來生成新的鄰接矩陣主流…

HCIE-STP復習

文章目錄 STP STP &#x1f3e1;作者主頁&#xff1a;點擊&#xff01; &#x1f916;Datacom專欄&#xff1a;點擊&#xff01; ??創作時間&#xff1a;2025年05月31日13點17STP通過三要素選舉消除環路&#xff1a; 根橋&#xff08;BID最小&#xff0c;建議設優先級為0&…

leetcode17.電話號碼的字母組合:字符串映射與回溯的巧妙聯動

一、題目深度解析與字符映射邏輯 題目描述 給定一個僅包含數字 2-9 的字符串 digits&#xff0c;返回所有它能表示的字母組合。數字與字母的映射關系如下&#xff08;與電話按鍵相同&#xff09;&#xff1a; 2: "abc", 3: "def", 4: "ghi", …