新人上路-搭建項(xiàng)目-maven和gradle
前段時(shí)間因?yàn)楫呍O(shè)需要怨愤,第一次搭建項(xiàng)目慧邮,記錄一下踩過(guò)的坑晴叨。但不記錄諸如下載安裝瓶您、配置環(huán)境變量等簡(jiǎn)單的步驟麻捻。
maven
-
修改安裝路徑下的 /conf/setting.xml 配置文件:
-
本地倉(cāng)庫(kù)位置(默認(rèn)是${user.home}/.m2/repository):
<localRepository>/home/.....</localRepository>
-
鏡像源:
<mirrors> <mirror> <id>alimaven</id> <mirrorOf>central</mirrorOf> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/groups/public</url> </mirror> </mirrors>
-
-
最好將修改后的setting.xml文件復(fù)制到默認(rèn)路徑下:
- linux:/home/${user}/.m2/setting.xml
- windows:C:/Users/用戶名/.m2/setting.xml
gradle
-
每個(gè)gradle項(xiàng)目都有個(gè)build.gradle配置文件纲仍,在repositories中添加倉(cāng)庫(kù)位置和鏡像源:
repositories { mavenLocal() maven { url 'http://maven.aliyun.com/nexus/content/groups/public/'} mavenCentral() ...... }
最好在環(huán)境變量中添加GRADLE_USER_HOME,用來(lái)修改gradle緩存jar包的位置
最后
- 集成環(huán)境(如IDEA)中注意配置好使用的倉(cāng)庫(kù)位置以及配置文件