Nexus私有仓库+IDEA配置远程推送

目录

一、docker安装nexus本地私服,Idea通过maven配置deploy本地jar包(简单)

二、docker push镜像到第三方nexus远程私服(shell命令操作)

三、springboot通过maven插件自动生成docker镜像并push到nexus私服(难)


代码有代码的管理平台,比如GitHub、GitLab、码云等。镜像也有镜像的管理平台,比如DockerHub,以及本文中的nexus。 Nexus是当前最流行的Maven仓库管理软件。本文讲解使用nexus作为docker镜像仓库。

在这里插入图片描述

SNAPSHOT
快照版本,在 maven 中 SNAPSHOT 版本代表正式发布(release)的版本之前的开发版本,在 pom 中用 x.y-SNAPSHOT 表示。

RELEASE
发布版本,稳定版本,在 maven 中 RELEASE 代表着稳定的版本,unchange,不可改变的,在 maven 中 SNAPSHOT 与 RELEASE 版本在策略上是完全不同的方式,SNAPSHOT 会根据你的配置不同,频繁的从远程仓库更新到本地仓库;而 RELEASE 则只会在第一次下载到本地仓库,以后则会先直接从本地仓库中寻找。


一、docker安装nexus本地私服,Idea通过maven配置deploy本地jar包(简单)


使用docker将nexus拉取到本地,启动nexus容器,即可本地访问(注意初始登录密码在容器的哪个位置)。然后在Idea中进行settings.xml文件和pom.xml文件的配置。

1. 拉取nexus镜像

docker pull sonatype/nexus3

2. 启动容器

docker run -tid -p 8081:8081 --privileged=true --name nexus3 -v /docker/nexus/nexus-data:/var/nexus-data --restart=always docker.io/sonatype/nexus3
-tid  :创建守护式容器 。
-p 8081:8081 :宿主机端口(对外访问端口):容器映射端口。这2个端口可不一样。浏览器访问URL用前面个端口 。
--privileged=true :容器访问宿主机的多级目录时可能会权限不足,故给 root 权限 。
--name nexus3 :给容器取名,可任意设定。
-v $PWD/nexus-data:/var/nexus-data :把容器中的 nexus-data 目录挂载到宿主机当前路径下的 nexus-data 下。方便以后查看相关数据。$PWD :取当前路径。此处可以写死为某个完整的确定的目录。 挂载格式为: -v  宿主机目录 :容器目录 。         
--restart=always :服务挂后,自动重启 。
docker.io/sonatype/nexus3 :镜像名 。

3. 通过启动日志查看启动是否成功

docker logs -f nexus3

4. 本地访问并登陆(初始密码在容器的etc文件下,登录账户为admin)

http://ip:8081

5. 在idea的运行使用的settings文件上进行私服配置

<?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:\mvn_repo\repository</localRepository><!-- 以下配置为上传jar包配置 --><pluginGroups></pluginGroups><proxies></proxies><servers><server><!-- id,对应项目里面pom.xml里面distributionManagement配置的id --><id>maven-releases</id><!-- 登录nexus的用户名 --><username>admin</username><!-- 登录nexus的密码 --><password>admin123</password></server><server><!-- id,对应项目里面pom.xml里面distributionManagement配置的id --><id>maven-snapshots</id><!-- 登录nexus的用户名 --><username>admin</username><!-- 登录nexus的密码 --><password>admin123</password></server><!-- 配置拦截器mirror登录的用户名密码。他会拦截所有的请求到mirror指定的地址下载jar包 如果只需要去私服下载jar包则只需配置此项 --><server><!-- id,对应mirror中id --><id>nexus</id><username>admin</username><password>admin123</password></server></servers><!-- 以下配置为下载jar包配置 通用 --><mirrors><!-- 强制让jar包下载走私服 --><mirror><id>nexus</id><mirrorOf>*</mirrorOf><url>http://192.168.65.129:8081/repository/maven-public/</url></mirror></mirrors><profiles><profile><!-- 对应activeProfiles-activeProfile的内容 --><id>nexus</id><!-- 仓库地址 --><repositories><repository><!-- 私服id,覆盖maven-model模块下的父id,让maven不走中央仓库下载,走私服下载 --><id>central</id><!-- 名字 --><name>Nexus</name><!-- 私服地址,写central后,会去mirror里面找 --><url>http://central</url><!-- 支持releases版本 --><releases><enabled>true</enabled></releases><!-- 支持snapshots版本 --><snapshots><enabled>true</enabled></snapshots></repository></repositories><!-- 插件地址 --><pluginRepositories><pluginRepository><id>central</id><name>Nexus Plugin Repository</name><url>http://central</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></pluginRepository></pluginRepositories><!-- 配置全局的url地址 供上传jar包时动态获取 --><properties><ReleaseRepository>http://192.168.65.129:8081/repository/maven-releases/</ReleaseRepository><SnapshotRepository>http://192.168.65.129:8081/repository/maven-snapshots/</SnapshotRepository></properties></profile></profiles><!-- 选择使用的profile --><activeProfiles><activeProfile>nexus</activeProfile><!-- <activeProfile>rdc</activeProfile>--></activeProfiles></settings>

