Installation of private server Nexus

1 Download
  https://www.sonatype.com/download-oss-sonatype
2 Installation and configuration
  1) Unzip
  2) Add the unzip directory \nexus-2.14.0-01\bin to the path environment variable
  3) Execute the cmd window The following
     Usage appears on nexus: nexus { console : start : stop : restart : install : uninstall }
  4) Modify the configuration file
    and open nexus-2.14.0-01\bin\jsw\conf\wrapper.conf Find
   # Set the JVM executable
   # ( modify this to absolute path if you need a Java that is not on the OS path)
    wrapper.java.command=java (here changed to java command file path)
   5) Execute nexus install to install
   6) Start nexus start and it will start or Find nexus in "Services" to start
   7) Open the browser and enter the following URL
      http://127.0.0.1:8081/nexus/
      login user name and password admin/admin123 All warehouses
   (8) The downloaded jar packages are stored in
    
  Installation directory      \sonatype-work\nexus\storage   3 The   mvn

deploy command submits the code to the factory or warehouse Private server download (separate project)





  
<repositories>
		<repository>
			<id>nexus</id>
			<name>nexus Respository</name>
			<url>http://127.0.0.1:8081/nexus/content/groups/public/</url>
			<releases>
				<enabled>true</enabled>
			</releases>
			<snapshots>
				<enabled>true</enabled>
			</snapshots>
		</repository>
	</repositories>
      <!-- configure jar-->
        <dependency>
			<groupId>org.eclipse.jetty</groupId>
			<artifactId>jetty-server</artifactId>
			<version>9.4.0.RC0</version>
		</dependency>

    It can be seen that the download has been successful as shown in Figure



6. Modify the setting.xml (all items)
    1) As long as the setting.xml is modified, be sure to execute
     


  2) profile But if the private server cannot be accessed, you can also download it from the central factory.
     Note that the central factory can be installed in the installation directory. \lib\maven-model-builder-3.3.9.jar find pom-4.0.0.xml and see it
   
<profiles>
     <profile>
      <id>nexus</id>

      <repositories>
		<repository>
			<id>nexus</id>
                        <name>nexus repository</name>
			<url>私服URL</url>
			<releases>
				<enabled>true</enabled>
			</releases>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
		</repository>
	</repositories>
    </profile>  
  
    </profiles>
    <!-- Only activation will take effect-->
     <activeProfiles>
       <activeProfile>nexus</activeProfile>
      </activeProfiles>

  3) mirror can be configured to download only from the central factory

   
<mirror>
      <id>nexus</id>
      <mirrorOf>*</mirrorOf>
      <name>Human Readable Name for this Mirror.</name>
      <url>私服URL</url>
    </mirror>


   Note that this may be a problem. If the local warehouse has a plug-in but the private server warehouse does not have a plug-in, an error will be reported. Solution
   When you copy the downloaded local warehouse to the private server warehouse, you need to update the index (Repair index), which is slow. You need to wait for a while and then recompile.
6 Configuration Post
   1) pom.xml configuration
  
<distributionManagement>
		<repository>
			<id>user-release</id>
			<name>user release respo</name>
			<url>http://127.0.0.1:8081/nexus/content/repositories/releases/</url>
		</repository>
		<snapshotRepository>
			<id>user-snapshot</id>
			<name>user snapshot respo</name>
			<url>http://127.0.0.1:8081/nexus/content/repositories/snapshots/</url>
		</snapshotRepository>
	</distributionManagement>

   2) setting.xml configure the publishing user for authorization
     
<servers>
	<server>
      <id>user-release</id>
      <username>deployment</username>
      <password>deployment123</password>
    </server>
    <id>user-snapshot</id>
      <username>deployment</username>
      <password>deployment123</password>
    </server>
    </servers>

      

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327060159&siteId=291194637