maven項目構建

Maven是apache的一個開源項目。是一個用來把源代碼構建成可發布的構件的工具。

Maven的功能非常強大,可以認為是一個項目管理工具,不僅僅是一個構建工具。

Maven本身的核心很小,但是可以在上面擴展出很多的插件。Mven采用的是插件的思想,通過插件的功能擴展出很多的功能。同時Maven采用約定大于配置的思想,在項目中采用了很多約定規則來減少配置。不想ant這樣的構建工具需要很多的配置。作為一個項目構建工具,最重要的是管理項目的庫和項目之間的依賴關系。

本文將以以下面的例子,來作為學習maven的一個過程。

假設要構建一個名為Content-Search的項目,該項目包含了三個子項目:contentSearch-dal,contentSearch-biz,contentSearch-web。項目采用Struts2、hibernate3、spring2.5的框架結合。使用mysql數據庫。

contentSearch-web:Web層的代碼, struts2+spring2.5結合的框架。

contentSearch-biz:業務邏輯層代碼。

contentSearch-dal:數據持久層代碼。

三個項目之間的依賴和對外部庫的依賴關系大概如下:

?

?

?

?

作為從一個項目構建工具角度出發,maven主要要實現的就是項目的依賴的二方、三方庫管理,項目之間的依賴管理。以及項目的整個生命周期的管理,包括編譯(compile)、測試(test)、打包(packaging)、部署(install)等。

以以上為背景,先介紹下maven的基本概念:

依賴管理:對每個項目對外部的依賴的管理。

遠程倉庫:maven外部引用倉庫的管理。

項目LifeCycle抽象和管理:項目生命周期編譯、測試和打包等過程的抽象和管理。

?

  1. 1.?Maven安裝

http://maven.apache.org/download.html在上面根據不同的操作系統選擇不同的安裝版本。

安裝后的目錄結構如下:

bin/:maven腳本

boot/

conf/:全局的settings.xml。?如果需要自己定制可以覆蓋.m2文件夾里的settings.xml文件。

lib/:有包含maven核心的jar文件

設置環境變量: M2_HOME=maven安裝路徑??Path: $M2_HOME/bin

?

?

  1. 2.?Maven核心概念

groupId , artifactId, packaging, version:——?以上4個是?Maven?的?坐?標(coordinates),它們唯一標識了一個項目。

groupId:?團體,公司,小組,組織,項目,或者其它團體。如contentSearch-web,contentSearch-dal,contentSearch-biz同屬一個groupId。

artifactId:在?groupId?下的表示一個單獨項目的唯一標識符。項目名稱ID?。

packaging:?標識項目的類型,如jar,war等。

Version:版本號。

以文章開頭的例子為例,contentSearch-web的坐標可以定義如下:

groupId: com.companyName.contentSearch

artifactId:contentSearch-web

packaging: war

Version:1.0。

而contentSearch-dal的坐標如下:

groupId: com.companyName.contentSearch

artifactId:contentSearch-dal

packaging: jar

Version:1.0。

在一個?Maven?倉庫中,所有的東西存儲在一個與?Maven?項目坐標十分匹配的目錄結構中。

/groupId/artifactId/version/artifactId-version.packaging.

?

POM:項目抽象模型

