有人可以指出我如何将人工制品部署到本地存储库中以测试部署场景的方法吗?问题是我们使用 nexus 作为远程存储库,我想知道是否可以使用自定义名称而不是 nexus 为我们提供的名称部署我的工件。
提前致谢!
我通过brew在mac Motion Lion上安装了sonatype nexus服务器,如下所示:
\n\n\xe2\x9e\x9c ~ brew install nexus\n==> Downloading http://download.sonatype.com/nexus/oss/nexus-2.6.3-01-bundle.tar\n\nAlready downloaded: /Library/Caches/Homebrew/nexus-2.6.3-01.tar.gz\n\n==> Caveats\n\nTo have launchd, start nexus at login:\n\nln -sfv /usr/local/opt/nexus/*.plist ~/Library/LaunchAgents\n\nThen to load nexus now:\n\nlaunchctl load ~/Library/LaunchAgents/homebrew.mxcl.nexus.plist\nOr, if you don't want/need launchctl, you can just run:\n\n/usr/local/opt/nexus/libexec/bin/nexus start\n\n==> Summary\n\n /usr/local/Cellar/nexus/2.6.3-01: 285 files, 42M, built in 2 seconds\n\n\xe2\x9e\x9c ~ /usr/local/opt/nexus/libexec/bin/nexus start\n\nStarting Nexus OSS...\n\nStarted Nexus OSS.\n
Run Code Online (Sandbox Code Playgroud)\n\n但我可以\xe2\x80\x99t找到nexus服务器启动正常,8081端口未启动。
\n\n在哪里可以找到日志文件?
\n在尝试清理一些磁盘空间时,我注意到“sonatype-work/nexus/tmp”文件夹中存在许多千兆字节的数据。最大的目录称为“nexus-maven-repository-index.gz*.dir”,我正在犹豫是否删除它。这只是我可以安全删除的存储库索引的临时且未使用的副本吗?
Nexus 目录的文档没有提供有关“tmp”文件夹的足够信息。它只说它是“用于临时存储的文件夹”。
我想在maven中设置一个远程nexus存储库与我的本地存储库,当本地存储库中没有工件时,应该从我的远程存储库下载它并安装到本地存储库。我该如何设置呢?
访问本地主机中的本地 nexus 存储库时,返回码为 502。
pom.xml 看起来像这样
<repositories>
<repository>
<id>nexus</id>
<name>nexusPublic</name>
<url>http://localhost:8081/nexus/content/groups/public/</url>
</repository>
</repositories>
Run Code Online (Sandbox Code Playgroud) 我正在使用 gradle v3.4 并尝试将 jar 文件发布到 nexus。build.gradle 和 error 的相关部分复制如下:
构建.gradle
repositories {
maven {
credentials {
username project.properties['nexusUser']
password project.properties['nexusPassword']
}
url project.properties['nexusUrl']
}
mavenLocal()
mavenCentral()
jcenter()
}
Run Code Online (Sandbox Code Playgroud)
当我运行gradle clean或gradle dependencies 错误时,我收到以下错误
Could not resolve all dependencies for configuration ':classpath'.
> Authentication scheme 'all'(Authentication) is not supported by protocol 'file'
Run Code Online (Sandbox Code Playgroud)
gradle.properties
nexusUrl="http://nexus.something.com"
nexusUser="someone"
nexusPassword="somepassword"
Run Code Online (Sandbox Code Playgroud) 我已经设置了 nexus oss 3,它看起来很酷。由于 --pure-lockfile 选项,我所有的项目都是使用 yarn 安装的。
重现问题的步骤:
1. 使用私有 npm 注册表设置 nexus oss 3(如文档中所述)
2. 禁用来自 nexus oss 3 管理面板的匿名访问
3. 在带有 alpine 的 linux 服务器上尝试 yarn install --pure-lockfile (你必须有一个包托管在 package.json 中的私有 repo 上)
4. 不起作用,返回 401 错误
我尝试了一切,但我无法让纱线登录以获取这些包。
如果我使用 npm install,它可以工作。
有人可以告诉我如何使用上面的设置使纱线在 nexus oss3 中工作吗?
我在“u01/jenkins/.m2/”中有我的 settings.xml 文件。这是我必须为 nexus 部署配置的地方吗?请指教
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project jenktest: Failed to deploy artifacts: Could not transfer artifact tulsa.jenkins.test:jenktest:pom:0.0.1-20170905.090435-1 from/to snapshots (http://myhost:8081/nexus/content/repositories/snapshots): Failed to transfer file: http://myhost:8081/nexus/content/repositories/snapshots/tulsa/jenkins/test/jenktest/0.0.1-SNAPSHOT/jenktest-0.0.1-20170905.090435-1.pom. Return code is: 401, ReasonPhrase: Unauthorized. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project jenktest: Failed to deploy artifacts: Could not transfer artifact tulsa.jenkins.test:jenktest:pom:0.0.1-20170905.090435-1 from/to snapshots (http://204.26.165.206:8081/nexus/content/repositories/snapshots): Failed to transfer file: http://myhost:8081/nexus/content/repositories/snapshots/tulsa/jenkins/test/jenktest/0.0.1-SNAPSHOT/jenktest-0.0.1-20170905.090435-1.pom. Return code is: 401, ReasonPhrase: Unauthorized.
Run Code Online (Sandbox Code Playgroud) 我正在尝试制作一个 jenkins pipline,它从 git 克隆代码并构建一个 docker 映像,然后将其推送到 nexus 注册表,这就是我的 jenkins 文件中的内容:
pipeline{
agent any
environment{
DOCKERHUB_CREDENTIALS=credentials('docker_hub')
NEXUS_CREDENTIALS = credentials('nexus')
}
stages{
stage('Build'){
steps{
sh 'docker build -t my-app .'
}
}
stage('Login'){
steps{
sh 'echo $NEXUS_CREDENTIALS_PSW | docker login -u $NEXUS_CREDENTIALS_USR --password-stdin http://localhost:8095/repository/docker-private-repo/'
}
}
stage('Push'){
steps{
sh 'docker tag my-app:latest http://localhost:8095/docker-private-repo/my-app:latest'
sh 'docker push http://localhost:8095/docker-private-repo/my-app:latest'
}
}
}
post{
always{
sh 'docker logout'
}
}
}
Run Code Online (Sandbox Code Playgroud)
对于使用管道 SCM 克隆 git 代码,无论如何,构建阶段和登录阶段工作正常,但对于推送阶段,我收到此错误“错误解析参考:”http://localhost:8095/docker-private-repo/my -app:latest"不是有效的存储库/标签:无效的参考格式"我不知道标签命令有什么问题?我该如何解决这个问题?
我在 docker 容器内运行 Sonatype Nexus 3,使用以下启动命令:
docker run -d -p 80:8081 --ulimit nofile=65536:65536 --name nexus -v nexus-data:/nexus-data -e INSTALL4J_ADD_VM_PARAMS="-Xms4g -Xmx4g -XX:MaxDirectMemorySize=6717m -Djava.util.prefs.userRoot=${NEXUS_DATA}/javaprefs" sonatype/nexus3
Run Code Online (Sandbox Code Playgroud)
将 docker 镜像版本从 3.30.0 更新到 3.40.1 后,我不断收到以下有关用户首选项的警告。
2022-07-18 13:14:45,860+0000 WARN [Timer-0] *SYSTEM java.util.prefs - Couldn't flush user prefs: java.util.prefs.BackingStoreException: Couldn't get file lock.
2022-07-18 13:15:15,860+0000 WARN [Timer-0] *SYSTEM java.util.prefs - Could not lock User prefs. Unix error code 2.
Run Code Online (Sandbox Code Playgroud)
从启动命令中可以看到,用户 prefs 目录位于 docker 卷内的目录 /nexus-data/javaprefs 。我尝试在目录内查找现有的锁,但没有找到。我还尝试完全删除该目录,发现警告仍然出现,并且该文件夹本身并不是由 Nexus 创建的。
老实说,我什至不知道这是否是一个重要问题,因为几乎没有关于用户首选项文件夹的文档。
即使是关闭每 30 秒触发一次的警告日志的方法也会很有用。
- - 更新 - - …