官網(wǎng): 傳送門
專業(yè)從事成都網(wǎng)站建設(shè)、成都做網(wǎng)站,高端網(wǎng)站制作設(shè)計(jì),小程序定制開發(fā),網(wǎng)站推廣的成都做網(wǎng)站的公司。優(yōu)秀技術(shù)團(tuán)隊(duì)竭力真誠服務(wù),采用H5建站+CSS3前端渲染技術(shù),成都響應(yīng)式網(wǎng)站建設(shè)公司,讓網(wǎng)站在手機(jī)、平板、PC、微信下都能呈現(xiàn)。建站過程建立專項(xiàng)小組,與您實(shí)時(shí)在線互動(dòng),隨時(shí)提供解決方案,暢聊想法和感受。Maven 項(xiàng)目結(jié)構(gòu)
$ MavenProject
|-- pom.xml
|-- src
| |-- main
| | `-- java
| | `-- resources
| `-- test
| | `-- java
| | `-- resources
`-- README.md
<?xml version="1.0" encoding="UTF-8"?>
<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>
<packaging>pom</packaging>
<modules>
<module>mscx-ad-discovery</module>
<module>mscx-ad-zuul</module>
<module>mscx-ad-gateway</module>
<module>mscx-ad-discovery-nacos</module>
<module>mscx-ad-common</module>
<module>mscx-ad-db</module>
<module>mscx-ad-sponsor</module>
<module>mscx-ad-search</module>
<module>mscx-ad-feign-sdk</module>
</modules>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.5.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.sxzhongf</groupId>
<artifactId>mscx-ad</artifactId>
<version>1.0-SNAPSHOT</version>
<name>分布式廣告系統(tǒng)</name>
<description>基于Spring Cloud Alibaba 實(shí)現(xiàn)的分布式廣告系統(tǒng)</description>
<properties>
<java.version>1.8</java.version>
<spring-cloud.version>Greenwich.SR2</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<!--定義遠(yuǎn)程maven倉庫-->
<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>alibaba</id>
<name>ali Milestones</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Maven思想 是 約定大于配置,默認(rèn)依賴中,scope 是compile.
compile(會被打包到當(dāng)前project)
表示被依賴的package參與當(dāng)前project的編譯,包含后續(xù)的測試,運(yùn)行周期都會參與,是一個(gè)強(qiáng)依賴。
test
表示被依賴的jar 僅參與測試相關(guān)的處理,包裹測試代碼的編譯,執(zhí)行。(如junit)
runtime
表示被依賴的jar不需要參與項(xiàng)目的編譯,但是后期的測試和運(yùn)行周期需要參與。
provided
打包的時(shí)候不需要包含進(jìn)去,其他的Container會提供該依賴支持,理論上該依賴可以參與編譯、測試運(yùn)行等周期 ,相當(dāng)于compile,但是在打包階段做了exclude命令。
system
從參與環(huán)境來看,和provided相同,但是被依賴項(xiàng)不會從maven倉庫獲取,而是從本地文件系統(tǒng)獲取,一定需要配合
systemPath
屬性使用
import
This scope is only supported on a dependency of type
pom
in the<dependencyManagement>
section.
官方解釋:傳送門
Dependency mediation (最近依賴原則)
"nearest definition" means that the version used will be the closest one to your project in the tree of dependencies. For example, if dependencies for A, B, and C are defined as A -> B -> C -> D 2.0 and A -> E -> D 1.0, then D 1.0 will be used when building A because the path from A to D through E is shorter. You could explicitly add a dependency to D 2.0 in A to force the use of D 2.0.
根據(jù)依賴深度,選擇依賴路徑最近的package version, 如果依賴深度相同,那么選擇前一個(gè)。Note that if two dependency versions are at the same depth in the dependency tree, the first declaration wins.
Dependency management
依賴管理(項(xiàng)目作者可直接指定依賴版本)
Dependency scope 如上一節(jié)所述
Excluded dependencies 排除依賴包中依賴項(xiàng)
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。
當(dāng)前題目:使用maven快速入門-創(chuàng)新互聯(lián)
本文來源:http://chinadenli.net/article38/djjisp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供App開發(fā)、軟件開發(fā)、網(wǎng)站維護(hù)、商城網(wǎng)站、定制網(wǎng)站、靜態(tài)網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容