相關(guān)配置文件的解釋
groupId:項(xiàng)目名稱
artifactid:模塊名稱(我的理解是以后各個(gè)模塊相分離,最后以項(xiàng)目名稱的為主體進(jìn)行打包事件)
dependencies:依賴的東西的,groupId,artifactid,版本,scope(作用:test,compile)
url:更換中央倉(cāng)庫
源代碼放在(src/main/java)
源代碼資源文件放在(src/main/resources)
測(cè)試代碼放在(src/test/java)
測(cè)試代碼的資源文件放在(src/test/resources)
mvn操作指令
mvn clean 清理target
mvn clean compile 先清理后編譯,生成到target
mvn clean test 清理和測(cè)試
mvn clean package 運(yùn)行清理和打包
mvn clean install 運(yùn)行清理和安裝(將打好的包安裝到本地倉(cāng)庫,以便共用)
mvn clean deploy 發(fā)布到私有服務(wù)器
mvn archetype(:generate,create)固定生成模式,創(chuàng)建項(xiàng)目骨架
(可以在maven高手許曉斌中的博客去查看)
注解:
(首先,java有幾種對(duì)象(PO,VO,DAO,BO,POJO),很遺憾之前不知道vo。
一、PO:persistant object 持久對(duì)象,可以看成是與數(shù)據(jù)庫中的表相映射的java對(duì)象。使用Hibernate來生成PO是不錯(cuò)的選擇。
二、VO:value object值對(duì)象。通常用于業(yè)務(wù)層之間的數(shù)據(jù)傳遞,和PO一樣也是僅僅包含數(shù)據(jù)而已。但應(yīng)是抽象出的業(yè)務(wù)對(duì)象,可以和表對(duì)應(yīng),也可以不,這根據(jù)業(yè)務(wù)的需要.PO只能用在數(shù)據(jù)層,VO用在商業(yè)邏輯層和表示層。各層操作屬于該層自己的數(shù)據(jù)對(duì)象,這樣就可以降低各層之間的耦合,便于以后系統(tǒng)的維護(hù)和擴(kuò)展。)
依賴查找
1.依賴的查找GAV(groupid,artifactid,version)
2.有一些網(wǎng)上的倉(cāng)庫提供了坐標(biāo)的查詢(mvnrepository.com,www.sonatype.org/nexus/)
3.依賴是可以被傳遞的(傳遞相同scope下的),scope默認(rèn)就是compile。(這邊具體傳遞區(qū)間后期再補(bǔ)充:compile,test,provided)
注釋:test:測(cè)試有效,其他沒
compile:編譯和打包都存儲(chǔ)
provided:在編譯和測(cè)試有效,最后生成war包不會(huì)加入(java servlet api:tomcat帶有)
runtime:運(yùn)行有,編譯無(暫無例子)
import:暫無
system:暫無
備注
這邊我在使用idea這個(gè)工具的時(shí)候,如果使用mybatis的映射文件來寫sql語句,會(huì)出現(xiàn)(不存在該命名空間的問題),你可以嘗試拷貝xml文件到target文件下,嘗試即可。(解決方案待跟進(jìn))
Description Resource Path Location Type
Project build error: Non-resolvable parent POM for com.augmentum.we.connect:we-connect:0.0.1-SNAPSHOT: Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:1.4.1.RELEASE from file://${project.basedir}/../repository was cached in the local repository, resolution will not be reattempted until the update interval of we-connect has elapsed or updates are forced. Original error: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:1.4.1.RELEASE from/to we-connect (file://${project.basedir}/../repository): Repository path /../repository does not exist, and cannot be created. and 'parent.relativePath' points at no local POM pom.xml /dingding-sdk line 1 Maven pom Loading Problem