3.10版nexus在windows上的搭建
1.安装
当前目录下:cmd:
nexus.exe /run;
3.10以上的nexus没有了3rd_part,没有了视图化的界面。所以需要自己建一个。
需要在maven-public的group组中授权
新建用户:
然后在maven的setting.xml中添加用户校验:
<server>
<id>3rd_part</id>
<username>deployment</username>
<password>deployment123</password>
</server>
上传第三方架包的例子:
mvn deploy:deploy-file -DgroupId=com.oracle-DartifactId=ojdbc6 -Dversion=11.2.0.1.0 -Dpackaging=jar-Dfile=F:\ojdbc6-11.2.0.1.0.jar-Durl=http://118.24.13.116:8081/repository/3rd_part/ -DrepositoryId=3rd_part
可以修改中央仓库的代理地址为阿里云的:
Setting.xml的配置:
<?xml version="1.0"encoding="UTF-8"?>
<settingsxmlns="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.0http://maven.apache.org/xsd/settings-1.0.0.xsd">
<!--localRepository
| The path tothe local repository maven will use to store artifacts.
|
| Default:${user.home}/.m2/repository
-->
<localRepository>D:\maven\repository</localRepository>
<pluginGroups>
<!--pluginGroup
| Specifiesa further group identifier to use for plugin lookup.
<pluginGroup>com.your.plugins</pluginGroup>
-->
</pluginGroups>
<!--proxies
| This is alist of proxies which can be used on this machine to connect to the network.
| Unlessotherwise specified (by system property or command-line switch), the firstproxy
|specification in this list marked as active will be used.
|-->
<proxies>
<!--proxy
|Specification for one proxy, to be used in connecting to the network.
|
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>proxyuser</username>
<password>proxypass</password>
<host>proxy.host.net</host>
<port>80</port>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
-->
</proxies>
<!--servers
| This is a listof authentication profiles, keyed by the server-id used within the system.
|Authentication profiles can be used whenever maven must make a connection to aremote server.
|-->
<servers>
<server>
<id>nexus-rs</id> <!--这个ID要与下面的repository中的ID一致-->
<username>deployment</username> <!--nexus中配置的用户名密码-->
<password>deployment123</password>
</server>
<server>
<id>nexus-snapshots</id>
<username>deployment</username>
<password>deployment123</password>
</server>
<server>
<id>3rd_part</id>
<username>deployment</username>
<password>deployment123</password>
</server>
</servers>
<!--mirrors
| This is alist of mirrors to be used in downloading artifacts from remote repositories.
|
| It workslike this: a POM may declare a repository to use in resolving certainartifacts.
| However,this repository may have problems with heavy traffic at times, so people havemirrored
| it toseveral places.
|
| Thatrepository definition will have a unique id, so we can create a mirrorreference for that
| repository,to be used as an alternate download site. The mirror site will be the preferred
| server forthat repository.
|-->
<mirrors>
<!--mirror
| Specifiesa repository mirror site to use instead of a given repository. The repositorythat
| thismirror serves has an ID that matches the mirrorOf element of this mirror. IDsare used
| forinheritance and direct lookup purposes, and must be unique across the set ofmirrors.
|
<mirror>
<id>mirrorId</id>
<mirrorOf>repositoryId</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://my.repository.com/repo/path</url>
</mirror>
-->
<mirror>
<id>maven-public</id>
<mirrorOf>central</mirrorOf>
<name>maven-public</name>
<url>http://118.24.13.116:8081/repository/maven-public/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>nexus-rs</id> <!--正式仓库id-->
<!--name随便-->
<name>Nexus Release Snapshot Repository</name>
<!--地址是nexus中repository(Releases/Snapshots)中对应的地址-->
<url>http://118.24.13.116:8081/repository/maven-releases/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>nexus-snapshots</id>
<url>http://118.24.13.116:8081/repository/maven-snapshots/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories> <!--插件仓库地址,各节点的含义和上面是一样的-->
<pluginRepository>
<id>nexus-rs</id>
<name>Nexus Release Snapshot Repository</name>
<url>http://118.24.13.116:8081/repository/maven-releases/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>nexus-snapshots</id>
<url>http://118.24.13.116:8081/repository/maven-snapshots/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<!--activeProfiles
| List ofprofiles that are active for all builds.
|
<activeProfiles>
<activeProfile>alwaysActiveProfile</activeProfile>
<activeProfile>anotherAlwaysActiveProfile</activeProfile>
</activeProfiles>
-->
</settings>
Pom.xml中的配置:
<distributionManagement>
<!-- 两个ID必须与 setting.xml中的<server><id>nexus-rs</id></server>保持一致-->
<repository>
<id>nexus-rs</id>
<name>Nexus Release Repository</name>
<url>http://118.24.13.116:8081/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>nexus-snapshots</id>
<name>Nexus Snapshot Repository</name>
<url>http://118.24.13.116:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>