构建仓库与包管理

一、构建仓库

1、nexus安装

brew安装方式(比较慢)

brew install nexus

官网下载安装方式

sonatype官网下载,比如MacOS的,下载完成之后cd到bin目录即可看到启动命令

启动

# 2.0版本
brew services start nexus
# 3.0版本
/usr/local/Cellar/nexus/3.38.1-01/libexec/bin/nexus

停止(对nexus执行stop命令,或者关闭服务终端)

/usr/local/Cellar/nexus/3.29.0-02/bin/nexus stop

网页路径与默认账号密码

http://127.0.0.1:8083 	admin/admin123 admin/123456

brew安装nexus路径

/usr/local/Cellar/nexus

修改端口号

打开config配置文件,修改这里application-port=8081(约19行)

/usr/local/Cellar/nexus/2.14.18-01/libexec/conf/nexus.properties

2、artifactory安装

安装软件与教程下载

网页路径与默认账号密码

http://localhost:8083/artifactory	admin/password

2,下载文件路径

/你的安装地址/artifactory-pro-6.6.0/backup/backup-daily/current/repositories

3,tomcat配置文件

/你的安装地址/artifactory-pro-6.6.0/tomcat/conf/server.xml

4,localhost启动与停止

cd /你的安装地址/artifactory/artifactory_pro/artifactory_pro_and_crack/artifactory-pro-6.6.0/bin/

启动

./artifactory.sh start

关闭

./artifactory.sh stop

3、仓库使用

gradle单个文件

distributionUrl=http\://192.168.174.175:8083/artifactory/android_local/gradle-6.0.1-all.zip

maven使用

maven{
    url 'http://localhost:8083/artifactory/android_group'
}

二、npm

1、npm

查看一下当前源

npm config get registry

切换为淘宝源

npm config set registry https://registry.npm.taobao.org/

切换本地源

npm config set registry http://localhost:8083/artifactory/api/npm/npm_group/

还原仓库地址

npm config set registry https://registry.npmjs.org/

清空当前缓存

npm cache clean -f

2、yarn

查看一下当前源

yarn config get registry

切换为淘宝源

yarn config set registry https://registry.npm.taobao.org

切换本地源

yarn config set registry http://localhost:8083/artifactory/api/npm/yarn_group/

还原仓库地址

yarn config set registry https://registry.yarnpkg.com

清空当前缓存

yarn cache clean

三、tomcat

运行 tomcat 比较简单,cd 到 bin 目录执行对应脚本即可

cd /Users/你的用户名/Library/ApacheTomcat/bin
./startup.sh
./shutdown.sh

1、下载 Tomcat

点击官网下载,mac 电脑选择 tar.gz 或者 zip 包下图:

image-20231027175724715

添加tomcat 可执行权限

chmod +x shutdown.sh
chmod +x catalina.sh 
chmod +x startup.sh

2、安装tomcat权限报错

如果tomcat报错如下

By default the Manager is only accessible from a browser running on the same

找到你当前的tomcat目录,进入webapps/manager/META-INF目录,可以看到 context.xml 这个文件,进去注释掉

image-20220127202810611

然后cd到bin目录重启tomcat即可

./shutdown.sh
./startup.sh

3、修改tomcat密码

/conf/tomact_user.xml

后面附加

<role rolename="manager"/>  
<role rolename="manager-gui"/>  
<role rolename="admin"/>  
<role rolename="admin-gui"/>  
<role rolename="manager-script"/>  
<role rolename="manager-jmx"/>  
<role rolename="manager-status"/>  
<user username="admin" password="000000" roles="admin-gui,admin,manager-gui,manager,manager-script,manager-jmx,manager-status"/> 

4、静态资源不可访问报错

image-20231027181253671

考虑修改/conf/web.xml文件,这个文件是配置 tomcat 应用的,且比较大,找个正确的替换上。

猜你喜欢

转载自blog.csdn.net/liuxingyuzaixian/article/details/129616745