安装步骤:
一、前提要求
1.操作系统:Linux(CentOS版)
1.1 svn版本:
subversion-1.9.3.tar.gz(下载地址:http://subversion.apache.org/download)
-
- arp软件:
apr-1.5.2.tar.gz(下载地址:http://apache.fayea.com//apr/apr-1.5.2.tar.gz)
-
- arp-util软件:
apr-util-1.5.4.tar.gz(下载地址:http://apache.fayea.com//apr/apr-util-1.5.4.tar.gz)
-
- SQLite数据库:
sqlite-autoconf-3100200.tar.gz(下载地址:http://www.sqlite.org/download.html);
-
- zlib库:
zlib-1.2.8.tar.gz(下载地址:http://www.zlib.net)
- svn插件安装
1.安装apr
-
- tar zxvf apr-1.6.5.tar.gz
- 切换解压目录
-
- 编译
./configure --prefix=/data/gdeop/svn/apr
-
- 编译安装
执行make && make install
- 安装expat
- 解压tar jxvf expat-2.2.5.tar.bz2
- 切换的目录
-
- 编译
./configure --prefix=/data/gdeop/svn/expat
-
- 编译安装
make && make install
- 安装apr-util
- tar zxvf apr-util-1.6.1.tar.gz
- 切换解压的目录
-
- 编译
执行
./configure --prefix=/data/gdeop/svn/apr-util --with-apr=/data/gdeop/svn/apr --with-expat=/data/gdeop/svn/expat
-
- 编译安装
make && make install
- 安装sqlite-autoconf
4.1解压tar zxvf sqlite-autoconf-3270200.tar.gz
4.2 切换目录
4.3 编译
./configure --prefix=/data/gdeop/svn/sqlite
4.4 编译安装
make && make install
5安装zlib
5.1 解压tar zxvf zlib-1.2.11.tar.gz
5.2 进入目录
cd zlib-1.2.11
5.3 编译
./configure --prefix=/data/gdeop/svn/zlib
5.4 编译安装
make && make install
6.安装svn
6.1 解压
6.2 进入解压目录
cd subversion-1.6.21/
6.3 编译
./configure --prefix=/data/gdeop/svn --with-apr=/data/gdeop/svn/apr --with-apr-util=/data/gdeop/svn/apr-util --with-expat=/data/gdeop/svn/expat --with-sqlite=/data/gdeop/svn/sqlite --with-zlib=/data/gdeop/svn/zlib
注:/data/gdeop/svn/apr 是apr软件编译安装目录
6.4 安装
make && make install
7.设置svn环境变量
export PATH=/data/gdeop/svn/bin:$PATH
source /etc/profile
测试svn安装成功
svnserve --version
Mule的maven的打包错误:
三、Maven安装和nexus私服安装及搭建
- 上传安装包
- 解压安装包
- 配置环境变量
export JAVA_HOME=/data/gdeop/java/jdk1.8.0_171
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH
export MAVEN_HOME=/data/gdeop/maven-3.6.0
export PATH=$MAVEN_HOME/bin:$PATH
export PATH=/data/gdeop/svn/bin:$PATH
- 配置本地jar存储库
四、Nexus安装
- 上传安装包
- 解压安装包
- 进去配置文件nexus.properties,修改端口和jar包物理存储库(路径)
编辑 vi /data/gdeop/nexus/nexus-2.14.12-02/bin /nexus
- 页面访问
Nexus所在的机器的ip+端口
http://122.111.110.119:8082/nexus
- 登录 默认用户admin 密码admin123
- 页面功能
添加第三方jar默认情况下Nexus为我们创建了以下主要的Repository:
1、Public Repositories,这是一个Repository Group,该Repository Group包含了多个Repository,其中包含了Releases、Snapshots、ThirdParty和Central。
2、3rd party,该Repository即是存放你公司所购买的第三方软件库的地方,它是一个由Nexus自己维护的一个Repository。
3、Apache Snapshots,看名字你就应该知道这是个什么样的Repository,这是一个代理Repository,即最终的依赖还是得在Apache官网上去下载,然后缓存在Nexus中。
4、Central,这就是代理Maven Central Repository的Repository。
5、Releases,你自己的项目要发布时,就应该发布在这个Repository,他也是Nexus自己维护的Repository,而不是代理。
6、Snapshots,你自己项目Snapshot的Repository。
- 上传本地jar包到私服的三种方式
在Repository列表中,选中 3rd party,选中artifact upload,
选择GAV Defini3ion: GAV Parameters,Auto Guess 打钩。
在下方输入JAR包对应的Group、Artifact、Version,Packaging选择JAR格式。
点击select Artifact(s) to upload 按钮,选择要上传的JAR包。
第一种 页面jar包上传
第二种 脚本上传
mvn deploy:deploy-file -DgroupId=com.oracle -DartifactId=ojdbc14 -Dversion=1.0.0 -Dpackaging=jar -Dfile=D:/repository/ojdbc-1.0.0.jar -Durl=http://110.121.120.119:1230/nexus/content/repositories/thirdparty -DrepositoryId=thirdparty
第三种 整个库上传
直接将本地的maven存储库打成压缩包后,在上传到内网服务器的nexus本地jar包存储库里,既这个/data/gdeop/nexus/sonatype-work/nexus/storage/thirdparty默认目录中,默认工作目录 在解压
- 更新索引,即看到所上传的jar包
上传好jar包后 更新索引
五、maven与nexus私服整合配置
- Maven的setting.xml配置
<servers>
<server>
<id>nexus</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>thirdparty</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>central</mirrorOf>
<url>http://110.121.119.120:1101/nexus/content/groups/public</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>nexus</id>
<name>Public repository</name>
<url>http://110.121.119.120:1101/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
2.项目中的pom.xml私服地址配置
2.1 全局私服地址配置:
在maven中的conf下的setting.xml配置,即:
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>central</mirrorOf>
<url>http://110.121.119.120:1101/nexus/content/groups/public</url>
</mirror>
</mirrors>
注:配置后项目中pom.xml就不需要再配置,只需配置一次(推荐)
2.局部配置,即每个项目中的pom.xml中都需配置一致,比较繁琐(不推荐)
项目1:pom.xml
项目2:pom.xml
3.私服地址配置
六、Maven项目打包
- mvn clean 清除编译
- mvn install 安装并编译打包
- mvn compile编译
- mvn package打包
- mvn install -Dmaven.test.skip=true 跳过测试打包