Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/364.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Jenkins和Perforce密码问题_Java_Maven_Jenkins_Perforce_Maven Release Plugin - Fatal编程技术网

Java Jenkins和Perforce密码问题

Java Jenkins和Perforce密码问题,java,maven,jenkins,perforce,maven-release-plugin,Java,Maven,Jenkins,Perforce,Maven Release Plugin,我正在使用Jenkins和Perforce构建一个maven项目,我需要使用maven发布插件。我已经配置了我的项目,构建工作进展顺利,直到我尝试使用相关的Jenkins插件使用maven发布插件。在试运行时,一切都进行得很顺利,但在尝试发布时,我收到了一条令人讨厌的错误消息(如下)。由于某些原因,Jenkins无法连接到P4服务器。此外,还选中了“在环境中公开P4PASSWD” 编辑-回答Technext的问题 当您说干运行时,您是仅使用Jenkins还是从命令行执行它?两者 您在哪里设置P

我正在使用Jenkins和Perforce构建一个maven项目,我需要使用maven发布插件。我已经配置了我的项目,构建工作进展顺利,直到我尝试使用相关的Jenkins插件使用maven发布插件。在试运行时,一切都进行得很顺利,但在尝试发布时,我收到了一条令人讨厌的错误消息(如下)。由于某些原因,Jenkins无法连接到P4服务器。此外,还选中了“在环境中公开P4PASSWD”

编辑-回答Technext的问题

  • 当您说干运行时,您是仅使用Jenkins还是从命令行执行它?两者
  • 您在哪里设置P4的密码?在“全局凭据”部分?在项目配置中,在源代码管理->性能->密码下
  • 您从何处获得“在环境中公开P4PASSWD”选项?同一个地方
  • 在上面的日志中,此行是否设置P4
    “d:\program files\perforce\P4.exe”集合的密码?此行显示P4参数-所有参数(包括P4PASSWD)都设置正确。我已经从明显的原因中删除了实际值
这是错误消息:

Started by user David 
[EnvInject] - Loading node environment variables.
Building on master in workspace X:\hudson\jobs\myproject\workspace
Using master perforce client: myproject
[workspace] $ "D:\Program Files\Perforce\p4.exe" workspace -o myproject
[workspace] $ "D:\Program Files\Perforce\p4.exe" login -a -p
[workspace] $ "D:\Program Files\Perforce\p4.exe" -P *** workspace -o myproject
Last build changeset: 1062732
[workspace] $ "D:\Program Files\Perforce\p4.exe" -P *** changes -s submitted -m 1 //myproject/...
Sync'ing workspace to changelist 1062732 (forcing sync of unchanged files).
[workspace] $ "D:\Program Files\Perforce\p4.exe" -P *** -s sync -f //myproject/...@1062732
Sync complete, took 108 ms
[workspace] $ cmd /c call D:\apache-tomcat-6\temp\hudson368187580614800030.bat

X:\hudson\jobs\myproject\workspace>"d:\program files\perforce\p4.exe" set 
P4CLIENT=myproject
P4PASSWD=***
P4PORT=***
P4USER=***

