日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

志宇-nexus学习

發布時間:2024/3/26 编程问答 49 豆豆
生活随笔 收集整理的這篇文章主要介紹了 志宇-nexus学习 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

nexus /?neks?s/

  • 環境安裝
  • nexus安裝
  • nexus 使用
    • 登錄nexus
    • 創建一個公司的私有倉庫,然后添加到私服的中央倉庫中
    • 私服代理配置成阿里云鏡像
    • maven加載setting文件
  • jar包上傳到私服的方法
    • 配置maven的setting配置文件連接私服
    • 修改pom文件連接私服
    • 將項目打成jar包上傳私服
    • 上傳jar包

環境安裝

jdk和maven安裝
vim /etc/profile
在最下面,添加一下內容

JAVA_HOME=/usr/local/jdk1.8.0_91 export JAVA_HOME CLASSPATH=.:$JAVA_HOME/lib export CLASSPATH PATH=$PATH:$JAVA_HOME/bin:$CLASSPATH export PATH

激活配置
source /etc/profile
檢測安裝
java -version
解壓maven
tar -zxvf apache-maven-3.5.3-bin.tar.gz -C /usr/local/
配置maven環境變量
vim /etc/profile
在最下面,添加一下內容

MAVEN_HOME=/usr/local/apache-maven-3.5.3 export MAVEN_HOME PATH=$PATH:$MAVEN_HOME/bin export PATH

激活配置
source /etc/profile
檢測安裝
mvn -v

nexus安裝

1.解壓
tar -zxvf nexus-3.12.1-01-unix.tar.gz -C /usr/local/
2.開啟端口
修改配置文件 修改對應的端口 ?
vim /usr/local/nexus-3.12.1-01/etc/nexus-default.properties ?
修改防火墻 ?
vim /etc/sysconfig/iptables ?
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8081 -j ACCEPT
重啟防火墻
service iptable restart
3.創建新用戶(nexus不建議使用root用戶啟動)
user add nexus
給用戶賦予訪問解壓文件的權限
chown -R nexus:nexus sonatype-work/
chown -R nexus:nexus snexus-3.12.1-01/
4 切換用戶
su nexus
5 修改配置文件
vim /bin/nexus.vmoptions 修改內存占用大小
6來到bin目錄下啟動
./nexus start 進行啟動(如果啟動不成功不顯示報錯信息)
./nexus run (不啟動,但是啟動報錯能看到報錯信息)
7 查看是否啟動成功
開是否開啟
ps -ef | grep nexus

等一會看端口開放沒有
netstat -ano | grep (nexus的端口)
然后就啟動成功了

8.修改最大文件數
查看最大文件數
ulimit -a

修改最大文件數
vim /etc/security/limits.conf 在最后添加下面的配置
root soft nofile 65535
root hard nofile 65535
root代表的用戶,如果將將root 改成 * 則代表所有人
然后重啟生效
9.配置重啟自動開啟nexus
vim /etc/rc.d/rc.local
在配置中加入
su - nexus -c '/usr/local/nexus-3.12.1-01/bin/nexus start'

nexus 使用

登錄nexus

使用admin/admin123

創建一個公司的私有倉庫,然后添加到私服的中央倉庫中


私服代理配置成阿里云鏡像


將代理地址改成國內地址
http://maven.aliyun.com/nexus/content/groups/public/

maven加載setting文件

在idea中默認會先去 .m2中加載

jar包上傳到私服的方法

私服上面上傳jar包的三種方法
一、開發所使用的setting配置文件指向私服,開發下載的依賴會自動添加到私服中
二、將整個項目打包上傳,使用maven的deploy
三、手動將jar包上傳

配置maven的setting配置文件連接私服

修改setting配置文件

<?xml version="1.0" encoding="UTF-8"?> <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"><pluginGroups/><proxies/><servers><server><!-- 私有庫名稱 --><id>lizhiyu-releases</id><!-- 私有庫登錄用戶名 --><username>admin</username><!-- 私有庫登錄密碼 --><password>admin123</password></server><server> <!-- 私有庫名稱 (插件庫)--><id>lizhiyu-snapshots</id><!-- 私有庫登錄用戶名 --><username>admin</username><!-- 私有庫登錄密碼 --><password>admin123</password></server></servers><mirrors/><profiles><profile><id>lizhiyu</id><activation><activeByDefault>false</activeByDefault></activation><!-- 私有庫地址--><repositories><repository><id>lizhiyu</id><url>http://www.lizhiyu.xyz:9000/repository/maven-public/</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></repository></repositories><!--插件庫地址--><pluginRepositories><pluginRepository><id>lizhiyu</id><url>http://www.lizhiyu.xyz:9000/repository/maven-public/</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></pluginRepository></pluginRepositories></profile></profiles><!--激活配置--><activeProfiles><activeProfile>lizhiyu</activeProfile></activeProfiles> </settings>

私有庫和插件庫的url如下

修改pom文件連接私服

修改項目中的配置文件pom,會覆蓋maven中的setting配置文件

<properties><java.version>1.8</java.version><spring-cloud.version>Hoxton.SR8</spring-cloud.version><nacos.version>2.2.3.RELEASE</nacos.version><swagger.version>2.8.0</swagger.version></properties><profiles><!-- 開發環境配置 --><profile><id>dev</id><properties><sino.nexus.url>https://maven.aliyun.com/repository/public</sino.nexus.url></properties><activation><!-- 設置默認激活這個配置 --><activeByDefault>true</activeByDefault></activation></profile><!-- 發布環境配置 --><profile><id>publish</id><properties><sino.nexus.url>http://bjmaven.aviva-cofco.com.cn/repository/internal/</sino.nexus.url></properties></profile></profiles><!--dependency和 dependencyManagement區別在于--><!--dependencyManagement可以允許子項目修改版本--><dependencyManagement><dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-dependencies</artifactId><version>${spring-cloud.version}</version><type>pom</type><scope>import</scope></dependency></dependencies></dependencyManagement><dependencies></dependencies><modules><!-- 活動量服務 --><module>app-activity-server</module><!-- 后臺管理和批處理服務服務 --><module>app-manage-server</module></modules><repositories><repository><id>nexus</id><url>http://bjmaven.aviva-cofco.com.cn/repository/internal/</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></repository></repositories><pluginRepositories><pluginRepository><id>nexus</id><url>http://bjmaven.aviva-cofco.com.cn/repository/internal/</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></pluginRepository></pluginRepositories>

將項目打成jar包上傳私服

先將本地maven連接私服,然后項目中pom文件添加配置信息,然后在項目中deploy發布即可

pom中配置信息如下

<distributionManagement><repository>這個id一定要和maven中配置的信息相同<id>lizhiyu-releases</id><name>Ruizhi Release Repository</name><url>http://www.lizhiyu.xyz:9000/repository/maven-releases/</url></repository> ?<snapshotRepository>這個id一定要和maven中配置的信息相同<id>lizhiyu-snapshots</id><name>Ruizhi Snapshot Repository</name><url>http://www.lizhiyu.xyz:9000/repository/maven-snapshots/</url></snapshotRepository></distributionManagement>

pom.xml 遠程倉庫的配置 id要跟本地maven的setting.xml中的server中的id相同
pom.xml 遠程倉庫的配置 url要跟nexus中的url相同
url地址如下

上傳jar包


引入jar包

<dependency><groupId>com.lizhiyu</groupId><artifactId>test</artifactId><version>1.0</version> </dependency>

總結

以上是生活随笔為你收集整理的志宇-nexus学习的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。