6. 在项目的pom.xml文件中配置推送url地址

 <distributionManagement><repository><id>nexus</id><name>nexus</name><url>http://xxxx:port/repository/maven-snapshots/</url></repository><snapshotRepository><id>maven-snapshots</id><name>maven-snapshots</name><url>http://xxxx:port/repository/maven-snapshots/</url></snapshotRepository></distributionManagement>

7. 执行命令,推送 jar 到私服

 mvn  clean  deploy -Dmaven.test.skip=true 

二、docker push镜像到第三方nexus远程私服(shell命令操作)

这里的nexus私服是公司配的,用于组内项目的jar包、镜像管理仓库。

   step1: 本地登录nexus(输入用户名和密码)

docker login nexus.***.com:8012/

说明:8081是nexus的访问地址,8012端口是在nexus上设置的推送地址,也可用于登录。

   step2:查看本地镜像(以镜像openjdk:8-jdk-alpine为例)

   step3:tag镜像

  • docker tag openjdk:8-jdk-alpine nexus.***.com:8012/ddpt/openjdk:8-jdk-alpine
    

    step4:push镜像

  • docker push nexus.***.com:8012/ddpt/openjdk:8-jdk-alpine
    

    三、springboot通过maven插件自动生成docker镜像并push到nexus私服(难)

          需求:在Springboot项目中通过maven配置+Dockerfile文件+setting文件配置,实现Springboot项目的自动打包镜像,自动推送到远程nexus私服。

step1:Dockerfile文件编写。

FROM openjdk:8-jdk-alpine
VOLUME /tmp
#把当前项目下web-app-template-1.0.0.jar 改名为web-app-template.jar添加到镜像中
ADD web-app-template-1.0.0.jar web-app-template.jar
#指定端口,最好写与项目配置的端口
EXPOSE 8081
#在镜像中运行/web-app-template.jar包,这样在运行镜像的时候就可以启动好web-app-template.jar
#-Djava.security.egd=file:/dev/./urandom 是一个启动参数的优化,用于解决应用可能(在需要大量使用随机数的情况下)启动慢的问题
#(应用的sessionID是通过该参数的配置快速产生的随机数)
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/web-app-template.jar"]

step2:settings.xml文件中配置用户名、密码和邮箱

 <server><id>docker-nexus</id><username>p****DockerUser</username><password>l****pB</password><configuration><email>liu****@***.***.com</email></configuration></server>

step3:pom.xml文件配置

  <properties><docker.repo>nexus.****.com:8012</docker.repo><docker.repository>webapptemplate</docker.repository><skipTests>true</skipTests></properties><!-- The configuration of maven-assembly-plugin --><plugin><groupId>com.spotify</groupId><artifactId>docker-maven-plugin</artifactId><version>0.4.13</version><configuration><imageName>${docker.repository}/${project.artifactId}:${project.version}_SNAPSHOT</imageName><!--指定dockerFile的路径 --><dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory><!--docker server地址 docker服务端地址,即Docker安装地址,并开启2375端口(也可以安装在本地并开启2375端口)--><dockerHost>http://10.154.7.202:2375</dockerHost><serverId>docker-nexus</serverId><registryUrl>http://nexus.cmss.com:8082/webapptemplate/</registryUrl><resources><resource><targetPath>/</targetPath><directory>${project.build.directory}</directory><include>${project.build.finalName}.jar</include></resource></resources></configuration><executions><!--绑定Docker build镜像 命令到 Maven 的package阶段--><execution><id>build-image</id><phase>package</phase><goals><goal>build</goal></goals></execution><!--绑定Docker tag镜像 命令到 Maven 的package阶段--><execution><id>tag-image</id><phase>package</phase><goals><goal>tag</goal></goals><configuration><!--镜像名称--> <image>${docker.repository}/${project.artifactId}:${project.version}_SNAPSHOT</image><!--镜像Tag名称--> <newName>${docker.repo}/${docker.repository}/${project.artifactId}:${project.version}_SNAPSHOT</newName><forceTags>true</forceTags></configuration></execution><!--绑定Docker push镜像 命令到 Maven 的package阶段--><execution><id>push-image</id><phase>package</phase><goals><goal>push</goal></goals><configuration><imageName>${docker.repo}/${docker.repository}/${project.artifactId}:${project.version}_SNAPSHOT</imageName></configuration></execution></executions></plugin>

