Tag: maven

(spotify)Java的Maven docker生成器

我正在尝试使用(spotify)Docker Maven Plugin为Java构buildDocker镜像。 但是,当运行mvn package docker:build我的项目,我不断得到以下错误: 未能执行目标com.spotify:docker-maven-plugin:0.2.6:构build(default-cli)项目gs-spring-boot-docker:捕获exception:获取https://index.docker.io/v1/存储库/库/ Java /图像 :拨号TCP:查找index.docker.io在10.1.2.2:53:没有答案从服务器 – > [帮助1]

在jenkins里面build造docker集装箱

我正在使用docker-custom-build-environment-plugin( https://wiki.jenkins-ci.org/display/JENKINS/CloudBees+Docker+Custom+Build+Environment+Plugin )在docker中构build一个maven作业容器。 我已经完成了如下图所示的设置: 这是控制台日志中的结果: $ docker inspect maven:3.3.3-jdk-8 [{ "Architecture": "amd64", "Author": "", "Comment": "", "Config": { "AttachStderr": false, "AttachStdin": false, "AttachStdout": false, "Cmd": [ "mvn" ], "CpuShares": 0, "Cpuset": "", "Domainname": "", "Entrypoint": null, "Env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "LANG=C.UTF-8", "JAVA_VERSION=8u66", "JAVA_DEBIAN_VERSION=8u66-b17-1~bpo8+1", "CA_CERTIFICATES_JAVA_VERSION=20140324", "MAVEN_VERSION=3.3.3", "MAVEN_HOME=/usr/share/maven" ], "ExposedPorts": null, "Hostname": "", "Image": "b7928b8a133284ec65b4790aa3d013bd3e266ea3e257c6a6d0254b9708a133e8", "Labels": {}, "MacAddress": […]

我如何使用git commit id作为maven中的docker image标签?

我正在试图build立一个Maven Java项目的Docker镜像,并分别在安装和部署阶段推进; 我希望这些图像被标记为当前的git commit id。 我面临的问题是, maven-git-commit-plugin似乎没有正确导出${git.commit.id.abbrev}variables,以便在${git.commit.id.abbrev} -maven-plugin中使用 。 我的父母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> <name>myproject</name> <groupId>mygroup</groupId> <artifactId>myartifact</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>pom</packaging> <modules> <module>mymodule</module> </modules> <properties> <!– dependency versions –> <!– some stuff here…–> <!– plugin versions –> <maven.enforcer.plugin.version>1.4.1</maven.enforcer.plugin.version> <maven.shade.plugin.version>2.4.2</maven.shade.plugin.version> <scala.maven.plugin.version>3.2.2</scala.maven.plugin.version> <com.spotify.docker.plugin.version>0.3.8</com.spotify.docker.plugin.version> </properties> <dependencyManagement> <dependencies> <!– some stuff here…–> </dependencies> </dependencyManagement> <build> <pluginManagement> […]

如何使用Maven在Windows机器上创buildDockerfile,然后发送到远程Linux服务器来构build映像,然后运行?

我有一个用Maven构build的Java项目。 我想在构build时dynamic创build一个Dockerfile。 我的最终目标是创build一个可执行的Jar和Dockerfile,将它们都发送到服务器,在Dockerfile中使用Dockerfile来构build将执行Jar的映像,然后运行容器。 这将主要用于构build/testing过程,所以我不想在每次testing之前提交任何代码或将我的Jar发布到Artifactory。 我觉得4个独立的authentication服务器是非常低效的。 我试图find一个Maven插件,可以做到这一切,但没有任何运气。 有没有一个插件可以为我做这一切,或只是一个比我目前做的更好的方式? 提前致谢。 如果有的话,我会将答案标记为有用的,并将标记为正确的答案。 提前致谢! 以下是我目前Maven插件的工作进展情况。 <!–This plugin will Transfer the executable JAR and Dockerfile file to a remote server, build an image and run it –> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <version>1.8</version> <executions> <execution> <phase>install</phase> <goals> <goal>run</goal> </goals> <configuration> <tasks> <!– Create a Docerfile –> <echo file="${project.build.directory}/Dockerfile.txt" message="FROM java:8${line.separator}" append="true"/> <echo […]

如何在Docker容器中运行JUnittesting,并在JUnit失败时让容器启动失败?

我想在Docker容器中运行Junittesting,如果testing失败,容器将失败。 在我的Docker文件中,我有: FROM maven:3.2-jdk-7-onbuild CMD mvn verify 我从一个运行docker compose命令的Go CI服务器踢它。 我所看到的是,这开始执行的后台线程,testing开始运行 – Go CI服务器得到一个OK – 就像maven进程已经开始。 testing结束运行有一些失败,但到那时,Go服务器已经显示一个绿色的“所有好”的状态。 部分问题是我需要EXEC命令,直到testing结束。 我的问题是: 如何在Docker容器中运行JUnittesting,并在JUnit失败时让容器启动失败?

与Docker并行运行JUnittesting

我试图与Docker并行运行JUnit Test。 我使用存储在Amazon AWS RDS上的数据库实例。 我应该在一个单独的Docker镜像中运行数据库实例。 计划是在它自己的Docker实例中运行每个JUnittesting。 目前我有我的所有unit testing,包括Maven的configuration,Git和jenkins我的jar文件。 我试图在一个Docker容器中运行我的jar文件,这是成功的。 是否有任何现有的插件可能可以帮助我并行执行我的testingJenkins或Maven? 任何tipps或引用将真正appriciated。 :) 谢谢,

