当前位置: 首页 > news >正文

服装网站的设计理念seo还有用吗

服装网站的设计理念,seo还有用吗,和恶魔做交易的网站,计算机网站设计怎么做目录 1 现状2 当前解决3 更好的解决3.1 下载 Maven localRepository 工具包3.2 上传本地 localRepository 包3.3 清理 localRepository 中指定后缀的文件 1 现状 在使用 Maven 时,我们可能会经常与本地仓库和私服仓库打交道。 例如对于本地仓库,因为某…

目录

  • 1 现状
  • 2 当前解决
  • 3 更好的解决
    • 3.1 下载 Maven localRepository 工具包
    • 3.2 上传本地 localRepository 包
    • 3.3 清理 localRepository 中指定后缀的文件

1 现状

在使用 Maven 时,我们可能会经常与本地仓库和私服仓库打交道。

例如对于本地仓库,因为某些文件位拉取到,会在本地仓库的项目目录下产生 .lastUpdated 后缀的文件,有时编译项目时为了更快的重新再次拉取正确的包,还不得不手动清除这些文件。

而对于私服,如果是公司自己的私服,不巧的是公司的 Maven 私服(例如 Nexus)又无法访问外网,在公司内网使用公司私服编译项目时,我们期望上传上自己的依赖包(此时往往是很多的文件),就不得不手动一个一个上传,如果动手能力比较强的,可以根据对应环境编写一个小脚本执行。

2 当前解决

如果是在 Linux 服务,可以通过如下的 Shell 命令清除本地仓库下所有的 .lastUpdated 后缀的文件目录,但如果是 Windows 系统或者其他不支持 Shell 的系统,就不得不查找对应系统的查找和清除文件夹的命令了。

find ~/.m2/repository/ -regex ".*\.lastUpdated" | xargs dirname | xargs rm -rf

对于向自己私服发布包的情况,一般有两种方式,第一种是通过Maven 私服的管理页面提供的功能进行上传,第二种是通过 mvn deploy 命令上传。

对于本地系统安装了 maven 的,可以使用 Maven 命令上传,命令如下:

mvn -s /Users/yoreyuan/code/yore/settings.xml deploy:deploy-file \
-Dfile=/Users/yoreyuan/.m2/xxx/1.0.0/xxx-1.0.0.jar \
-DpomFile=/Users/yoreyuan/.m2/xxx/1.0.0/xxx-1.0.0.pom \
-Durl=http://nexus.yore.cn/repository/maven-releases \
-DrepositoryId=yore_nexus -X -Dpackaging=jar

如果顺利的话,非常清爽的成功了,但紧接着可能会遇到如下的问题:
【问题 1】如果包非常多,上面的命令一个一个执行简直是噩梦。对于会 Shell或 Python 的,则可能想到编写一个脚本。但如果不巧的是使用的是 Windows 系统的 Java 开发者,其开发环境没有 Shell 和 Python 如何上传呢?最终可能在公司找了一个Linux服务器,配上环境,把自己的本地的Maven localRepository 打包上传到公司服务器上,然后又编写脚本,执行脚本,循环上传这些包,最终费了好大劲终于上传上了,短暂的开心后,突然却又遇到了下面的问题。

【问题 2】使用公司的私服来编译自己项目时,竟然报缺包。经过排查,发现上面的命令仅仅上传了 jar 包,例如 xxx-tests.jarxxx-sources.jarxxx-test-sources.jarxxx-linux-x86_64.exe 等都没有上传,对脚本熟悉的,可能马上花一些时间脚本就改好了,对于脚本不太熟悉的 java 开发者,可能就在一次一次报错中找到缺失的包,通过 Nexus 页面上传了,终于可以编译过了。自己非常非常的开心,于是把自己历尽千辛万苦实践可行的方法分享给公司其他小伙伴

Nexus Upload Web UI

【问题 3】可运行了一段时间,在某天晚上流水线出包的时候突然自己的项目编译报错了,竟然提示有个包神奇的又找不到了。其实最苦恼还有,包编译出来了,运行却失败了,一通排查,竟发现依赖的某个包的版本使用的却是另外一个版本的包。望着一串串流水线异常日志,此时终于又陷入了沉思。

经过一段时间的排查,终于发现不知道是哪个大聪明(也许是自己)从新上传了某个依赖,在上传某个依赖的时候,没有上传项目的 pom 文件,而是直接勾选了 Nexus Upload 页面的 Generate a POM file with these coordinates,导致私服上项目中很重要的依赖的 pom 中依赖信息缺失。此时如果在没有显示引用依赖的情况下,可能会从其他依赖集成过来某个包,如果包存在就顺利编译成功了,但可能运行的时候发现类缺失、方法缺失等等异常,而如果包不存在则直接在流水线编译的时候就异常了。
Generate a POM file with these coordinates
所以面对这种情况,排查私服上 pom 文件,如果有缺失的,手动删除,单独上传完整的 pom 文件,如下图,jar 上传后(千万不要勾选 Generate a POM file with these coordinates),然后再上传一次 pom 文件(此时 GAV 信息是灰色的,直接上传即可)。
upload pom file

3 更好的解决

一路走来,坑坑洼洼,磕磕绊绊,细节那么多,怎么保证身边其他同事不会一不小心再犯同样的错呢?有没有更好的解决方案呢?

答案肯定是有滴,下面来介绍一个实用的工具 tools-maven-localRepository,这个项目是使用 go 语言编写的一个 Maven localRepository 工具。支持的操作系统有 Linux、Windows、Mac OS,可以直接指定本地 localRepository 路径即可将此路径下的所有包上传到 Maven 私服上,也支持清理 localRepository 中指定后缀的文件。

