我正在尝试按照本教程创建一个简单的 docker 环境,作为我的 jenkins 管道构建的一部分。
在进行 maven 构建之前,我正在尝试构建几个 docker 镜像作为测试。目前我的 Jenkinsfile 有以下常规:
#!groovy
node {
stage 'Building docker env'
def dbImage = docker.build('oracle', 'docker/oracle')
def wlpImage = docker.build('liberty', 'docker/liberty')
stage 'Running maven build'
git url: 'https://mysite/myproject.git', branch: 'docker'
def mvnHome = tool 'maven 3.3.9'
sh "${mvnHome}/bin/mvn -B clean install"
}
Run Code Online (Sandbox Code Playgroud)
我正在尝试让 docker build 在目录“docker/oracle”中查找并调用该目录中的 Dockerfile,并构建名为“oracle”的 docker 映像,对于自由也是如此。目前虽然它给了我这个错误:
Running on master in /root/.jenkins/workspace/pipeline_test
[Pipeline] {
[Pipeline] stage (Building docker env)
Using the ‘stage’ step without a block argument is …Run Code Online (Sandbox Code Playgroud) 我正在使用最新的maven 3.3.9,它强制执行java 8,并尝试使用java 7 maven工具链在java 7中编译项目.
按照: maven指南我已经放入maven工具链插件尝试告诉它使用java 7来编译应用程序.我的项目设置如下:
top_module - >(在这个pom.xml中放入了maven工具链插件)
--- submodule1
--- submodule2
这是我的父pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<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>parent</groupId>
<artifactId>build-base</artifactId>
<version>1.0.17</version>
</parent>
<groupId>top_module</groupId>
<artifactId>top_module</artifactId>
<version>1</version>
<packaging>pom</packaging>
<name>${project.artifactId}</name>
<modules>
<module>submodule1</module>
<module>submodule2</module>
</modules>
<properties>
...
</properties>
<dependencyManagement>
<dependencies>
<dependency>
...
</dependency>
<dependency>
...
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
...
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<!-- Ensure we compile as the correct jdk version -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId> …Run Code Online (Sandbox Code Playgroud)