這是maven非常核心的概念。Maven通過它來管理項目。每一個項目都有一個pom.xml文件,該文件定義了改項目的基本信息,依賴關系等,maven對項目的生命周期管理也是基于此文件。以contentSearch-dal為例,該項目的pom.xml定義如下(關于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/maven-v4_0_0.xsd">

?????????<modelVersion>4.0.0</modelVersion>

?????????<parent>

???????????????????<groupId> com.companyName.contentSearch</groupId>

???????????????????<artifactId>contentSearch</artifactId>

???????????????????<version>1.0</version>

?????????</parent>

?????????<artifactId>contentSearch-dal</artifactId>

?????????<packaging>jar</packaging>

?????????<version>1.0</version>

?????????<name>contentSearch-dal</name>

?????????<url>http://maven.apache.org</url>

?????????<dependencies>

???????????????????<dependency>

????????????????????????????<groupId>junit</groupId>

????????????????????????????<artifactId>junit</artifactId>

????????????????????????????<version>3.8.1</version>

????????????????????????????<scope>test</scope>

???????????????????</dependency>

???????????????????<dependency>

????????????????????????????<groupId>generalorm</groupId>

????????????????????????????<artifactId>hibernate</artifactId>

????????????????????????????<version>3.0</version>

???????????????????</dependency>

???????????????????<dependency>

????????????????????????????<groupId>mysql</groupId>

????????????????????????????<artifactId>mysql-connector-java</artifactId>

????????????????????????????<version>5.1.6</version>

???????????????????</dependency>

???????????????????<dependency>

????????????????????????????<groupId>log4j</groupId>

????????????????????????????<artifactId>log4j</artifactId>

????????????????????????????<version>1.2.14</version>

???????????????????</dependency>

???????????????????<dependency>

????????????????????????????<groupId>dom4j</groupId>

????????????????????????????<artifactId>dom4j</artifactId>

????????????????????????????<version>1.6.1</version>

???????????????????</dependency>

???????????????????<dependency>

????????????????????????????<groupId>slf4j</groupId>

????????????????????????????<artifactId>slf4j-api</artifactId>

????????????????????????????<version>1.5.8</version>

???????????????????</dependency>

???????????????????<dependency>

????????????????????????????<groupId>slf4j</groupId>

????????????????????????????<artifactId>slf4j-nop</artifactId>

????????????????????????????<version>1.5.2</version>

???????????????????</dependency>

???????????????????<dependency>

????????????????????????????<groupId>antlr</groupId>

????????????????????????????<artifactId>antlr</artifactId>

????????????????????????????<version>2.7.6</version>

???????????????????</dependency>

???????????????????<dependency>

????????????????????????????<groupId>jta</groupId>

????????????????????????????<artifactId>jta</artifactId>

????????????????????????????<version>1.1</version>

???????????????????</dependency>

???????????????????<dependency>

????????????????????????????<groupId>javassist</groupId>

????????????????????????????<artifactId>javassist</artifactId>

????????????????????????????<version>3.9.0.GA</version>

???????????????????</dependency>

???????????????????<dependency>

????????????????????????????<groupId>commons-collections</groupId>

????????????????????????????<artifactId>commons-collections</artifactId>

????????????????????????????<version>3.1</version>

???????????????????</dependency>

?????????</dependencies>

</project>

Repository

倉庫,二方庫,三方庫的概念。每當安裝完成maven之后就會有一個默認的本地倉庫和遠程倉庫。本地倉庫在用戶工作目錄下的.m2文件夾,如在linux下為/home/yblin/.m2。遠程repository默認在settings.xml里面配置,如果要修改該文件必須在.m2文件夾下面替換一下即可。當進行編譯的時候,maven會先查找本地Repository,如果本地Repository沒有,會去取遠程repository?。

?

?

  1. 3.?Maven命令

創建一個項目:

mvn archetype:create -DgroupId=com.xxx.simple??- DartifactId =simple

archetype:create是一個goal,-DgroupId=org.sonatype.mavenbook.ch03代表要傳到目標goal任務的參數,以-D開頭。

插件和目標:maven archetype:create. Archetype是插件標識,create是目標標識。

一個?Maven?插件是一個單個或者多個目標的集合。Maven?插件的例子有一些簡單但核心的插件,像?Jar?插件,它包含了一組創建JAR?文件的目標,Compiler插件,它包含了一組編譯源代碼和測試代碼的目標,或者?Surefire?插件,它包含一組運行單元測試和生成測試報告的目標。而其它的,更有專門的插件包括:Hibernate3?插件,用來集成流行的持久化框架?Hibernate,JRuby?插件,它讓你能夠讓運行?ruby?稱為?Maven?構建的一部分或者用?Ruby?來編寫?Maven?插件。Maven也提供了自定義插件的能力。一個定制的插件可以用?Java?編寫,或者用一些其它的語言如?Ant,Groovy,beanshell?和之前提到的?Ruby。

?

生命周期命令:maven install

Mvn install命令沒有進行任何插件配置或者定制,所以這個例子綁定了一組標準插件的目標到默認的生命周期。當?Maven?經過以?package?為結尾的默認生命周期的時候,下面的目標按順序被執行:

resources:resources

??????Resources?插件的?resources?目標綁定到了?resources?階段。這個目標復

??????制?src/main/resources?下的所有資源和其它任何配置的資源目錄,到輸

??????出目錄。

compiler:compile

??????Compiler?插件的?compile?目標綁定到了?compile?階段。這個目標編譯

??????src/main/java?下的所有源代碼和其他任何配置的資源目錄,到輸出目

??????錄。

resources:testResources

??????Resources?插件的?testResources?目標綁定到了?test-resources?階段。

??????這個目標復制?src/test/resources?下的所有資源和其它任何的配置的測

??????試資源目錄,到測試輸出目錄。

compiler:testCompile

??????Compiler?插件的?testCompile?目標綁定到了?test-compile?階段。這個目

??????標編譯?src/test/java?下的測試用例和其它任何的配置的測試資源目錄,

??????到測試輸出目錄。

surefire:test

??????Surefire?插件的?test?目標綁定到了?test?階段。這個目標運行所有的測試

??????并且創建那些捕捉詳細測試結果的輸出文件。默認情況下,如果有測試失

??????敗,這個目標會終止。

jar:jar

??????Jar?插件的?jar?目標綁定到了?package?階段。這個目標把輸出目錄打包成

??????JAR?文件。

當?Maven?運行一個目標的時候,每個目標都會訪問定義在項目?POM?里的信息。

?

?

其他命令:

mvn install:install-file -DgeneratePom=true -DgroupId=jep -DartifactId=jep -Dversion=3.3.0 -Dpackaging=jar -Dfile=E:/lib/LIB_COMMON/jep-3.3.0-trial.jar:添加一個包到依賴庫。

mvn dependency:resolve??mvn dependency:tree瀏覽項目依賴。

mvn archetype:create?:創建?Maven?項目

mvn compile?:編譯源代碼

mvn test-compile?:編譯測試代碼

mvn test?:?運行應用程序中的單元測試

mvn site?:?生成項目相關信息的網站

mvn clean?:清除目標目錄中的生成結果

mvn package?:?依據項目生成?jar?文件

mvn install?:在本地?Repository?中安裝?jar

mvn eclipse:eclipse?:生成?Eclipse?項目文件

  1. 4.?Maven實踐

?

以文章開頭例子為例,做為實踐。

1.?下載依賴包,并添加到本地repository.如果配置了遠程依賴庫里面已經有了這些依賴包,那無需下載,在編譯時會自動下載到本地庫。

下載struts2,hibernate2,spring2.5,mysql-jdbc等相關的包到本地,通過命令安裝到本地repository.

mvn install:install-file -DgrouptId=framework -DartifactId=spring-beans -Dversion=2.5.6 -Dfile=spring-beans-2.5.6.jar

該命令將spring-beans-2.5.6.jar安裝到本地repository.

2.?創建總控項目

mvn archetype:create命令創建總控項目,修改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/maven-v4_0_0.xsd">

??<modelVersion>4.0.0</modelVersion>

??<groupId>?com.companyName.contentSearch?</groupId>

??<artifactId>contentSearch</artifactId>

??<packaging>pom</packaging>

??<version>1.0</version>

??<name>Chapter 6 Simple Parent Project</name>

??<modules>

????<module>contentSearch-dal</module>

????<module>contentSearch-biz</module>

????<module>contentSearch-web</module>

??</modules>

??<build>

????<pluginManagement>

??????<plugins>

????????<plugin>

??????????<groupId>org.apache.maven.plugins</groupId>

??????????<artifactId>maven-compiler-plugin</artifactId>

??????????<configuration>

????????????<source>1.5</source>

????????????<target>1.5</target>

??????????</configuration>

????????</plugin>

??????</plugins>

???</pluginManagement>

??</build>

??<dependencies>

????<dependency>

??????<groupId>junit</groupId>

??????<artifactId>junit</artifactId>

??????<version>3.8.1</version>

??????<scope>test</scope>

????</dependency>

??</dependencies>

</project>

3.?創建子項目

總控項目包括了三個子項目,在總控項目文件夾下面創建3個子項目如下:

contentSearch-dal:

<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/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

?

<parent>

?????<groupId>?com.companyName.contentSearch?</groupId>

?????<artifactId>contentSearch</artifactId>

?????<version>1.0</version>

</parent>

<artifactId>contentSearch-dal</artifactId>

<packaging>jar</packaging>

<version>1.0</version>

<name>contentSearch-dal</name>

<url>http://maven.apache.org</url>

<dependencies>

?????<dependency>

?????????<groupId>junit</groupId>

?????????<artifactId>junit</artifactId>

?????????<version>3.8.1</version>

?????????<scope>test</scope>

?????</dependency>

?????<dependency>

?????????<groupId>generalorm</groupId>

?????????<artifactId>hibernate</artifactId>

?????????<version>3.0</version>

?????</dependency>

?????<dependency>

?????????<groupId>mysql</groupId>

?????????<artifactId>mysql-connector-java</artifactId>

?????????<version>5.1.6</version>

?????</dependency>

?????<dependency>

?????????<groupId>log4j</groupId>

?????????<artifactId>log4j</artifactId>

?????????<version>1.2.14</version>

?????</dependency>

?????<dependency>

?????????<groupId>dom4j</groupId>

?????????<artifactId>dom4j</artifactId>

?????????<version>1.6.1</version>

?????</dependency>

?????<dependency>

?????????<groupId>slf4j</groupId>

?????????<artifactId>slf4j-api</artifactId>

?????????<version>1.5.8</version>

?????</dependency>

?????<dependency>

?????????<groupId>slf4j</groupId>

?????????<artifactId>slf4j-nop</artifactId>

?????????<version>1.5.2</version>

?????</dependency>

?????<dependency>

?????????<groupId>antlr</groupId>

?????????<artifactId>antlr</artifactId>

?????????<version>2.7.6</version>

?????</dependency>

?????<dependency>

?????????<groupId>jta</groupId>

?????????<artifactId>jta</artifactId>

?????????<version>1.1</version>

?????</dependency>

?????<dependency>

?????????<groupId>javassist</groupId>

?????????<artifactId>javassist</artifactId>

?????????<version>3.9.0.GA</version>

?????</dependency>

?????<dependency>

?????????<groupId>commons-collections</groupId>

?????????<artifactId>commons-collections</artifactId>

?????????<version>3.1</version>

?????</dependency>

</dependencies>

</project>

contentSearch-biz:

<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/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>

?????<groupId>?com.companyName.contentSearch</groupId>

?????<artifactId>contentSearch</artifactId>

?????<version>1.0</version>

</parent>

<artifactId>contentSearch-biz</artifactId>

<packaging>jar</packaging>

<version>1.0</version>

<name>contentSearch-biz</name>

<url>http://maven.apache.org</url>

<dependencies>

?????<dependency>

?????????<groupId>junit</groupId>

?????????<artifactId>junit</artifactId>

?????????<version>3.8.1</version>

?????????<scope>test</scope>

?????</dependency>

?????<dependency>

?????????<groupId>?com.companyName.contentSearch?</groupId>

?????????<artifactId>contentSearch-dal</artifactId>

?????????<version>1.0</version>

?????????<scope></scope>

?????</dependency>

?????<dependency>

?????????<groupId>com.sun</groupId>

?????????<artifactId>mail</artifactId>

?????????<version>1.4.3</version>

?????????<scope></scope>

?????</dependency>

?????<dependency>

?????????<groupId>com.sun</groupId>

?????????<artifactId>activation</artifactId>

?????????<version>1.1.1</version>

?????????<scope></scope>

?????</dependency>

</dependencies>

</project>

contentSearch-web:

<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/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>

?????<groupId>?com.companyName.contentSearch?</groupId>

?????<artifactId>contentSearch</artifactId>

?????<version>1.0</version>

</parent>

<artifactId>contentSearch-web</artifactId>

<packaging>war</packaging>

<version>1.0-SNAPSHOT</version>

<name>contentSearch-web Maven Webapp</name>

<url>http://maven.apache.org</url>

<dependencies>

?????<dependency>

?????????<groupId>apache.tomcat</groupId>

?????????<artifactId>servlet-api</artifactId>

?????????<version>2.5</version>

?????</dependency>

?????<dependency>

?????????<groupId>apache.commons</groupId>

?????????<artifactId>commons-fileupload</artifactId>

?????????<version>1.2.1</version>

?????</dependency>

?????<dependency>

?????????<groupId>commons-logging</groupId>

?????????<artifactId>commons-logging</artifactId>

?????????<version>1.0.4</version>

?????</dependency>

?????<dependency>

?????????<groupId>apache.tomcat</groupId>

?????????<artifactId>jsp-api</artifactId>

?????????<version>1.0</version>

?????</dependency>

?????<dependency>

?????????<groupId>junit</groupId>

?????????<artifactId>junit</artifactId>

?????????<version>3.8.1</version>

?????????<scope>test</scope>

?????</dependency>

?????<dependency>

?????????<groupId>framework</groupId>

?????????<artifactId>struts2-core</artifactId>

?????????<version>2.1.8</version>

?????</dependency>

?????<dependency>

?????????<groupId>framework</groupId>

?????????<artifactId>xwork-core</artifactId>

?????????<version>2.1.6</version>

?????</dependency>

?????<dependency>

?????????<groupId>framework</groupId>

?????????<artifactId>spring-core</artifactId>

?????????<version>2.5.6</version>

?????</dependency>

?????<dependency>

?????????<groupId>framework</groupId>

?????????<artifactId>spring-web</artifactId>

?????????<version>2.5.6</version>

?????</dependency>

?????<dependency>

?????????<groupId>framework</groupId>

?????????<artifactId>spring-context</artifactId>

?????????<version>2.5.6</version>

?????</dependency>

?????<dependency>

?????????<groupId>framework</groupId>

?????????<artifactId>spring-beans</artifactId>

?????????<version>2.5.6</version>

?????</dependency>

?????<dependency>

?????????<groupId>framework</groupId>

?????????<artifactId>freemarker</artifactId>

?????????<version>2.3.15</version>

?????</dependency>

?????<dependency>

?????????<groupId>framework</groupId>

?????????<artifactId>struts2-spring-plugin</artifactId>

?????????<version>2.1.8</version>

?????</dependency>

?????<dependency>

?????????<groupId>?com.companyName.contentSearch?</groupId>

?????????<artifactId>contentSearch-biz</artifactId>

?????????<version>1.0</version>

?????</dependency>

?????<dependency>

?????????<groupId>framework</groupId>

?????????<artifactId>struts2-json-plugin</artifactId>

?????????<version>2.1.8</version>

?????</dependency>

</dependencies>

<build>

?????<finalName>contentSearch-web</finalName>

?????<plugins>

?????????<plugin>

?????????????<groupId>org.mortbay.jetty</groupId>

?????????????<artifactId>maven-jetty-plugin</artifactId>

?????????????<version>6.1.9</version>

?????????</plugin>

?????</plugins>

</build>

</project>

4.?編寫代碼,打包運行。

mvn clean install

mvn jetty:run

以上只是從構建的角度介紹maven的使用,還有很多其他的特性待以后學習后再做介紹。作為一個優秀的構建工具,maven還是值得推薦的。

?

http://maven.apache.org/guides/?

附上官網上的指南地址。

轉載于:https://www.cnblogs.com/langren1992/p/5221993.html

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

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

相關文章

c++如何打開hdf5文件_如何打開CSV格式文件才能正常使用?

正文開始前先給大家來一波福利&#xff0c;歡迎大家掃碼關注后&#xff0c;手動發送“薪酬”領取《企業薪酬管理必備資料包》&#xff01;注意&#xff1a;先掃碼關注再回復回復關鍵詞&#xff01;先掃碼關注再回復回復關鍵詞&#xff01;先掃碼關注再回復回復關鍵詞&#xff0…

Linux驅動技術(四) _異步通知技術

異步通知的全稱是"信號驅動的異步IO"&#xff0c;通過"信號"的方式&#xff0c;放期望獲取的資源可用時&#xff0c;驅動會主動通知指定的應用程序&#xff0c;和應用層的"信號"相對應&#xff0c;這里使用的是信號"SIGIO"。操作步驟是…

陜理工高級語言程序設計實驗 (C)答案,陜理工高級語言程序計實驗 (C)模板.doc

陜理工高級語言程序計實驗 (C)模板《高級語言程序設計(C)》實驗報告目錄實驗一&#xff1a;C開發環境與順序結構程序設計21&#xff0e;實驗目的&#xff1a;22&#xff0e;實驗環境&#xff1a;23&#xff0e;實驗步驟&#xff1a;24&#xff0e;實驗內容&#xff1a;25&#…

java集合(1)-概述

Java集合類是一種特別有用的工具類,可用于存儲數量不等的對象,并可以實現常用的數據結構,如棧,隊列等,此外Java集合還可以用于保存具有映射關系的關聯數組.java集合大致可分為Set,List,Queue和Map四種體系,其中Set代表無序,不可重復的集合;List代表有序,重復的集合;而Map則代表…

UVA1262Password(第K字典序)

題目鏈接 紫書P323 題意&#xff1a;兩個6*5的字母矩陣&#xff0c;兩個矩陣每列相同的字母&#xff0c;每列取一個&#xff0c;求按照字典序第k小的序列 分析&#xff1a; 對于第一個樣例來說&#xff0c;我們得到{ACDW}、{BOP}、{GMOX}、{AP}、{GSU} 則一共有43423288種密碼&…

自定義 View 循環滾動刻度控件

LoopScaleView 先看效果圖: enter description hereLoopScaleView 是一個自定義的刻度尺風格的選值控件,從上面的動圖大家可以看到 LoopScaleView 的運行效果.可以設置屏幕內顯示的刻度數,也可以設置每一個刻度代表的值得大小。 LoopScaleView.class Nested class OnValueChang…

go 類型斷言_(57)接口的類型斷言

GO提供了一個方法&#xff0c;用來判斷接口的底層值是什么類型類型斷言 提供了訪問接口值底層具體值的方式。t : i.(T)該語句斷言接口值 i 保存了具體類型 T&#xff0c;并將其底層類型為 T 的值賦予變量 t。若 i 并未保存 T 類型的值&#xff0c;該語句就會觸發一個panic。為了…

使用web3j構建以太坊錢包

創建一個以太坊錢包有多種方式&#xff0c;一般情況下可以通過geth、EtherumWallet等客戶端。對于前端&#xff0c;可以使用插件MetaMask進行創建。這幾種方式技術實現雖然不同&#xff0c;但底層原理是一致的。本文主要介紹如何通過web3j架構創建一個以太坊的冷錢包&#xff0…

Html、CSS、JavaScript 實時效果在線編輯器 - 學習的好工具,算不算?!

關于 二維碼 與 NFC 之間的出身貧賤說太陽火神的漂亮人生 (http://blog.csdn.net/opengl_es)本文遵循“署名-非商業用途-保持一致”創作公用協議轉載請保留此句&#xff1a;太陽火神的漂亮人生 - 本博客專注于 敏捷開發及移動和物聯設備研究&#xff1a;iOS、Android、Html5、…

android自定義更新,Android 完美解決自定義preference與ActivityGroup UI更新的問題

之前發過一篇有關于自定義preference 在ActivityGroup 的包容下出現UI不能更新的問題&#xff0c;當時還以為是Android 的一個BUG 現在想想真可笑 。其實是自己對機制的理解不夠深刻&#xff0c;看來以后要多看看源碼才行。本篇講述內容大致為如何自定義preference 開始到與Act…

vxlan 資料及其在 neutron中的應用

2019獨角獸企業重金招聘Python工程師標準>>> VXLAN 是一個新興的SDN 標準&#xff0c;它定義了一種新的 overlay 網絡&#xff0c;它主要的創造者是 VMware, Cisco 和 Arista。它被設計來消除虛擬化網絡世界中的 VLAN 數目的限制。VXLAN 本身是一個多播標準&#xf…

橫流式冷卻塔計算風量_研討丨卓展標準高效制冷機房技術之影響冷卻塔效率的幾個因素...

集中制冷用空調系統中&#xff0c;單臺冷卻塔的冷卻水量基本上都小于1,000m/h&#xff0c;且裝有淋水填料的橫流機械通風開式居多。本文將已橫流開式冷卻塔為對象&#xff0c;探討影響其效率的幾個因素。橫流開式冷卻塔示意圖如下所示&#xff1a;橫流開式冷卻塔示意圖 Fig 01說…

我是培訓出來的我怕誰

引子: 江小峰是我帶過的徒弟中跟我最久&#xff0c;也是最聰明的一個。 他一個高中生&#xff0c;沒上過大學&#xff0c;高中畢業后在老家賣了三年電腦&#xff0c;天天給人裝操作系統&#xff0c;有天他在網上看到某培訓機構招生簡介&#xff0c;一時沖動揣上三年血汗錢&…

android平臺gallery2應用分析,Android5.1圖庫Gallery2代碼分析數據加載流程

圖片數據加載流程。Gallery---->GalleryActivity------>AlbumSetPage------->AlbumPage--------->PhotoPage相冊集 照片集 某張圖片1,AlbumSetPage.javaprivate void initializeData(Bundle data) {String mediaPath data…

python開課吧1980課程_開課吧的課程怎么樣?

就那那些編程開發課來說。現在網絡上充斥著大量的編程開發課程&#xff0c;什么python的&#xff0c;java的&#xff0c;c的&#xff0c;而且名字一個比一個夸張&#xff0c;21天精通c&#xff0c;7天熟練運用java&#xff0c;3天掌握python核心代碼&#xff0c;這些課程標題簡…

專業概念

1.JDBC: java數據庫連接&#xff08;JDBC&#xff09;用于在java程序中實現數據庫的操作功能&#xff0c;它提供了執行sql語句&#xff0c;訪問各種數據庫的方法&#xff0c;并為各種不同的數據庫提供統一的操作接口&#xff0c;java.sql包中 包含了jdbc操作數據庫的所有類 2.…

前端解決跨域問題的8種方案

2019獨角獸企業重金招聘Python工程師標準>>> 1.同源策略如下&#xff1a; URL說明是否允許通信http://www.a.com/a.js http://www.a.com/b.js同一域名下允許http://www.a.com/lab/a.js http://www.a.com/script/b.js同一域名下不同文件夾允許http://www.a.com:8000/…

k歌的錄音伴奏合成技術如何實現_K歌神器,用唱吧麥克風攀登天籟高峰

自從喜歡上了手機K歌&#xff0c;經常會上傳一些自己的作品&#xff0c;起初無論音質如何都是樂在其中&#xff0c;可時間久了發現回放效果確實不如那榜單上的高手&#xff0c;究其原因想到了麥克風&#xff0c;網上一搜果然有各種K歌輔助工具&#xff0c;多番對比之下&#xf…

淺談內存開辟問題和Block內存問題

我們知道&#xff0c;內存分為棧&#xff0c;堆&#xff0c;塊。 棧中的內存由系統自己釋放&#xff0c;堆是存對象初始化的地方&#xff0c;塊是CPU與內存連接的緩沖器&#xff0c;運行速度比內存快&#xff0c;比CPU慢。 例如&#xff0c;我們NSMutableArray *array [NSMuta…

vue render函數_Vue原理解析(一):Vue到底是什么?

Vue&#xff0c;現在前端的當紅炸子雞&#xff0c;隨著熱度指數上升&#xff0c;實在是有必要從源碼的角度&#xff0c;對它功能的實現原理一窺究竟。個人覺得看源碼主要是看兩樣東西&#xff0c;從宏觀上來說是它的設計思想和實現原理&#xff1b;微觀上來說就是編程技巧&…