这个版本没有指定目标。

我试图在Docker中运行Maven。 所以我从她的https://hub.docker.com/_/maven/中提取了图片。 docker pull maven 但是,当我运行它: docker run maven 我得到: [ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, […]

Docker maven插件NullPointerException

我有一个多模块的Maven Java项目,我希望每个模块在构build阶段创build一个docker容器。 我已经用微服务作为基础项目使用下面的示例项目: https : //github.com/kbastani/spring-cloud-microservice-example 插件configuration如下: <plugin> <groupId>com.spotify</groupId> <artifactId>docker-maven-plugin</artifactId> <version>${docker.plugin.version}</version> <executions> <execution> <phase>package</phase> <goals> <goal>build</goal> </goals> </execution> </executions> <configuration> <imageName>${docker.image.prefix}/${project.artifactId}</imageName> <dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory> <resources> <resource> <targetPath>/</targetPath> <directory>${project.build.directory}</directory> <include>${project.build.finalName}.jar</include> </resource> </resources> </configuration> </plugin> 这在基础项目中正常工作,并且所有容器都正确地构build。 当我用自己的更新父项和所有子模块中的groupId和artifactId时 ,在构build子模块期间出现以下错误 [ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.4.13:build (default) on project users-microservice: Exception caught: NullPointerException -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal […]

在(fabric8io)中使用compose docker-maven-plugin停用图像构build

我有一个maven项目来build立一个运行良好的图像,它看起来像: <plugin> <groupId>io.fabric8</groupId> <artifactId>docker-maven-plugin</artifactId> <version>${docker-maven-plugin.version}</version> <configuration> <showLogs>true</showLogs> <images> <image> <name>${docker.image.name}</name> <alias>${project.artifactId}-${timestamp}</alias> <build> <dockerFile>${docker.dockerfile}</dockerFile> </build> 我想使用docker-compose从这个图像运行一个容器,所以我正好在前面的代码片段下面添加: <external> <type>compose</type> <basedir>src/main/docker</basedir> <composeFile>docker-compose.yml</composeFile> </external> 然后,当我跑,图像不是build立了: [INFO] — docker-maven-plugin:0.20.0:build (build-image) @ my-component — [INFO] [INFO] — docker-maven-plugin:0.20.0:stop (build-image) @ my-component — [INFO] [INFO] — docker-maven-plugin:0.20.0:start (run-image) @ my-component — [INFO] DOCKER> Pulling repository toto.com/mu-repo/my-component [ERROR] DOCKER> Error occurred during container […]

Jenkinsfile maven插件在docker集装箱内

我使用Jenkins和Jenkinsfile来运行Docker容器中的构build。 我有一个简单的Java应用程序,我想使用Jenkins Artifactory插件来构build和部署到artifactory。 我的Jenkinsfile在下面 – node { def server = Artifactory.server "my-artifactory" def rtMaven = Artifactory.newMavenBuild() stage("Prepare environment"){ docker.image('driv/docker-maven-java-oracle').inside { checkout scm stage("Artifactory configuration") { rtMaven.deployer releaseRepo:'libs-release-local', snapshotRepo:'libs-snapshot-local', server: server rtMaven.resolver releaseRepo:'libs-release', snapshotRepo:'libs-snapshot', server: server } stage("Maven build") { def buildInfo = rtMaven.run pom: 'pom.xml', goals: 'clean install' } } } } 但是,当我运行与上述Jenkinsfile生成我得到的错误 – java.lang.RuntimeException: […]