step4:打包并自动推送镜像

mvn clean deploy -Dmaven.test.skip=true

成功运行日志

"D:\Program Files\Java\jdk1.8.0_191\bin\java.exe" -Dmaven.multiModuleProjectDirectory=D:\CMSSGitLab\dig-common\template\web-app-template "-Dmaven.home=C:\IntelliJ IDEA 2020.1\plugins\maven\lib\maven3" "-Dclassworlds.conf=C:\IntelliJ IDEA 2020.1\plugins\maven\lib\maven3\bin\m2.conf" "-Dmaven.ext.class.path=C:\IntelliJ IDEA 2020.1\plugins\maven\lib\maven-event-listener.jar" "-javaagent:C:\IntelliJ IDEA 2020.1\lib\idea_rt.jar=12520:C:\IntelliJ IDEA 2020.1\bin" -Dfile.encoding=UTF-8 -classpath "C:\IntelliJ IDEA 2020.1\plugins\maven\lib\maven3\boot\plexus-classworlds-2.6.0.jar" org.codehaus.classworlds.Launcher -Didea.version2020.1 --update-snapshots -s C:\Users\Administrator\.m2\settings.xml package -P dev
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.chinamobile.cmss.dig:web-app-template:jar:1.0.0
[WARNING] 'build.plugins.plugin.(groupId:artifactId)' must be unique but found duplicate declaration of plugin org.springframework.boot:spring-boot-maven-plugin @ line 279, column 21
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO] 
[INFO] -------------< com.chinamobile.cmss.dig:web-app-template >--------------
[INFO] Building web-app-template 1.0.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ web-app-template ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 6 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ web-app-template ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 25 source files to D:\CMSSGitLab\dig-common\template\web-app-template\target\classes
[INFO] /D:/CMSSGitLab/dig-common/template/web-app-template/src/main/java/com/chinamobile/cmss/dig/interceptor/HttpResponseInterceptor.java: D:\CMSSGitLab\dig-common\template\web-app-template\src\main\java\com\chinamobile\cmss\dig\interceptor\HttpResponseInterceptor.java使用了未经检查或不安全的操作。
[INFO] /D:/CMSSGitLab/dig-common/template/web-app-template/src/main/java/com/chinamobile/cmss/dig/interceptor/HttpResponseInterceptor.java: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ web-app-template ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ web-app-template ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 5 source files to D:\CMSSGitLab\dig-common\template\web-app-template\target\test-classes
[INFO] 
[INFO] --- maven-surefire-plugin:2.18.1:test (default-test) @ web-app-template ---
[INFO] Tests are skipped.
[INFO] 
[INFO] --- maven-jar-plugin:3.2.0:jar (default-jar) @ web-app-template ---
[INFO] Building jar: D:\CMSSGitLab\dig-common\template\web-app-template\target\web-app-template-1.0.0.jar
[INFO] 
[INFO] --- spring-boot-maven-plugin:2.3.1.RELEASE:repackage (repackage) @ web-app-template ---
[INFO] Replacing main artifact with repackaged archive
[INFO] 
[INFO] --- spring-boot-maven-plugin:2.3.1.RELEASE:repackage (default) @ web-app-template ---
[INFO] Replacing main artifact with repackaged archive
[INFO] 
[INFO] --- maven-assembly-plugin:3.3.0:single (make-assembly) @ web-app-template ---
[INFO] Reading assembly descriptor: profile/dev/package.xml
[INFO] Building tar: D:\CMSSGitLab\dig-common\template\web-app-template\target\web-app-template-1.0.0-server.tar.gz
[INFO] 
[INFO] --- docker-maven-plugin:0.4.13:build (build-image) @ web-app-template ---
[INFO] Copying D:\CMSSGitLab\dig-common\template\web-app-template\target\web-app-template-1.0.0.jar -> D:\CMSSGitLab\dig-common\template\web-app-template\target\docker\web-app-template-1.0.0.jar
[INFO] Copying D:\CMSSGitLab\dig-common\template\web-app-template\src\main\docker\Dockerfile -> D:\CMSSGitLab\dig-common\template\web-app-template\target\docker\Dockerfile
[INFO] Building image webapptemplate/web-app-template:1.0.0_SNAPSHOT
Step 1/5 : FROM openjdk:8-jdk-alpine---> a3562aa0b991
Step 2/5 : VOLUME /tmp---> Using cache---> 3a9992956a89
Step 3/5 : ADD web-app-template-1.0.0.jar web-app-template.jar---> 30b7fcaf08ed
Removing intermediate container c555a3b04b5a
Step 4/5 : EXPOSE 8081---> Running in d15cfd67a278---> 5d6a58f1218c
Removing intermediate container d15cfd67a278
Step 5/5 : ENTRYPOINT java -Djava.security.egd=file:/dev/./urandom -jar /web-app-template.jar---> Running in 2fbb8ceefe70---> c8cb14dd046c
Removing intermediate container 2fbb8ceefe70
Successfully built c8cb14dd046c
[INFO] Built webapptemplate/web-app-template:1.0.0_SNAPSHOT
[INFO] 
[INFO] --- docker-maven-plugin:0.4.13:tag (tag-image) @ web-app-template ---
[INFO] Creating tag nexus.cmss.com:8012/webapptemplate/web-app-template:1.0.0_SNAPSHOT from webapptemplate/web-app-template:1.0.0_SNAPSHOT
[INFO] 
[INFO] --- docker-maven-plugin:0.4.13:push (push-image) @ web-app-template ---
[INFO] Pushing nexus.cmss.com:8012/webapptemplate/web-app-template:1.0.0_SNAPSHOT
The push refers to a repository [nexus.cmss.com:8012/webapptemplate/web-app-template]
107680152efb: Preparing 
ceaf9e1ebef5: Preparing 
9b9b7f3d56a0: Preparing 
f1b5933fe4b5: Preparing 
ceaf9e1ebef5: Layer already exists 
9b9b7f3d56a0: Layer already exists 
f1b5933fe4b5: Layer already exists 
107680152efb: Pushing [>                                                  ] 524.8 kB/58.48 MB
107680152efb: Pushing [=>                                                 ] 2.196 MB/58.48 MB
107680152efb: Pushing [===>                                               ] 3.867 MB/58.48 MB
107680152efb: Pushing [====>                                              ] 5.538 MB/58.48 MB
107680152efb: Pushing [======>                                            ] 7.209 MB/58.48 MB
107680152efb: Pushing [========>                                          ] 9.438 MB/58.48 MB
107680152efb: Pushing [=========>                                         ] 11.11 MB/58.48 MB
107680152efb: Pushing [===========>                                       ] 13.34 MB/58.48 MB
107680152efb: Pushing [=============>                                     ] 15.57 MB/58.48 MB
107680152efb: Pushing [==============>                                    ] 17.24 MB/58.48 MB
107680152efb: Pushing [================>                                  ] 19.46 MB/58.48 MB
107680152efb: Pushing [==================>                                ] 21.69 MB/58.48 MB
107680152efb: Pushing [====================>                              ] 23.92 MB/58.48 MB
107680152efb: Pushing [======================>                            ] 26.15 MB/58.48 MB
107680152efb: Pushing [========================>                          ] 28.38 MB/58.48 MB
107680152efb: Pushing [==========================>                        ] 30.61 MB/58.48 MB
107680152efb: Pushing [============================>                      ] 32.83 MB/58.48 MB
107680152efb: Pushing [=============================>                     ] 35.06 MB/58.48 MB
107680152efb: Pushing [===============================>                   ] 37.29 MB/58.48 MB
107680152efb: Pushing [=================================>                 ] 39.52 MB/58.48 MB
107680152efb: Pushing [===================================>               ] 41.75 MB/58.48 MB
107680152efb: Pushing [=====================================>             ] 43.98 MB/58.48 MB
107680152efb: Pushing [=======================================>           ]  46.2 MB/58.48 MB
107680152efb: Pushing [========================================>          ] 47.87 MB/58.48 MB
107680152efb: Pushing [==========================================>        ]  50.1 MB/58.48 MB
107680152efb: Pushing [============================================>      ] 52.33 MB/58.48 MB
107680152efb: Pushing [==============================================>    ] 54.56 MB/58.48 MB
107680152efb: Pushing [================================================>  ] 56.23 MB/58.48 MB
107680152efb: Pushing [=================================================> ] 58.46 MB/58.48 MB
107680152efb: Pushing [==================================================>] 58.48 MB
107680152efb: Pushed 
1.0.0_SNAPSHOT: digest: sha256:769e960e2d4981611f4312cfa1da2f752829a7d799e63bee0d7d4d139ca5fec2 size: 1159
null: null 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  48.692 s
[INFO] Finished at: 2020-07-09T10:14:03+08:00
[INFO] ------------------------------------------------------------------------

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/51398.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【科研】-- 如何将Endnote中参考文献格式插入到Word?

