版本3.57.0-01

Could not lock User prefs

从版本3.38.1-01升级至3.57.0-01,出现以下问题:

1
2
3
4
5
6
7
8
9
2023-07-19 10:32:11,399+0800 WARN  [Timer-0] *SYSTEM java.util.prefs - Could not lock User prefs.  Unix error code 2.
2023-07-19 10:32:11,400+0800 WARN [Timer-0] *SYSTEM java.util.prefs - Couldn't flush user prefs: java.util.prefs.BackingStoreException: Couldn't get file lock.

2023-07-19 10:31:32,170+0800 WARN [qtp1730890429-1558] *UNKNOWN java.util.prefs - Could not lock User prefs. Unix error code 2.
2023-07-19 10:31:32,171+0800 WARN [qtp1730890429-1558] *UNKNOWN com.sonatype.nexus.plugins.healthcheck.service.impl.EulaServiceImpl - Could not sync EULA preferences
java.util.prefs.BackingStoreException: Couldn't get file lock.
at java.util.prefs.FileSystemPreferences.sync(FileSystemPreferences.java:742)
at com.sonatype.nexus.plugins.healthcheck.service.impl.EulaServiceImpl.isEulaAccepted(EulaServiceImpl.java:57)
...

-Djava.util.prefs.userRoot=/opt/sonatype/sonatype-work/nexus3/javaprefs

版本3.38.1-01

nexus容器hung住了

group组下成员代理仓库挂了,导致download很慢

1
2
3
4
5
6
7
8
2023-07-11 16:03:02,780+0800 INFO  [qtp759070710-566]  *UNKNOWN org.sonatype.nexus.repository.httpclient.internal.HttpClientFacetImpl - Repository status for maven-shunguang changed from AVAILABLE to AUTO_BLOCKED_UNAVAILABLE until 2023-07-11T16:03:42.779+08:00 - reason java.net.SocketTimeoutException: Read timed out for http://10.9.10.81:80
2023-07-11 16:03:02,780+0800 WARN [qtp759070710-566] *UNKNOWN org.sonatype.nexus.repository.maven.internal.orient.MavenProxyFacet - Exception java.net.SocketTimeoutException: Read timed out checking remote for update, proxy repo maven-shunguang failed to fetch icbc/api-sdk-cop-io/1.0/api-sdk-cop-io-1.0.pom, content not in cache.

2023-07-11 15:58:59,025+0800 INFO [qtp759070710-836] *UNKNOWN org.sonatype.nexus.repository.httpclient.internal.HttpClientFacetImpl - Repository status for maven-mdpm changed from AVAILABLE to AUTO_BLOCKED_UNAVAILABLE until 2023-07-11T15:59:39.025+08:00 - reason java.net.SocketTimeoutException: Read timed out for http://mdpm.haier.net:8082
2023-07-11 15:58:59,026+0800 WARN [qtp759070710-836] *UNKNOWN org.sonatype.nexus.repository.maven.internal.orient.MavenProxyFacet - Exception java.net.SocketTimeoutException: Read timed out checking remote for update, proxy repo maven-mdpm failed to fetch com/syn/prometheus-spring-boot-autoconfigure/1.0.1/prometheus-spring-boot-autoconfigure-1.0.1-sources.jar, content not in cache.

2023-07-11 16:07:25,408+0800 INFO [qtp759070710-861] *UNKNOWN org.sonatype.nexus.repository.httpclient.internal.HttpClientFacetImpl - Repository status for maven-shunguang changed from AVAILABLE to AUTO_BLOCKED_UNAVAILABLE until 2023-07-11T16:08:05.408+08:00 - reason java.net.SocketTimeoutException: Read timed out for http://10.9.10.81:80
2023-07-11 16:08:05,473+0800 INFO [Check Status http://10.9.10.81:80] *UNKNOWN org.sonatype.nexus.repository.httpclient.internal.HttpClientFacetImpl - Repository status for maven-shunguang changed from AUTO_BLOCKED_UNAVAILABLE to AVAILABLE - reason n/a for n/a

mvn deploy 第三方jar包到nexus,自动解析出来的pom信息不全

  • 项目内二方包,idea Maven Lifecycle deploy 相当于 mvn deploy:deploy

  • Nexus页面UI上传构件

    直接上传到 Nexus 的 Maven 仓库对应的 REST API。

  • 命令mvn deploy:deploy-file

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    mvn deploy:deploy-file 
    -Dmaven.test.skip=true
    -DgroupId=com.example
    -DartifactId=demo
    -Dversion=1.0.0
    -Dpackaging=jar
    -Dfile=demo-1.0.0.jar
    -DrepositoryId=x-repo
    -Durl=http://localhost:8081/nexus/content/repositories/thirdparty/
    -DpomFile=pom.xml

    当执行 mvn deploy 时,Mavenmaven-deploy-plugin会将构件(jar,pom 等)上传到 Nexus 的 Maven 仓库对应的 REST API

    • maven-deploy-plugin
      1. initProperties,如果没有-DpomFile指定pomFile,会去META-INF/maven/.*/pom\\.xml找pom文件
      2. 如果查找失败,pom == null && generatePom,则生成一个最简单的pom。
      3. artifactDeployer.deploy( getSession().getProjectBuildingRequest(), deploymentRepository, deployableArtifacts );

        最终将文件上传到-Durl指定的仓库地址。
    • nexus-repository-maven
      Nexus 的 Maven 仓库功能(nexus-repository-maven 模块)会处理这个 REST API 请求。
      如果不指定-DpomFile,Nexus会默认generatePom为true,只会生成一个最简单的pom,缺少依赖,会导致依赖该组件的服务无法获取组件的依赖。

批量deploy jar包