1.下载及配置nexus-3.5.0-02
1.下载nexus-3.5.0-02(自行百度)
2.解压出来就要两个目录
1.nexus-3.5.0-02
2.sonatype-work
3.启动
进入到./nexus-3.5.0-02/bin中,然后再导航栏中输入cmd,然后再dos窗口中输入nexus /run
启动完成后在浏览器输入 http://localhost:8081/即可进入
开始默认用户名:admin 密码为:admin123
4.关闭:关闭dos窗口即可关闭
5.修改数据存储路径,文件目录:./nexus-3.5.0-02/bin/nexus.vmoptions中配置
6.修改IP、端口、访问根目录,文件目录:./nexus-3.5.0-02/etc/nexus-default.properties
2.下载apache-maven-3.5.0
1.解压
2.配置.\conf\settings.xml文件
在setting标签中配置
<localRepository>F:\repository</localRepository> 并在F盘中新建repository文件夹
在servers标签中配置
<server>
<id>releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
在mirrors标签中配置:告诉让你的maven到nexus服务器去下载jar
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<name>all_mirror</name>
<url>http://127.0.0.1:8081/repository/maven-public/</url>
</mirror>
在profile标签中配置:加入 repositories 仓库下载地址 pluginRepositories插件仓库下载jar地址
<id>nexus</id>
<!--激活profile 让其有效-->
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
<!--指定仓库-->
<repositories>
<repository>
<id>central</id>
<url>http://127.0.0.1:8081/repository/maven-public/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<!--指定插件仓库-->
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://maven.com:8081/nexus/content/groups/public</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
修改完成后将settings.xml文件拷贝到F:/repository文件夹中
3.myeclipse中配置
windows->perference->maven4myeclipse->installations->add->选择apache-maven解压的目录
windows->perference->maven4myeclipse->user settings->选择F:\repository\settings.xml
然后新建maven项目然后再pom.xml文件中增加
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
然后选择新建的maven项目右键选择properties->java compiler->选择1.7或者之后的版本
然后选择java build path中移除默认的版本
然后选择myeclipse->project facets 勾选java后面选择着对应的版本确定
然后选择项目右键->maven4myeclipse->update project-全部勾选选择确定。
可能出现的问题:
项目上有红色的x出现:
点击problems对话框查看具体内容信息如出现Maven Dependencies.....就说明你pom文件中依赖关系没有找到。
一般这种情况有可能网速的原因未下载下来,这时进入F:\repository中查找*.lastUpdated全部删除
然后选择项目右键->maven4myeclipse->update project-全部勾选选择确定,如果还出现继续重复以上步骤