相關(guān)配置文件的解釋
groupId:項目名稱
artifactid:模塊名稱(我的理解是以后各個模塊相分離鉴嗤,最后以項目名稱的為主體進(jìn)行打包事件)
dependencies:依賴的東西的喜最,groupId,artifactid繁调,版本,scope(作用:test违崇,compile)
url:更換中央倉庫
源代碼放在(src/main/java)
源代碼資源文件放在(src/main/resources)
測試代碼放在(src/test/java)
測試代碼的資源文件放在(src/test/resources)
mvn操作指令
mvn clean 清理target
mvn clean compile 先清理后編譯豫喧,生成到target
mvn clean test 清理和測試
mvn clean package 運行清理和打包
mvn clean install 運行清理和安裝(將打好的包安裝到本地倉庫,以便共用)
mvn clean deploy 發(fā)布到私有服務(wù)器
mvn archetype(:generate,create)固定生成模式谦絮,創(chuàng)建項目骨架
(可以在maven高手許曉斌中的博客去查看)
注解:
(首先题诵,java有幾種對象(PO,VO,DAO,BO,POJO),很遺憾之前不知道vo。
一层皱、PO:persistant object 持久對象,可以看成是與數(shù)據(jù)庫中的表相映射的java對象性锭。使用Hibernate來生成PO是不錯的選擇。
二叫胖、VO:value object值對象草冈。通常用于業(yè)務(wù)層之間的數(shù)據(jù)傳遞,和PO一樣也是僅僅包含數(shù)據(jù)而已瓮增。但應(yīng)是抽象出的業(yè)務(wù)對象,可以和表對應(yīng),也可以不,這根據(jù)業(yè)務(wù)的需要.PO只能用在數(shù)據(jù)層怎棱,VO用在商業(yè)邏輯層和表示層。各層操作屬于該層自己的數(shù)據(jù)對象钉赁,這樣就可以降低各層之間的耦合蹄殃,便于以后系統(tǒng)的維護(hù)和擴(kuò)展。)
依賴查找
1.依賴的查找GAV(groupid你踩,artifactid诅岩,version)
2.有一些網(wǎng)上的倉庫提供了坐標(biāo)的查詢(mvnrepository.com,www.sonatype.org/nexus/)
3.依賴是可以被傳遞的(傳遞相同scope下的)带膜,scope默認(rèn)就是compile吩谦。(這邊具體傳遞區(qū)間后期再補充:compile,test膝藕,provided)
注釋:test:測試有效式廷,其他沒
compile:編譯和打包都存儲
provided:在編譯和測試有效,最后生成war包不會加入(java servlet api:tomcat帶有)
runtime:運行有芭挽,編譯無(暫無例子)
import:暫無
system:暫無
備注
這邊我在使用idea這個工具的時候滑废,如果使用mybatis的映射文件來寫sql語句,會出現(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