Maven
来源:互联网 发布:网络代理平台 编辑:程序博客网 时间:2024/06/06 01:06
1.1 什么是maven
是apache下的一个开源项目,是纯java开发,并且只是用来管理java项目的
1.2Maven的好处
依赖管理:jar包的统一管理
一键构建
分模块开发,提高开发效率
1.3配置本地仓库
在maven的conf/settings.xml中加入
<localRepository>E:\repository</localRepository>
把本地仓库的地址加入进去
Maven生命周期
Clean生命周期
Clean
Default生命周期
Compile test package install deploy(发布到私服上)
Site生命周期
Site
导包前重建索引
添加 Maven Repositories
bulid Index
添加包需要注意
jsp javax.servlet 2.0
servlet javax.servlet 2.5
的scope依赖范围
- compile 默认的
- provided 不打包
- runtime
- Test
5.3.1 Compile struts2-core
编译(compile)时需要 测试时需要,,运行时需要,打包时需要
5.3.2 Provided jsp-api.jar servlet-api.jar
编译(compile)时需要,测试(test)时也需要 ,运行时不需要,打包时不需要
5.3.3 Runtime 数据库驱动包
编译时不需要,测试时需要,,运行时需要,打包时需要
5.3.4 Test junit.jar
编译时不需要,测试时需要,运行时不需要,打包也不需要
私服nexus
安装nexus
nexus.bat install
启动服务
nexus.bat start
启动失败是因为jdk位置不对
在nexus/bin/jsw/conf/wrapper.conf中 15行
填写jdk的bin/java.exe位置
Virtual 虚拟仓库
Proxy 代理仓库
Hosted 宿主仓库 本地仓库
Group 组
上传到私服
1.修改上传的账号密码
在maven/conf/settings.xml
<server> <id>releases</id> <username>admin</username> <password>admin123</password> </server> <server> <id>snapshots</id> <username>admin</username> <password>admin123</password> </server>
2.配置pom.xml
<distributionManagement> <repository> <id>releases</id> <url>http://localhost:8081/nexus/content/repositories/releases/</url> </repository> <snapshotRepository> <id>snapshots</id> <url>http://localhost:8081/nexus/content/repositories/snapshots/</url> </snapshotRepository> </distributionManagement>
从私服下载
1。修改settings.xml
<profile> <!--profile的id--> <id>dev</id> <repositories> <repository> <!--仓库id,repositories可以配置多个仓库,保证id不重复--> <id>nexus</id> <!--仓库地址,即nexus仓库组的地址--> <url>http://localhost:8081/nexus/content/groups/public/</url> <!--是否下载releases构件--> <releases> <enabled>true</enabled> </releases> <!--是否下载snapshots构件--> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> <pluginRepositories> <!-- 插件仓库,maven的运行依赖插件,也需要从私服下载插件 --> <pluginRepository> <!-- 插件仓库的id不允许重复,如果重复后边配置会覆盖前边 --> <id>public</id> <name>Public Repositories</name> <url>http://localhost:8081/nexus/content/groups/public/</url> </pluginRepository> </pluginRepositories> </profile> //激活 <activeProfiles> <activeProfile>dev</activeProfile> </activeProfiles>
ok了
- Maven
- Maven
- Maven
- maven
- Maven
- Maven
- maven
- maven
- maven
- maven
- Maven
- maven .
- Maven
- maven
- maven
- maven
- MAVEN
- Maven
- zookeeper+kafka+storm+flume+log4j
- 跟我学Dubbo系列之Java SPI机制简介
- 如何用命令将本地项目上传到github
- 有关utf-8的介绍
- FastJson常见问题
- Maven
- C# 获取当前星期 中文或者数字
- Android Studio 3.0 Jni开发环境配置 cmake编译 多个C/C++文件添加配置
- httpclient中的post请求
- Java 面试题:百度前200页都在这里了
- Mac 电脑 配置Mysql 默认编码utf8
- 微信公众号相应消息 ,自动回复消息
- 导出excel封装
- [leetcode]#28. Implement strStr()