软件下载

maven仓库怎么配置(Maven私有库和本地库的安装与配置)

软件下载 投稿 2022-06-11 20:08:54 浏览

一 前提

已经安装好JDK8并配置好环境。可以参考:手把手教你Windows安装JDK8与环境配置

二 上传nexus

上传
nexus-2.11.2-03-bundle.tar.gz到/usr/local/src/目录

三 解压

cd /root/
mkdir nexus
tar -zxvf nexus-2.11.2-03-bundle.tar.gz -C nexus
cd nexus

四 配置文件

编辑Nexus的nexus.properties文件,配置端口和work目录信息(保留默认)

cd nexus-2.11.2-03
ls
cd conf
vi nexus.properties
# Jetty section
application-port=8081
application-host=0.0.0.0
nexus-webapp=${bundleBasedir}/nexus
nexus-webapp-context-path=/nexus

# Nexus section
nexus-work=${bundleBasedir}/../sonatype-work/nexus
runtime=${bundleBasedir}/nexus/WEB-INF

五 编辑脚本

编辑nexus脚本,配置RUN_AS_USER参数

vi /root/nexus/nexus-2.11.2-03/bin/nexus
#RUN_AS_USER=
改为:
RUN_AS_USER=root

六 打开端口

防火墙打开8081端口

vi /etc/sysconfig/iptables
添加
-A INPUT -p tcp -m state --state NEW -m tcp --dport 8081 -j ACCEPT
保存后重启防火墙
service iptables restart

七 启动nexus

/root/nexus/nexus-2.11.2-03/bin/nexus start

八 验证

# 访问下面的地址,IP换成服务器的IP地址
http://IP:8081/nexus/

九 登录

默认用户名:admin,默认密码:admin123
至此,Nexus已安装完成,接下来是Nexus的配置
Nexus配置(登录后)
一 菜单Administration/Server配置邮箱服务器地址(如果忘记密码,可以通过该邮箱找回密码)

Maven私有库和本地库的安装与配置

 

二 给用户配置邮箱地址,方便忘记密码时找回:

Maven私有库和本地库的安装与配置

 

三 用户修改密码:

Maven私有库和本地库的安装与配置

 

四 仓库类型

Maven私有库和本地库的安装与配置

 

五 设置proxy代理仓库(Apache
Snapshots/Central/Codehaus Snapshots)准许远程下载

Maven私有库和本地库的安装与配置

 

六 Maven本地库的安装与配置
环境变量、setting.xml
<setting>标签下:注意换掉IP为自己服务器的地址。

<profiles>
    <profile>
        <id>edu</id>
        <activation>
            <activeByDefault>false</activeByDefault>
            <jdk>1.8</jdk>
        </activation>
        <repositories>
            <!-- 私有库地址-->
            <repository>
                <id>nexus</id>
                <url>http://IP:8081/nexus/content/groups/public/</url>
                <releases>
                    <enabled>true</enabled>
                </releases>
                <snapshots>
                    <enabled>true</enabled>
                </snapshots>
            </repository>
        </repositories>
        <pluginRepositories>
            <!--插件库地址-->
            <pluginRepository>
                <id>nexus</id>
                <url>http://IP:8081/nexus/content/groups/public/</url>
                <releases>
                    <enabled>true</enabled>
                </releases>
                <snapshots>
                    <enabled>true</enabled>
                </snapshots>
            </pluginRepository>
        </pluginRepositories>
    </profile>
</profiles>

「真诚赞赏,手留余香」

求资源网

真诚赞赏,手留余香

使用微信扫描二维码完成支付

继续浏览有关编程的文章
发表评论
留言与评论(共有 0 条评论)
   
验证码:
版权声明

求资源网所发布的一切破解补丁,软件,以及其他分析文章仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途。
否则,一切后果请用户自负。本站信息来自网络,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。如有侵权请邮件与我们联系处理。