环境要求,系统中需要安装 JDK 和 Maven(对于 Java 开发,开发环境中一般都有,如果没有需要先安装配置下)

3.1 下载 Maven localRepository 工具包

使用也非常简单,访问 tools-maven-localRepository/releases/tag/v1.0.0
tools-maven-localRepository/releases
下载编译好的工具包 tools_maven_localRepository-bin.zip,解压,解压后目录如下

tools_maven_localRepository
├── config.yaml.template    # 应用的配置文件模板
├── darwin-amd64    # Mac OS
│   └── tools_localRepo
├── linux-amd64     # linux OS
│   └── tools_localRepo
├── readme.md
├── settings.xml.template       # Maven settings.xml 配置文件模板
└── windows-amd64   # Windows OS└── tools_localRepo

拷贝 settings.xml.template 为 settings.xml,简单配置如下信息(主要是 servers 中的私服账号信息):

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.2.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 http://maven.apache.org/xsd/settings-1.2.0.xsd"><!--localRepository>/home/yore/.m2/repository</localRepository--><pluginGroups></pluginGroups><proxies></proxies><servers><server><id>yore_nexus</id><username>yore</username><password>123456</password></server></servers><mirrors><mirror><id>yore_nexus</id><mirrorOf>*</mirrorOf><url>http://nexus.yore.cn/repository/maven-public</url></mirror></mirrors><profiles><profile><id>yore_nexus</id><repositories><repository><id>yore_nexus</id><name>yore nexus</name><url>http://nexus.yore.cn/repository/maven-public</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></repository></repositories></profile></profiles><activeProfiles><activeProfile>yore_nexus</activeProfile></activeProfiles>
</settings>

3.2 上传本地 localRepository 包

拷贝 config.yaml.template 为 config.yaml,简单配置如下信息:

# 是否输出项目的 debug 信息
verbose: false
logLevel: "INFO"# Maven localRepository 本地路径
localRepository: "~/.m2/repository"deploy:enable: truecommandName: "/usr/local/bin/mvn"# Alternate path for the user settings filesettingXml: "~/.m2/settings.xml"# The ID of the repositoryid: "yore_nexus"# The URL of the repository mavenurl: "http://nexus.yore.cn/repository/maven-releases"# Output maven debugging informationdebug: false# The list of file suffixes to be ignoredexcludeSuffixs:- ".DS_Store"- ".asc"- ".lastUpdated"- ".md5"- ".repositories"- ".sha1"- ".sha256"- ".sha512"- ".xml"clean:enable: false

主要关注如下几个配置

  • localRepository: Maven localRepository 本地路径
  • deploy.enable: 启用 deploy
  • deploy.settingXml: Maven 的 setting.xml 配置路径
  • deploy.id: 私服仓库的 ID,需要与 setting.xml 中配置的私服账号 ID 一致
  • deploy.url: 私服仓库的地址

执行如下命令开始上传

./tools_localRepo --config ./config.yaml

如果需要输出项目更详细的信息可以将 verbose 设置为 true,如果需要输出 Maven 执行的更详细的信息,可以将 deploy.debug 设置为 true。

3.3 清理 localRepository 中指定后缀的文件

拷贝 config.yaml.template 为 config.yaml,简单配置如下信息:

# 是否输出项目的 debug 信息
verbose: false
logLevel: "INFO"# Maven localRepository 本地路径
localRepository: "~/.m2/repository"deploy:enable: falseclean:# If it is in cleaning mode, the list of file suffixes that will be cleaned upenable: truesuffixs:- ".DS_Store"- ".lastUpdated"

主要关注如下几个配置

  • localRepository: Maven localRepository 本地路径
  • deploy.enable: 关闭 deploy
  • clean.enable: 启用 clean
  • clean.suffixs: 需要清理 localRepository 中的后缀文件列表

执行如下命令开始上传

./tools_localRepo --config ./config.yaml

同样,如果需要输出项目更详细的信息可以将 verbose 设置为 true,如果需要输出 Maven 执行的更详细的信息,可以将 deploy.debug 设置为 true。

http://www.ds6.com.cn/news/13906.html

相关文章:

  • 江苏省昆山市网站制作广州网站优化推广方案
  • 深圳网站设计公司行业济宁百度推广价格
  • 深圳网站建设价格多少汕头seo网站建设
  • dedecms双语网站百度seo排名工具
  • 软件商城有哪些seo软件开发
  • 磁力链接 网站怎么做的西安seo外包
  • 网站开发编程河北疫情最新情况
  • 触屏版网站开发样式百度快照查询
  • 天猫商城商品来源南通seo网站优化软件
  • 电商网站html模板下载网站推广优化排名seo
  • 可靠的东莞网站推广灰色词排名代做
  • 泰安网站建设最好app推广代理
  • 网站建设会用什么软件有哪些seo网络推广是什么意思
  • java做网站导航栏seo推广教程
  • html代码入门基础深圳网站关键词优化推广
  • 新沂网站设计seo是什么的缩写
  • 网站页面高度网络宣传
  • dedecms新网站 上传到万网的空间做企业推广的公司
  • 代做毕设的网站网站优化入门免费教程
  • 室外建筑网站涟源网站seo
  • 青岛 建网站关键词排名优化教程
  • 山东郓城住房和城乡建设厅网站一个免费的网站
  • WordPress 附件上传优化一个网站需要多少钱
  • 网站建设 网络推广市场营销专业
  • 长沙网站seo多少钱泾县网站seo优化排名
  • 网站搭建项目描述各地疫情最新消息
  • 企业网站管理系统(多语言)百度云网页版入口
  • 网站底部分享怎么做南宁百度关键词排名公司
  • 开网店需要自己做网站吗站长之家官网入口
  • 做seo要明白网站内容乃重中之重福建seo快速排名优化