本篇介绍安装Maven和Nexus。
1、下载安装Maven。
虽然Eclipse内嵌的maven,但是如果想配置个性的Maven还是需要安装一个完整版。
下载地址:http://maven.apache.org/download.html
下载最新版本的Maven。
解压到某个目录下即可。后面用${MAVEN_HOME}代替这个目录。
2、下载Nexus。
下载地址:http://www.sonatype.org/nexus/go
nexus有几个发布形式,我选择war distrubution,应为比较好配置。也可以用其他形式配置成系统服务。
3、安装Nexus。
将下载的nexus-x.x.x.war拷贝到WEB服务器里,我用Tomcat,所以拷贝到Tomcat的webapps下。
重命名为nexus.war。
启动Tomcat,浏览http://localhost:8080/nexus,显示nexus首页就对。
4、配置Nexus。
英文配置文档可以参考:http://www.sonatype.com/books/nexus-book/reference/
1)修改管理员密码。
管理员默认登录名和密码是:admin/admin123
登陆路后,选在左侧菜单Security-->Change Password
2)设置SMTP
nexus可以发送重置密码邮件,如果需要这个功能,就需要配置SMTP。
左侧菜单Administration-->Server-->SMTP Settings。
设置好后可以“Test SMTP settings”
3)允许下载远程索引
Nexus代理3个重要的仓库:Maven Central repository、Apache Snapshot repository、Codehaus Snapshot repository。大多数仓库为了快速搜索都提供索引文件。Nexus默认设置关闭了下载远程索引文件,打开的方法:
左侧菜单Views/Repositories-->Repositories 选择Apache Snapshots 点击Configration选项卡,变更Download Remote Indexes为True。

4)设置部署员账号密码。
nexus默认有一个部署权限的账号。deployment/deployment123。
管理员登陆,左侧菜单Security-->Users 右键点击deployment用户,选择Set Password

5、配置Maven
打开${MAVEN_HOME}/conf/settings.xml
1)去掉localRepository的注释,编辑本地仓库的地址。

2)添加如下配置
<settings>
<mirrors>
<mirror>
<!--This sends everything else to /public -->
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://localhost:8081/nexus/content/groups/public</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<!--Enable snapshots for the built in central repo to direct -->
<!--all requests to nexus via the mirror -->
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<!--make the profile active all the time -->
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>
6、配置Eclipse的Maven。
Eclipse菜单,Window-->Preferences。打开左侧Maven项目:

点击Add按钮,选中${MAVEN_HOME}目录。

点确定按钮。结果如下图:

再选中User Settings,如下设置:

点击Update Settings按钮和Reindex按钮。
Eclipse会自己工作一段时间,之后就可以使用了。
关于nexus其他操作可以参考网上的使用手册,比如增加自定义的仓库,设置仓库组,设置计划任务等。

- 大小: 135 KB

- 大小: 22.9 KB

- 大小: 9.8 KB

- 大小: 29.4 KB

- 大小: 17.3 KB

- 大小: 11.8 KB

- 大小: 20.7 KB
分享到:
相关推荐
【SSM框架搭建详解】 SSM框架是Spring、Spring MVC和MyBatis的组合,常用于构建Java EE Web应用程序。本文将详细介绍如何使用Eclipse和...记得在开发过程中,利用Maven进行编译、测试和打包,以确保项目的正常运行。
【持续集成环境maven+nexus+jenkins+svn搭建】 持续集成是软件开发中的一个实践,它强调开发人员频繁地将代码集成到主分支,并通过自动化构建和测试来尽早发现和解决问题。本教程将详细介绍如何利用Maven、Nexus、...
首先,我们需要的基础环境是Java开发环境,确保已安装JDK并在环境变量中设置了`JAVA_HOME`,并将`%JAVA_HOME%\bin`添加到Path变量中。这是所有Java相关工具运行的前提。 接着,我们来安装构建工具——maven。Apache...
Eclipse作为一款流行的Java开发集成环境,提供了丰富的插件支持,如M2Eclipse插件,使得开发者可以在Eclipse内部直接进行Maven项目的创建、构建和管理。这包括新建Maven项目,导入现有的Maven项目,以及通过Maven的...
本篇文档主要介绍了如何利用Maven、Nexus、Jenkins和SVN搭建一个持续集成环境。 1. Maven安装: Maven是Java项目管理工具,它处理项目的构建、依赖管理和文档生成。要在本地安装Maven,首先需要从Apache Maven官网...
Maven中央仓库是默认的依赖获取源,但在企业环境中,为了提高依赖下载速度和管理私有库,常常会搭建Maven私服,如Nexus或Artifactory。配置私服需要修改`settings.xml`文件,指定镜像和仓库地址,这样,项目中的依赖...
- **IDE集成**:Maven支持多种集成开发环境(IDE),如Eclipse、IntelliJ IDEA等,可以通过安装相应的插件来实现与Maven的集成。 #### 四、Maven的高级特性 **4.1 使用Nexus建立私服** - **Nexus介绍**:Nexus是一...
我们需要安装 Eclipse Java EE IDE for Web Developers Version: Oxygen.2 Release (4.7.2),以便在 Eclipse 中进行开发。 3. Maven 的安装 我们需要安装 Maven 3.2.5,以便进行项目依赖管理。Maven 的安装包括...
MyEclipse是一款集成开发环境(IDE),支持多种技术,包括Java、Web、J2EE等。为了在MyEclipse中使用Maven,首先需要在MyEclipse中安装Maven插件。这通常可以通过Eclipse Marketplace或者通过更新站点进行。安装完成...
### Eclipse中安装配置Maven、Gradle以及SpringBoot #### Maven 安装配置 Maven是Java项目构建和依赖管理工具。它可以帮助开发者自动化构建过程,包括编译、测试、打包、部署等,并且能够方便地管理项目的依赖关系...
### Maven in Action 读书笔记知识点概述 #### 1. Maven简介 - **Maven作为构建工具的优势**:Maven的...通过上述知识点的学习,可以全面掌握Maven在项目构建和管理中的应用技巧,为高效开发Java项目打下坚实的基础。
总结,本资源提供的Maven配置文件可以帮助快速搭建Java开发环境,特别是对于使用Spring Boot的开发者,配合STS可以更高效地进行项目管理和开发。正确配置并理解Maven的工作原理,将极大地提高开发效率。
2. "[20120506]springsource-tool-suit.doc" - SpringSource Tool Suite (STS) 是一个基于Eclipse的集成开发环境,特别优化了对Spring框架的支持。文档可能涵盖了如何在STS中配置和使用Maven,包括创建Spring-MVC...
- 使用IDEA、Eclipse等集成开发环境内置的Spring Boot项目模板 - 手动创建项目结构并添加依赖 确保在pom.xml或build.gradle文件中添加`spring-boot-starter-web`依赖,它是Spring MVC的基础: ```xml <groupId>...