Nexus build MAVEN native environment win 8 JDK 7 maven 3.2 Nexus 2.11 version Select Http://www.sonatype.org/nexus/archived
The Nexus 2.6 and 2.6+ versions require JDK 1.7 or 1.7+ versions (JDK 1.6 Please select Nexus 2.5 and below). Choose the right version based on your existing environment.
Choose nexus-2.11.0 here (if you can't open the download, you can copy the address from the new tab's address bar to the download tool such as Thunderbolt).
Download to get Nexus-2.11.0-bundle.zip compressed package. Unzip the inside of the nexus-2.11.0-02 directory, such as my E:\setup\dev\servers\nexus, and eventually get
The directory structure is E:\setup\dev\servers\nexus\nexus-2.11.0-02. Configuring the Nexus Environment Nexus_home = E:\setup\dev\servers\nexus\nexus-2.11.0-02
Path =.; %nexus_home%\bin Installing the NEXUS service if you are using the WIN8 operating system, the following actions require administrator privileges. Execute Nexus Install on the command line (WIN8 System key combination is Ctrl + X, A):
C:\windows\system32>nexus Install
Wrapper | Nexus installed. Start Nexus Execute Nexus start:c:\windows\system32>nexus start on the command line
Wrapper | Starting the Nexus service ...
Wrapper | Waiting to start ...
Wrapper | Waiting to start ...
Wrapper | Waiting to start ...
Wrapper | Nexus started. Page Access portal address: Http://localhost:8081/nexus
Login Nexus The default Administrator account is: admin, password is: admin123 stop nexus on the command line to perform Nexus Stop:c:\users\fanlychie>nexus stop
Wrapper | Stopping the Nexus service ...
Wrapper | Waiting to stop ...
Wrapper | Nexus stopped. Change the Nexus account password to first stop the Nexus, open the%nexus_home%\sonatype-work\nexus\conf\security.xml, modify it.
The Nexus password uses the SHA1 encryption algorithm (online encryption tool) to overwrite the encrypted SHA1 string (lowercase) copy with the original. Restart Nexus:nexus restart. <user>
<id>admin</id>
<firstName>Administrator</firstName>
<lastName>User</lastName>
<password>2899441143e28aee7287e8da3d7211258f5edbd3</password>
<status>active</status>
<email>[email protected]</email>
</user> Modify the Nexus port to open%nexus_home%\nexus-2.11.0-02\conf\nexus.properties and modify the value of Application-port. Restart Nexus:nexus restart.
application-port=8081
application-host=0.0.0.0
Nexus-webapp=${bundlebasedir}/nexus
Nexus-webapp-context-path=/nexus Warehouse Type Open views/repositories--repositories view
Nexus Warehouse is divided into 4 kinds, Group (warehouse Group), hosted (host warehouse), Proxy (Agent warehouse), virtual warehouse.
The artifacts we develop ourselves are usually published to the hosted repository, which proxies the remote public repositories, and a group can contain multiple hosted/proxy warehouses. Warehouse Group Open Views/repositories--repositories---public repositories and Configuration view
The left side of the configuration bar is the Warehouse Group warehouse list, the right side is the current optional warehouse, you can choose the right warehouse from the left to add to the Warehouse group on the other side, click Save.
A warehouse group typically contains multiple warehouses, and the order of the warehouse lists in the warehouse group determines the sequencing of the warehouses that are traversed during component downloads, so it is recommended that the Remote central warehouse
To the last item in the Warehouse group. The MAVEN settings.xml configuration adds the following configuration in the Settings.xml configuration file:
<servers>
<server>
<id>releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>thirdparty</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<name>nexus Public repositories</name>
<url>http://127.0.0.1:8088/nexus/content/groups/public</url>
</mirror>
The account password for the </mirrors><server> node Configuration service, which is used to authenticate identity and permissions when publishing artifacts. The <mirror> node is used for mirroring configuration, the specific usage reference maven image Configuration Publishing Widget finds the following view page in the Nexus:
Copy the above configuration and paste it into your pom.xml configuration file:
<project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"
xsi:schemalocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
<modelVersion>4.0.0</modelVersion>
<groupId>org.fanlychie</groupId>
<artifactId>proj</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<name>proj</name>
<url>http://maven.apache.org</url>
<distributionManagement>
<repository>
<id>releases</id>
<url>http://localhost:8088/nexus/content/repositories/releases</url>
</repository>
</distributionManagement>
</project> It is important to note that the ID of the repository node must be the same as the ID of the server node configured in Settings.xml, and if it is not the same, modify either party, only
To keep them consistent, the 401,reasonphrase:unauthorized error is reported when the component is released because the user cannot be authenticated.
Right-click the project, run as--and Maven build ..., enter deploy in the Goals column or execute MVN deploy at the command line (CMD), if you can see it in the console
BUILD SUCCESS, indicating that the component was published successfully. You can find this widget in the Nexus releases repository:
When releasing the component, if you want to publish the source code together (execute MVN dependency:sources can get the source code), the configuration is as follows:
<project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"
xsi:schemalocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
<modelVersion>4.0.0</modelVersion>
<groupId>org.fanlychie</groupId>
<artifactId>proj</artifactId>
<version>1.0.1</version>
<packaging>jar</packaging>
<name>proj</name>
<url>http://maven.apache.org</url>
<distributionManagement>
<repository>
<id>releases</id>
<url>http://localhost:8088/nexus/content/repositories/releases</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>install</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project> the same component is not allowed to publish two times, first modify the version of the component, and then deploy, the results
Snapshot snapshots are used to differentiate between stable and unstable artifacts (the released version is stable and the snapshot version is unstable). Component upgrades often lead to a number of instabilities that require constant repair,
Snapshots can avoid the escalation caused by the instability of the non-stop upgrade version number, resulting in the issue of version number flooding. Snapshots allow republishing without the need to change the version number of the widget.
Find the following view page in the Nexus:
Copy the above configuration and paste it into your pom.xml configuration file:
<project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"
xsi:schemalocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
<modelVersion>4.0.0</modelVersion>
<groupId>org.fanlychie</groupId>
<artifactId>proj</artifactId>
<version>2.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>proj</name>
<url>http://maven.apache.org</url>
<distributionManagement>
<repository>
<id>releases</id>
<url>http://localhost:8088/nexus/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<url>http://localhost:8088/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>install</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
The </project> version number that contains SNAPSHOT will be published to the snapshots warehouse, otherwise it will be published to the releases warehouse. Execute Publish command: mvn deploy, result
To publish a third-party component step See annotations:
The command-line mode is published:
MVN deploy:deploy-file-dgroupid= Custom groupid-dartifactid= Custom artifactid-dversion= version number-dpackaging=jar
The path to the-dfile=jar file-durl=http://127.0.0.1:8088/nexus/content/repositories/thirdparty-drepositoryid=thirdparty the remote index The following view pages are found in the Nexus:
After saving, select Administration-Scheduled Tasks in the left panel, such as:
You can see that there is a Repair repositories Index task that will automatically be removed from the panel when the task is completed, and click on the Refresh button in the upper left corner to view it. Task complete
Then go back to the repositories panel, select Central Warehouse right, select Update Index, then go back to the scheduled Tasks panel and you can see an update
Repositories index task, this task takes a long time, after the task is completed, back to the repositories panel, you can see in the Browse Index from the remote repository download back
Index file, you can search for the artifacts you want to find, even if the Nexus does not have a widget you want.
Nexus build Maven