X:\hudson\jobs\myproject\workspace>exit 0 
Parsing POMs
Downloaded artifact ...
[workspace] $ D:/ins/Java/jdk1.7.0_10.x64/bin/java -DcreateChecksum=true -cp X:\hudson\plugins\maven-plugin\WEB-INF\lib\maven31-agent-1.4.jar;X:\hudson\tools\hudson.tasks.Maven_MavenInstallation\Maven_3.1.1\boot\plexus-classworlds-2.5.1.jar;X:\hudson\tools\hudson.tasks.Maven_MavenInstallation\Maven_3.1.1/conf/logging jenkins.maven3.agent.Maven31Main X:\hudson\tools\hudson.tasks.Maven_MavenInstallation\Maven_3.1.1 D:\apache-tomcat-6\webapps\hudson\WEB-INF\lib\remoting-2.37.jar X:\hudson\plugins\maven-plugin\WEB-INF\lib\maven31-interceptor-1.4.jar X:\hudson\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-commons-1.4.jar 51470
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven:  -B -f X:\hudson\jobs\myproject\workspace\pom.xml -DdevelopmentVersion=0.0.2-SNAPSHOT -DreleaseVersion=0.0.1 -Dresume=false release:prepare release:perform -X
Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 18:22:22+0300)
Maven home: X:\hudson\tools\hudson.tasks.Maven_MavenInstallation\Maven_3.1.1
Java version: 1.7.0_10, vendor: Oracle Corporation
Java home: D:\ins\Java\jdk1.7.0_10.x64\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows server 2008", version: "6.0", arch: "amd64", family: "windows"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from X:\hudson\tools\hudson.tasks.Maven_MavenInstallation\Maven_3.1.1\conf\settings.xml
[DEBUG] Reading user settings from C:\...\.m2\settings.xml
[INFO] Scanning for projects...
[INFO] Downloading: ...
[INFO] Downloaded: ...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] proj-parent
[INFO] proja
[INFO] projb
[INFO] projc
[INFO] test-reactor
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building test-reactor 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-release-plugin:2.5:prepare (default-cli) @ test-reactor ---
[INFO] Verifying that there are no local modifications...
[INFO]   ignoring changes on: **\release.properties, **\pom.xml.next, **\pom.xml.releaseBackup, **\pom.xml.backup, **\pom.xml.branch, **\pom.xml.tag
[INFO] No password found, proceeding without it.
[DEBUG] SCM path in pom: //depot/myproject
[DEBUG] Executing: cmd.exe /X /C "p4 -p *** where X:\hudson\jobs\myproject\workspace\pom.xml"
[DEBUG] Perforce password (P4PASSWD) invalid or unset.
[DEBUG] cannot find depot => using //depot/myproject
[DEBUG] Executing cmd.exe /X /C "p4 -d X:\hudson\jobs\myproject\workspace -p *** opened //depot/myproject/..."
[ERROR] CommandLineException Exit code: 1 - Perforce password (P4PASSWD) invalid or unset.

终于找到了解决办法。Jenkins perforce插件进行登录并发出通知单,因此我必须在“发布目标和选项”字段中添加
-Dpassword=${P4TICKET}
。它使Performce SCM提供程序使用
-P
标志运行p4命令


感谢@Technext的帮助。

当您说“干运行”时,您是仅使用Jenkins还是从命令行执行?您在哪里设置P4的密码?在“全局凭据”部分?您从何处获得“在环境中公开P4PASSWD”选项?几年前我在Perforce的经验有限,我记得我们曾经有一个设置,每天都有一个调度程序运行,用于在构建框上设置密码。在上面的日志中,这一行是否设置了P4
“d:\program files\perforce\P4.exe”set
?@Technext谢谢,请参阅编辑后的问题由于字符限制,我不得不将我的陈述分成几部分。当您已经启用“在环境中公开P4PASSWD”时,为什么要再次使用
“d:\program files\perforce\p4.exe”set
命令?您是通过批处理文件调用此set命令,还是使用了
Build>Add Build step>Execute Windows batch command
部分?在任何情况下,我都看到,在执行set命令之后,有一行代码:
X:\hudson\jobs\myproject\workspace>退出0
。这意味着Windows批处理环境(以及该环境中设置的变量)已完成,它是Jenkins构建过程的一个子外壳。在此之后,我怀疑变量(包括
P4PASSWD
)是否会出现,除非“在环境中公开P4PASSWD”工作正常。您能在批处理过程完成后尝试回显P4PASSWD变量吗?很高兴看到您终于让它工作了。请将您的解决方案标记为答案,以便帮助他人。:)
[INFO] Executing tasks
Build sequence for target(s) `main' is [main]
Complete build sequence is [main, ]

main:
     [echo] P4CLIENT [myproject]
     [echo] P4PASSWD [***]
     [echo] P4PORT   [***]
     [echo] P4USER   [***]
[INFO] Executed tasks
Notifying upstream projects of job completion
Join notifier requires a CauseAction
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building test-reactor 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-release-plugin:2.5:prepare (default-cli) @ test-reactor ---
[INFO] Verifying that there are no local modifications...
[INFO]   ignoring changes on: **\release.properties, **\pom.xml.next, **\pom.xml.releaseBackup, **\pom.xml.backup, **\pom.xml.branch, **\pom.xml.tag
[INFO] No password found, proceeding without it.
[DEBUG] SCM path in pom: //depot/myproject
[DEBUG] Executing: cmd.exe /X /C "p4 -p *** where ***\pom.xml"
[DEBUG] Perforce password (P4PASSWD) invalid or unset.
[DEBUG] cannot find depot => using //depot/myproject
[DEBUG] Executing cmd.exe /X /C "p4 -d ****\workspace -p *** opened //depot/myproject/..."
[ERROR] CommandLineException Exit code: 1 - Perforce password (P4PASSWD) invalid or unset.