maven在eclipse中配置过程并导入maven工程,以及关于工程中jdk和git的设置,
一,maven在eclipse中配置:
1.window-preferences-maven-installations选择自己安装的maven,
2.window-preferences-maven-user Settings-选择在maven安装包config下的setting配置文件(注意是自己已经配置好的maven)。
发布使用:
1,在父工程中右键选择maven-Updata project,右键选择run as Maven clean 再选择maven install,更新代码。
2,在子工程中选择运行代码,讲需要部署的代码运行就行了。
二、将maven工程导入:
1选择project explorer (可以显示class等文件)
2.将工程分级显示:
3,引进maven工程
4.使用阿里云和中央库配置内容:settings.xml
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>D:/feianzhuang/repository</localRepository>
<pluginGroups>
</pluginGroups>
<proxies>
</proxies>
<servers>
</servers>
<mirrors>
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>*</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
<mirror>
<id>repo1</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo1.maven.org/maven2/</url>
</mirror>
<mirror>
<id>repo2</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo2.maven.org/maven2/</url>
</mirror>
</mirrors>
<profiles>
</profiles>
</settings>
5.对于从git上拉代码后出现架构不一样的情况处理。
一,选中工程右键后,Run As --> Maven intall 。(有时候下载库的时间比较慢,可以将下载好的库添加的本地路径下面如:D:\feianzhuang\repository)
二,下载完成后,对于项目结构不一致的,采用:选中工程右键后,Maven --> Update Project 即可。
二。关于工程中jdk的设置,在对逐个工程中选择自己安装的对应JDK的方法。
1。java Build Path --->>>Libraries -->>>>>>Add library -->>>Alternate(选择自己安装的JDK版本即可)。
2。在order and Export 中将maven dependencies 和Jar System library(jdk)选中。
注意:同时maven中settings中配置文件,要根据实际情况使用本地库。
在设定maven中settings时,不管用什么编辑器,在保存的时候一定要保存为 “UTF-8”,推荐使用 notePad++ 。(即使转换成UTF-8)
三。Git设置
1.在window--->show view--->other输入git选择Git Repositories
2.选择第二个小图标,名字为:Clone a Git Repository and add the clone to this view
3.选择Clone URI .在弹出界面输入代码库的url和密码即可。