1. Directory

mkdir -p /elf/nexus && chown -R 200:200 /elf/nexus

2. Run Container

docker run \
	--name nexus \
	-p 8081:8081 \
	--privileged=true \
	--net network-common \
	-e NEXUS_CONTEXT=nexus \
	-v /elf/nexus:/nexus-data \
	-itd sonatype/nexus3:3.64.0

3. Logger

docker logs -f nexus

4. CipherCode

# /nexus-data/admin.password

more /elf/nexus/admin.password

5. Sign In

6. Server Mirror

  • admin - nexusserverId = mirrorId

<server>
	<id>nexus-center</id>
    <username>${env.NEXUS_USERNAME}</username>
    <password>${env.NEXUS_PASSWORD}</password>
</server>

<mirror>
  	<id>nexus-center</id>
  	<mirrorOf>central</mirrorOf>
  	<url>http://192.168.0.123:8081/nexus/repository/maven-public/</url>
</mirror>

7. Pom.xml

<properties>
	<nexus.base>http://192.168.0.123:8081</nexus.base>
	<nexus.release>${nexus.base}/nexus/repository/maven-releases/</nexus.release>
	<nexus.snapshot>${nexus.base}/nexus/repository/maven-snapshots/</nexus.snapshot>
</properties>

<distributionManagement>
	<snapshotRepository>
		<id>nexus-center</id>
		<url>${nexus.snapshot}</url>
		<uniqueVersion>false</uniqueVersion>
		<releases>
			<enabled>false</enabled>
		</releases>
		<snapshots>
			<enabled>true</enabled>
		</snapshots>
	</snapshotRepository>

	<repository>
		<id>nexus-center</id>
		<url>${nexus.release}</url>
		<uniqueVersion>false</uniqueVersion>
		<releases>
			<enabled>true</enabled>
		</releases>
		<snapshots>
			<enabled>false</enabled>
		</snapshots>
	</repository>
</distributionManagement>

8. Settings.xml

<?xml version="1.0" encoding="UTF-8"?>

<settings xmlns="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.0
							  http://maven.apache.org/xsd/settings-1.0.0.xsd">

	<localRepository>D:/Install/Space/MvnRepo</localRepository>

	<pluginGroups>
		<pluginGroup>org.mortbay.jetty</pluginGroup>
		<pluginGroup>org.sonatype.plugins</pluginGroup>
	</pluginGroups>

	<proxies></proxies>

	<servers>
		<server>
			<id>nexus-center</id>
			<username>${env.NEXUS_USERNAME}</username>
			<password>${env.NEXUS_PASSWORD}</password>
		</server>
	</servers>

	<mirrors>
		<mirror>
			<id>nexus-center</id>
			<mirrorOf>central</mirrorOf>
			<url>https://maven.aliyun.com/repository/public</url>
		</mirror>

		<!--
			<url>https://maven.aliyun.com/repository/public</url>
			<url>http://192.168.0.123:8081/nexus/repository/maven-public/</url>
		-->
	</mirrors>

	<profiles>
		<profile>
			<id>Jdk17</id>
			<activation>
				<activeByDefault>true</activeByDefault>
				<jdk>17</jdk>
			</activation>
			<properties>
				<maven.compiler.source>17</maven.compiler.source>
				<maven.compiler.target>17</maven.compiler.target>
				<maven.compiler.compilerVersion>17</maven.compiler.compilerVersion>
			</properties>
		</profile>

		<profile>
			<id>Jdk21</id>
			<activation>
				<activeByDefault>false</activeByDefault>
				<jdk>21</jdk>
			</activation>
			<properties>
				<maven.compiler.source>21</maven.compiler.source>
				<maven.compiler.target>21</maven.compiler.target>
				<maven.compiler.compilerVersion>21</maven.compiler.compilerVersion>
			</properties>
		</profile>
	</profiles>

	<activeProfiles>
		<activeProfile>Jdk21</activeProfile>
	</activeProfiles>

</settings>