1 Star 0 Fork 0

小董 / ces-build-lib

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
MavenInDocker.groovy 1.27 KB
一键复制 编辑 原始数据 按行查看 历史
package com.cloudogu.ces.cesbuildlib
/**
* Run maven in a docker container.
*
* This can be helpful,
* * when constant ports are bound during the build that cause port conflicts in concurrent builds.
* For example, when running integration tests, unit tests that use infrastructure that binds to ports or
* * when one maven repo per builds is required
* For example when concurrent builds of multi module project install the same snapshot versions.
*
* The build are run inside the official maven containers from https://hub.docker.com/_/maven/
*/
class MavenInDocker extends MavenInDockerBase {
/** The version of the maven docker image to use, e.g. {@code maven:3.5.0-jdk-8} **/
String dockerBaseImageVersion
/**
* @param script the Jenkinsfile instance ({@code this} in Jenkinsfile)
* @param dockerBaseImageVersion the version of the maven docker image to use, e.g. {@code 3.5.0-jdk-8}
*/
MavenInDocker(script, String dockerBaseImageVersion) {
super(script)
this.dockerBaseImageVersion = dockerBaseImageVersion
}
@Override
def call(Closure closure, boolean printStdOut) {
inDocker("maven:$dockerBaseImageVersion") {
sh("mvn ${createCommandLineArgs(closure.call())}", printStdOut)
}
}
}
1
https://gitee.com/openoffice/ces-build-lib.git
git@gitee.com:openoffice/ces-build-lib.git
openoffice
ces-build-lib
ces-build-lib
develop

搜索帮助