若是構建的 n Maven 項目本地倉庫沒有對應的依賴包,那麼就會去 s Nexus 私服去下載,若是 Nexus 私服也沒有此依賴包, 就回去遠程中央倉庫下載依賴, 這些中央倉庫就是 proxy 。 Nexus 私服下載成功後再下載至本地 Maven(可是若是私服沒有網絡不能正常下載,本地也會跳過私服從新下載) apache
系統須要安裝並配置好 JDK,下載好Sonatype Nexus(版本地址:nexus-2.13.0-01-bundle.tar.gz)、maven(版本地址:apache-maven-3.3.9-bin.tar.gz)。提示:nexus3不支持maven不要下錯了,下的時候看清楚bash
mkdir nexus tar -zxvf nexus-2.13.0-01-bundle.tar.gz -c nexus
cd nexus-2.13.0-01/bin vi nexus
將 RUN_AS_USER 修改成用權限運行的用戶網絡
# If specified, the Wrapper will be run as the specified user. # IMPORTANT - Make sure that the user has the required privileges to write into the Nexus installation directory. # NOTE - This will set the user which is used to run the Wrapper as well as # the JVM and is not useful in situations where a privileged resource or # port needs to be allocated prior to the user being changed. RUN_AS_USER=root
cd nexus-2.13.0-01/bin ./nexus start
用戶權限設置oracle
<!--配置權限,使用默認用戶--> <servers> <server> <id>nexus-releases</id> <username>deployment</username> <password>deployment123</password> </server> <server> <id>nexus-snapshots</id> <username>deployment</username> <password>deployment123</password> </server> </servers>
<profiles> <profile> <!--id 須要惟一--> <id>test1</id> <activation> <activeByDefault>false</activeByDefault> <!-- jdk版本觸發激活,配置成本地的jdk版本--> <jdk>1.8</jdk> </activation> <repositories> <!-- 私有庫地址--> <repository> <id>nexus</id> <url>http://192.168.0.112: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://192.168.0.112:8081/nexus/content/groups/public/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </pluginRepository> </pluginRepositories> </profile> </profiles>
<!--激活profile--> <activeProfiles> <activeProfile>test1</activeProfile> </activeProfiles>
<distributionManagement> <repository> <id>nexus-releases</id> <name>Nexus Release Repository</name> <url>http://192.168.0.112:8081/nexus/content/repositories/releases/</url> </repository> <snapshotRepository> <id>nexus-snapshots</id> <name>Nexus Snapshot Repository</name> <url>http://192.168.0.112:8081/nexus/content/repositories/snapshots/</url> </snapshotRepository> </distributionManagement>
maven在構建(install) 的時候加上 deploy 參數就能夠將jar本地jar發佈到中央庫app
第三方jar包上傳maven
點擊3rd 而後選擇Artifacts Uploadtcp
選擇文件而後設置GAV Definition網站
選擇 Select Artifact(s) for Upload 而後選擇文件ui
點擊add 而後點擊uploadurl