一、操做系統:Windows 10
二、nexus版本:nexus-3.0.1-01-win64apache
一、下載地址:http://www.sonatype.com/download-oss-sonatype
二、咱們下載nexus-3.0.1-01-win64.exe後雙擊安裝便可,安裝完成後默認開放8081端口。eclipse
安裝成功後有兩個默認帳號admin、anonymous,其中admin具備所有權限默認密碼admin123;anonymous做爲匿名用戶,只具備查看權限。
maven
pepositories說明ui
maven-central:maven中央庫,默認從https://repo1.maven.org/maven2/拉取jar
maven-releases:私庫發行版jar
maven-snapshots:私庫快照(調試版本)jar
maven-public:倉庫分組,把上面三個倉庫組合在一塊兒對外提供服務,在本地maven基礎配置settings.xml中使用。this
本地maven庫配置settings.xmlurl
<settings> <pluginGroups> <pluginGroup>org.sonatype.plugins</pluginGroup> </pluginGroups> <servers> <server> <id>nexus</id> <username>admin</username> <password>admin123</password> </server> </servers> <mirrors> <mirror> <id>nexus</id> <mirrorOf>*</mirrorOf> <url>http://localhost:8081/repository/maven-public/</url> </mirror> <mirror> <id>repo2</id> <mirrorOf>central</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://repo2.maven.org/maven2/</url> </mirror> </mirrors> <profiles> <profile> <id>nexus</id> <repositories> <repository> <id>central</id> <url>http://central</url> <releases><enabled>true</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>central</id> <url>http://central</url> <releases><enabled>true</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </pluginRepository> </pluginRepositories> </profile> </profiles> <activeProfiles> <activeProfile>nexus</activeProfile> </activeProfiles> </settings>
工程配置pox.xmlspa
<distributionManagement> <repository> <id>nexus</id> <name>Releases</name> <url>http://localhost:8081/repository/maven-releases</url> </repository> <snapshotRepository> <id>nexus</id> <name>Snapshot</name> <url>http://localhost:8081/repository/maven-snapshots</url> </snapshotRepository> </distributionManagement>
<build> <defaultGoal>compile</defaultGoal> <finalName>page</finalName> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <skip>true</skip> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.3</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins> </build>
編譯到maven私庫操作系統
deploy -e
項目右單擊->Run As->Maven build..
進入以下界面
3d
快照編譯:pom.xml中版本設置調試
<version>0.0.1-SNAPSHOT</version>
編譯後在nexus中看到以下圖結果,快照已經編譯到nexus中Components-> maven-snapshots。
發行版編譯:pom.xml中版本設置
<version>0.0.1-RELEASE</version>
編譯後在nexus中看到以下圖結果,發行版已經編譯到nexus中Components->maven-releases。