c++ - Jenkinsfile 运行 qmake

标签 c++ jenkins qt5 jenkins-pipeline

我有一个包含 Jenkinsfile 的项目。

node {
 stage 'Checkout'
 checkout scm

 stage 'Build'
 qmake
 make
}

在 Jenkins 第 2 版中,我配置了一个管道,但出现以下错误:

控制台输出如下:

...
[Pipeline] stage (Build)
Entering stage Build
Proceeding
[Pipeline] } //node
[Pipeline] Allocate node : End
[Pipeline] End of Pipeline
groovy.lang.MissingPropertyException: No such property: qmake for class: groovy.lang.Binding
    at groovy.lang.Binding.getVariable(Binding.java:63)
    at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:224)
    at org.kohsuke.groovy.sandbox.impl.Checker$4.call(Checker.java:241)
    at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:238)
    at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:221)
    at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.getProperty(SandboxInvoker.java:23)
    at com.cloudbees.groovy.cps.impl.PropertyAccessBlock.rawGet(PropertyAccessBlock.java:17)
    at WorkflowScript.run(WorkflowScript:6)
    at ___cps.transform___(Native Method)
    at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:62)
    at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)
    at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:54)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
    at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
    at com.cloudbees.groovy.cps.Next.step(Next.java:58)
    at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:154)
    at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:19)
    at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:33)
    at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:30)
    at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)
    at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:30)
    at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:164)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:277)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$000(CpsThreadGroup.java:77)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:186)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:184)
    at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:47)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
    at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Finished: FAILURE

我认为 Jenkinsfile 中的 qmake 是错误的,我需要“运行 qmake”之类的东西,但我找不到。

最佳答案

Jenkinfile 是一个 groovy 脚本,你必须把它写成 groovy。

如果你想运行一个 shell 命令,你必须使用 sh 函数。

例如。

node {
 stage 'Checkout'
 checkout scm

 stage 'Build'
 sh 'qmake'
 sh 'make'
}

编辑:还要确保 ma​​keqmake 在 jenkins 用户路径中。

关于c++ - Jenkinsfile 运行 qmake,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36911166/

相关文章:

c++ - 从 C 数组移动到 std::map <int, val> 运算符 `-` 陷阱

c++ - 模板集合的不同排序方法

c++ - ZLib Inflate() 失败并显示 -3 Z_DATA_ERROR

jenkins - 使用 jenkins 远程 glassfish 部署失败

c++ - QVideoWidget 对齐时不显示任何内容

qml - 在关闭 QQuickView 或 QApplication 之前询问确认

C++ 宏(最小最大)不能正常工作

具有 Google API 的 Android 模拟器未在 Ubuntu Server 16.04 上以 Jenkins 启动

apache - Jenkins + Apache + SSL = 无可用更新

c++ - 来自 jsonModel 的 QML 中的空 TreeView