文章目录 如何将Endnote中参考文献格式插入到Word&#xff1f; 如何将Endnote中参考文献格式插入到Word&#xff1f; 1、首先确保Endnote和Word安装正确&#xff0c;正常可以从学校官网中下载到正版软件&#xff0c;下载后在word栏目中会出现EndNote的标签&#xff1b; 2、可…

go gorm one to one 一对一

has one 与另一个模型建立一对一的关联&#xff0c;但它和一对一关系有些许不同。 这种关联表明一个模型的每个实例都包含或拥有另一个模型的一个实例。 例如&#xff0c;您的应用包含 user 和 credit card 模型&#xff0c;且每个 user 只能有一张 credit card。 创建model …

[Linux]进程状态

[Linux]进程状态 文章目录 [Linux]进程状态进程状态的概念阻塞状态挂起状态Linux下的进程状态孤儿进程 进程状态的概念 了解进程状态前&#xff0c;首先要知道一个正在运行的进程不是无时无刻都在CPU上进行运算的&#xff0c;而是在操作系统的管理下&#xff0c;和其他正在运行…

音视频FAQ(二)视频直播延时高

摘要 延时高是实时互动技术中常见的问题之一&#xff0c;解决延时高问题需要综合考虑网络、设备、编解码算法等多个因素。解决方案包括优化设备端延时、优化网络传输延时和使用UDP进行音视频传输等。在选择音视频传输协议时&#xff0c;需要综合考虑实际需求和网络条件&#x…

