我正在迭代构建一个Jenkins管道共享库,所以我的Jenkinsfile更清洁一点.
我正在使用以下页面获取指导:https://jenkins.io/doc/book/pipeline/shared-libraries/.
我首先在单个文件中定义了几个方法,例如" vars/methodName.groovy
",call()
在代码中使用" "方法.这工作正常,我特别注意println
在Jenkins控制台输出中可以看到这些方法中的" "调用.
然后我决定在方法调用之间保存一些状态,所以我在" vars
"中添加了一个名为" uslutils.groovy
" 的新文件,它以这样开头(减去一些必需的导入):
class uslutils implements Serializable {
Run Code Online (Sandbox Code Playgroud)
我定义了一些with<property>
设置属性并返回它的方法.
然后我public String toString()
在" uslutils
"中写了一个" "方法,看起来像这样:
public String toString() {
println "Inside uslutils.toString()."
return "[currentBuild[${currentBuild}] mechIdCredentials[${mechIdCredentials}] " +
"baseStashURL[${baseStashURL}] jobName[${jobName}] codeBranch[${codeBranch}] " +
"buildURL[${buildURL}] pullRequestURL[${pullRequestURL}] qBotUserID[${qBotUserID}] " +
"qBotPassword[${qBotPassword}]]"
}
Run Code Online (Sandbox Code Playgroud)
然后,在我的Jenkinsfile里面,在设置了uslutils属性之后,我添加了这样一行:
println "uslutils[${uslutils}]"
Run Code Online (Sandbox Code Playgroud)
然后,我完成了我的工作,发生了奇怪的事情是我没有看到"uslutils"行,或者说Inside uslutils.toString()
.线.但是,我确实修改了我迄今为止添加的一个函数方法"uslutils"(除了"with"方法),它返回一个字符串值,我只是在值中加了一个"x".我的Jenkinsfile正在打印结果,它确实显示了额外的"x".
注意,这里没有发生错误,它似乎只是省略了println
共享库类中的输出,甚至更奇怪,省略println
了Jenkins文件中隐式调用该uslutils.toString()
方法的调用的输出.请注意,在控制台输出中看到println
原始call()
方法中的调用.
任何想法可能会发生在这里? …
我在 Jenkins 中使用 Publish Over SSH 插件将文件从本地传输到远程服务器并在远程服务器上执行一些命令。
但是,这个插件中似乎没有选项可以将文件从远程服务器下载到本地。
有人可以帮助我如何实现这一目标?
在我的package.json文件中,我声明了依赖项,其中一个来自公共注册表,另一个来自私有注册表(在本例中为Artifactory).
"dependencies": {
"vue": "^2.4.4", //public registry
"ce-ui": "http://myartifactory.com/artifactory/npm-local/ce-ui/-/ce-ui-0.0.2.tgz"
}
Run Code Online (Sandbox Code Playgroud)
我正在寻找使用插入符或tidle来声明依赖关系的方法,例如
"dependencies": {
"vue": "^2.4.4",
"ce-ui": "^0.0.2"
}
Run Code Online (Sandbox Code Playgroud)
先感谢您.
这可能是一个愚蠢的问题,但不知怎的,我无法弄明白(即使有很多已经给出的stackoverflow答案)如何做到这一点:
mvn package
,可以用java -jar
... 执行jar文件,一切正常.mvn exec:java
在命令行上调用maven命令(比如或类似的东西),Maven将从远程存储库下载jar文件并执行它.独立于用户所在的当前目录.我怎么做?目前,我收到的错误消息是我需要在一个包含现有pom.xml文件的目录中.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.1.RELEASE</version>
</parent>
<groupId>handof.nod</groupId>
<artifactId>clirunnertest</artifactId>
<version>1.0</version>
<name>CLIRunnerTest</name>
<description>Kleines Testprogramm um zu testen wie Spring Boot auf der Command Line funktioniert</description>
<packaging>jar</packaging>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<!-- Package as an executable jar/war -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>java</executable>
<arguments>
<argument>-jar</argument>
<argument>target/clirunnertest-1.0.jar</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud) 我正在使用build_runner在 flutter 项目中生成自动生成的代码。
问题:当我在模型类中进行更新然后我尝试在命令下运行时,但它不会更新自动生成的类。
命令:
pub run build_runner build
Run Code Online (Sandbox Code Playgroud)
飞镖包:
built_value: '>=5.5.5 <7.0.0'
build_runner: ^1.5.0
built_value_generator: ^6.6.0
Run Code Online (Sandbox Code Playgroud)
执行build_runner的命令后,应更新自动生成的类。
我正在使用mercurial,maven和maven-release-plugin来发布.执行任务时,release:prepare
它会失败并显示以下堆栈跟踪:
[INFO] Transforming 'producer'...
[INFO] Not removing release POMs
[INFO] Checking in modified POMs...
[INFO] EXECUTING: /bin/sh -c cd /home/dir/producer && hg branch
[DEBUG] version-1.1
[INFO] EXECUTING: /bin/sh -c cd /home/dir/producer && hg outgoing
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2:16.923s
[INFO] Finished at: Tue Jun 30 16:00:45 MSK 2015
[INFO] Final Memory: 10M/207M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5:prepare (default-cli) on project producer: An error is occurred in the checkin process: …
Run Code Online (Sandbox Code Playgroud) 2天,我一直试图获得一个空白的android活动,以便在64位Ubuntu 14.04上的intellij idea终结时进行编译.这个错误让我很难过:
Error:Gradle: Execution failed for task ':app:mergeDebugResources'.
> /home/guarddog/Documents/github/IcsTrac/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.1/res/drawable-ldrtl-hdpi/abc_ic_ab_back_mtrl_am_alpha.png: Error: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/local/android-sdk-linux/build-tools/22.0.1/aapt'' finished with non-zero exit value 127
Run Code Online (Sandbox Code Playgroud)
注意我有Java 8,Gradle 2.5和/usr/local/android-sdk-linux/tools
我的所有$PATH
.
我在这里尝试了这个建议:在Android Studio中Gradle构建失败了.但错误仍然存在.我该如何解决这个问题?
Jenkins管道插件如何运行并行任务
我是jenkins的初学者,我想使用管道插件在jenkins的可用从节点上并行启动几个任务.
我安装了管道插件,并在管道内联脚本部分下面添加.
grovvy script :
parallel firstBranch: {
node('master'){
echo 'firstBranch'
}
},
secondBranch: {
node('slave1'){
echo 'secondBranch'
}
}
Run Code Online (Sandbox Code Playgroud)
注意:master和slave1是我的节点
什么是firstBranch和secondBranch理想的????
控制台输出:
用户匿名[Pipeline] parallel [Pipeline] [firstBranch] {(Branch:firstBranch)[Pipeline] [secondBranch] {(Branch:secondBranch)[Pipeline] [firstBranch] node [firstBranch]在master中运行/ scratch/gnithyan /.hudson/workspace/pipeline_test
[Pipeline] [secondBranch] node
[Pipeline] [secondBranch] // node
[Pipeline] [secondBranch]}
[secondBranch]分支secondBranch
[Pipeline] [firstBranch] {
[Pipeline] [firstBranch]失败echo
[firstBranch] firstBranch
[Pipeline] [firstBranch]}
[Pipeline] [firstBranch] // node
[Pipeline] [firstBranch]}
[Pipeline] // parallel
[Pipeline] End of Pipeline
java.lang.IllegalStateException:无法开始写日志在org.jenkinsci.plugins的org.jenkinsci.plugins.workflow.support.actions.LogActionImpl.(LogActionImpl.java:110)的已完成节点org.jenkinsci.plugins.workflow.cps.nodes.StepStartNode [id = 8] .workflow.support.actions.LogActionImpl.stream(LogActionImpl.java:81)at org.jenkinsci.plugins.workflow.support.DefaultStepContex t.get(DefaultStepContext.java:73)位于org.jenkinsci.plugins.workflow.cps.DSL.invokeStep的org.jenkinsci.plugins.workflow.steps.StepDescriptor.checkContextAvailability(StepDescriptor.java:252)(DSL.java: 179)atg.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:126)org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108)at groovy.lang.GroovyObject $ invokeMethod …
我是 Jenkins 和 Groovy 的初学者。我正在研究管道库。
一个文件(version.groovy)定义如下:
def dateInternal = { new Date().format('yy.Mdd.Hmm') }.memoize()
def date() {
dateInternal()
}
Run Code Online (Sandbox Code Playgroud)
在我调用的另一个文件中version.date()
。
当我这样做时,我遇到以下错误:
java.lang.NoSuchMethodError: No such DSL method 'dateInternal' found among steps [ansiColor, archive, bat, ...
Run Code Online (Sandbox Code Playgroud)
这可能是一个菜鸟问题,但直到现在我才找到解决这个问题的方法......
为了将文件从angular上传到Spring MVC REST WebService,人们似乎在AJAX请求中设置了Content-Type:undefined头.
这种内容类型的目的是什么?Spring MultiPart需要它吗?
$http.post(uploadUrl, fd, {
transformRequest : angular.identity,
headers : {
'Content-Type' : undefined
}
//...
}
Run Code Online (Sandbox Code Playgroud) jenkins ×4
groovy ×2
java ×2
maven ×2
android ×1
angularjs ×1
artifactory ×1
file-upload ×1
flutter ×1
jar ×1
javascript ×1
json ×1
maven-3 ×1
mercurial ×1
node.js ×1
npm ×1
registry ×1
spring ×1
spring-mvc ×1
ssh ×1