docker nexus maven deploy npm

Ready for docker
installation docker reference
This demo is installed on the ECS, port 8081 is occupied. This demo uses 9091

Nexus installation

# 创建数据目录
mkdir /data
# 创建数据目录
mkdir /data/nexus-data && chown -R 200 /data/nexus-data
# 启动nexus
docker run -d -p 9091:8081 --name nexus --restart=always -v /data/nexus-data:/nexus-data sonatype/nexus3:3.19.1
# 查看初始密码
cd /data/nexus-data
cat admin.password

Configuration

  • Browser open http: // localhost: 9091
  • Sign in
  • Default account admin
  • The default password just got by cat
  • log in
  • reset Password
  • 打钩 Security > Anonymous > Allow anonymous users to access the server

Maven configuration

Create maven2 aliyun proxy
  • 点击 Repository > Repositories > Create repository
  • Find maven2 (proxy)
  • Enter Name: maven-aliyun-central
  • 输入 Remote storage:http://maven.aliyun.com/nexus/content/repositories/central/
  • Select Blob store: default
  • Click Create repository
Edit maven-public
  • Click Repository> Repositories
  • Find maven-public
  • Move the maven-aliyun-central on the left from the Member repositories to the right
  • Click Save

Maven test

Edit local settings.xml

<mirrors>
	<mirror>
		<id>nexus</id>
		<mirrorOf>central</mirrorOf>
        <name>my aliyun nexus</name>
        <url>http://localhost:9091/repository/maven-public/</url>
	</mirror>
</mirros>
<servers>
	<server>
      <id>nexus-release</id>
      <username>admin</username>
      <password>刚刚admin的密码</password>
    </server>
	<server>
      <id>nexus-snapshots</id>
      <username>admin</username>
      <password>刚刚admin的密码</password>
    </server>
</servers>

Find a folder and build a pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<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>
	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.1.5.RELEASE</version>
		<relativePath/> <!-- lookup parent from repository -->
	</parent>
	<groupId>com.example</groupId>
	<artifactId>demo</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<name>demo</name>
	<description>Demo project for Spring Boot</description>

	<properties>
		<java.version>1.8</java.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter</artifactId>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>

	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>
		</plugins>
	</build>

</project>

Execute in that directory

mvn clean

Insert picture description here
deploy test, just find a jar package

mvn deploy:deploy-file -DgroupId=com.test -DartifactId=deploy-test -Dversion=0.0.1 -Dpackaging=jar -DrepositoryId=nexus-release -Dfile=gson-2.3.1.jar -Durl=http://你的ip地址:9091/repository/maven-releases/
  • repositoryId corresponds to servers.server.id
    Insert picture description here

Npm configuration

Create Blob Stores
  • 点击 Repository > Blob Stores > Create blob store
  • Enter Name: npm-blob
  • Path: /nexus-data/blobs/npm-blob
  • Click Create blob store
Create npm proxy
  • 点击 Repository > Repositories > Create repository
  • Find npm (proxy)
  • Enter Name: npm-repo-proxy
  • 输入 Remote storage:https://registry.npmjs.org
  • Choose Blob store: npm-blob
  • Click Create repository
Create npm hosted
  • 点击 Repository > Repositories > Create repository
  • Find npm (hosted)
  • Enter Name: npm-repo-hosted
  • Choose Blob store: npm-blob
  • Click Create repository
Create npm group
  • 点击 Repository > Repositories > Create repository
  • Find npm (group)
  • Enter Name: npm-repo-group
  • Choose Blob store: npm-blob
  • Move the left npm-repo-hosted and npm-repo-proxy in the Member repositories to the right
  • Click Create repository
Published 8 original articles · Likes0 · Visits 1589

Guess you like

Origin blog.csdn.net/u014655255/article/details/105465098