Linux —— keepalived

简介 Keepalived 是一个用 C 语言编写的路由软件。这个项目的主要目标是为 Linux 系统和基于 Linux 的基础设施提供简单而强大的负载均衡和高可用性功能。 Keepalived 开源并且免费的软件。 Keepalived 的2大核心功能 1. loadbalance 负载均衡 LB&#xff1a;ipvs--》lvs软件…

Java相关知识对应leetcode

力扣账号&#xff1a;华为邮箱 类知识点力扣链接Integer转为String Character 判断字符是否是字母或者数字转为小写字母 不可修改 String 转为字符串数组 是否包含某个字符或者字符位置 可修改 StringBuffer 单个字符获取 string转为StringBufferStringBuffer转为String字符…

C语言题目 - 调用qsort函数对数组进行排序

题目 如题 思路 其实没什么难的&#xff0c;只要严格按照 qsort 函数的参数来填充即可&#xff0c;这里要用到函数指针。 qsort 函数的原型如下&#xff1a; void qsort(void *base, size_t nitems, size_t size, int (*compar)(const void *, const void *)); 参数说明&…

线性代数的学习和整理12: 矩阵与行列式,计算上的差别对比

目录 1 行列式和矩阵的比较 2 简单总结矩阵与行列式的不同 3 加减乘除的不同 3.1 加法不同 3.2 减法不同 3.3 标量乘法/数乘 3.3.1 标准的数乘对比 3.3.2 其他数乘对比 3.4 乘法 4 初等线性变换的不同 4.1 对矩阵进行线性变换 4.2 对行列式进行线性变换呢&#xf…

Maven详解

文章目录 一、引言1.1 为什么需要 Maven&#xff1f;1.2 Maven 解决了哪些问题&#xff1f;1.2.1 添加第三方jar包1.2.2 jar包之间的依赖关系1.2.3 处理jar包之间的冲突1.2.4 获取第三方jar包1.2.5 将项目拆分成多个工程模块1.2.6 实现项目的分布式部署 二、介绍三、Maven 的特…

flutter 雷达图

通过CustomPainter自定义雷达图 效果如下 主要代码 import package:flutter/material.dart; import dart:math; import dash_painter.dart; import model/charts_model.dart;class RadarChart extends StatelessWidget {final List<ChartModel> list;final double maxV…

Flutter系列文章-Flutter 插件开发

在本篇文章中&#xff0c;我们将学习如何开发 Flutter 插件&#xff0c;实现 Flutter 与原生平台的交互。我们将详细介绍插件的开发过程&#xff0c;包括如何创建插件项目、实现方法通信、处理异步任务等。最后&#xff0c;我们还将演示如何将插件打包并发布到 Flutter 社区。 …

Attention is all you need 官方 tensorflow 1.x 实现

https://github.com/tensorflow/tensor2tensor/blob/master/tensor2tensor/models/transformer.py 1&#xff0c;搭建cuda10.0环境&#xff0c; 2&#xff0c;安装tensorflow 1.14.0 3&#xff0c;安装python3的 tensor2tensor 包 4&#xff0c;示例代码&#xff1a; impor…

5.物联网LWIP之UDP编程,stm32作为服务器实现大小写转化

UDP编程模型 1.UDP C/S模型&#xff08;代码流程只需要根据以下模型去输入即可&#xff09; 2.UDP API socket int socket(int domain, int type, int protocol); domain: AF_INET 这是大多数用来产生socket的协议&#xff0c;使用TCP或UDP来传输&#xff0c;用IPv4的地址…

从0开始配置eslint

没有在.eslintrc文件中配置parserOptions指定语言版本和模块类型 {"parserOptions": {"ecmaVersion": 7, //指定es版本为es2016"sourceType": "module", //使用import导入模块} }eslint还不能识别jsx语法 {"parserOptions"…

网站是如何识别网络爬虫的?

在爬取数据时&#xff0c;你常常会遇到各种网站的反爬机制。网站是如何检测和拦截网络爬虫的呢&#xff1f;本文将为你揭秘网站使用的几种常见的反爬手段&#xff0c;并为你提供一些解决方案&#xff0c;助你越过反爬壁垒&#xff0c;提升你的实际操作效率。 一、Cookie检测 …

centos7物理机安装并配置外网访问

安装准备工作 安装之前需要准备一下&#xff0c;需要一个U盘&#xff0c;其次需要准备以下内容 1.需要centos7的ISO系统镜像 2.使用UltraISO软件写入ISO镜像 3.一台windows系统 将系统写入到U盘&#xff0c;写入步骤 打开UltraISO点击文件 → 打开&#xff0c;选择Linux镜…

Go 语言入门指南:基础语法和常用特性解析

变量 goCopy code package mainimport ("fmt""math" )func main() {// 声明并初始化变量var a "initial"// 声明并初始化多个变量var b, c int 1, 2// 声明并初始化变量&#xff0c;并推断其类型var d true// 声明变量&#xff0c;但没有初始…

告别数字化系统“物理叠加”,华为云推动智慧门店价值跃迁

文|智能相对论 作者|叶远风 有大屏幕滚动播放广告&#xff1b; 有人脸识别系统让消费者自助结账&#xff1b; 有订单管理系统综合分析一段时间内总体经营情况&#xff1b; 有全门店监控直连总部机房&#xff1b; …… 以搭载数字化系统的硬件设备为表面特征的智慧门店&a…

更改Docker的存储位置

要更改Docker的存储位置&#xff0c;可以按照以下步骤进行操作 文章目录 停止Docker服务编辑Docker配置文件 /etc/docker/daemon.json保存并关闭配置文件,并服务程序配置文件生效移动现有的Docker数据目录到新的存储路径更新文件权限以确保Docker可以访问新的数据目录启动Dock…

Windows快速关闭占用某端口的进程

在Windows操作系统中&#xff0c;你可以使用以下方法来快速关闭占用特定端口的进程&#xff0c;比如端口8848&#xff1a; 使用命令行工具 打开命令提示符&#xff08;Command Prompt&#xff09;。 输入以下命令&#xff0c;将端口号替换为你需要关闭的端口&#xff08;例如…