Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Bamboo not generating target jar for Maven Project

Sarabhaiah Polakam
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 20, 2019

I am trying to setup a bamboo plan for a maven project which then will create a docker image. Tried to even add maven task but still seems to not generate the target jar.

 

This is causing my docker build to fail.

 

simple	20-Sep-2019 11:58:35	Build help-next-door - hnd-user-service - Default Job #8 (HND-HNDUS-JOB1-8) started building on agent Default Agent
simple	20-Sep-2019 11:58:35	
simple	20-Sep-2019 11:58:35	Build working directory is /var/bamboo/bamboo-home/xml-data/build-dir/HND-HNDUS-JOB1
simple	20-Sep-2019 11:58:35	Executing build help-next-door - hnd-user-service - Default Job #8 (HND-HNDUS-JOB1-8)
simple	20-Sep-2019 11:58:35	Starting task 'Checkout Default Repository' of type 'com.atlassian.bamboo.plugins.vcs:task.vcs.checkout'
simple	20-Sep-2019 11:58:35	Build always requires a clean checkout
simple	20-Sep-2019 11:58:35	Cleaning build directory '/var/bamboo/bamboo-home/xml-data/build-dir/HND-HNDUS-JOB1'
simple	20-Sep-2019 11:58:35	Checking out into /var/bamboo/bamboo-home/xml-data/build-dir/HND-HNDUS-JOB1
simple	20-Sep-2019 11:58:35	Updating source code to revision: 7fe516ad9aceb7eb9240a684abca4887d1d655b7
simple	20-Sep-2019 11:58:35	Fetching 'refs/heads/master' from 'ssh://git@bitbucket.polakams.com:7999/hnd/spring-cloud-hnd-services.git'.
simple	20-Sep-2019 11:58:35	Warning: Permanently added '[127.0.0.1]:45585' (RSA) to the list of known hosts.
simple	20-Sep-2019 11:58:35	Checking out revision 7fe516ad9aceb7eb9240a684abca4887d1d655b7.
simple	20-Sep-2019 11:58:35	Creating local git repository in '/var/bamboo/bamboo-home/xml-data/build-dir/HND-HNDUS-JOB1/.git'.
simple	20-Sep-2019 11:58:35	Cloning into '/var/bamboo/bamboo-home/xml-data/build-dir/HND-HNDUS-JOB1'...
simple	20-Sep-2019 11:58:35	done.
simple	20-Sep-2019 11:58:38	Already on 'master'
simple	20-Sep-2019 11:58:38	Your branch is up to date with 'origin/master'.
simple	20-Sep-2019 11:58:38	Updated source code to revision: 7fe516ad9aceb7eb9240a684abca4887d1d655b7
simple	20-Sep-2019 11:58:38	Finished task 'Checkout Default Repository' with result: Success
simple	20-Sep-2019 11:58:38	Running pre-build action: VCS Version Collector
simple	20-Sep-2019 11:58:38	Starting task 'Maven Dependencies' of type 'com.atlassian.bamboo.plugins.maven:task.mvn.dependencies.processor'
simple	20-Sep-2019 11:58:42	Finished task 'Maven Dependencies' with result: Success
command	20-Sep-2019 11:58:42	Substituting variable: ${bamboo.working.directory} with /var/bamboo/bamboo-home/xml-data/build-dir/HND-HNDUS-JOB1
simple	20-Sep-2019 11:58:42	Starting task 'Docker | Build HND User Registraion Service' of type 'com.atlassian.bamboo.plugins.bamboo-docker-plugin:task.docker.cli'
command	20-Sep-2019 11:58:42	Beginning to execute external process for build 'help-next-door - hnd-user-service - Default Job #8 (HND-HNDUS-JOB1-8)'\n ... running command line: \n/usr/bin/docker build --force-rm=true --tag=polakams/hnd-user-registration-service /var/bamboo/bamboo-home/xml-data/build-dir/HND-HNDUS-JOB1/spring-cloud/spring-cloud-kubernetes/user-registration\n ... in: /var/bamboo/bamboo-home/xml-data/build-dir/HND-HNDUS-JOB1/spring-cloud/spring-cloud-kubernetes/user-registration\n ... using extra environment variables: \nbamboo_planRepository_1_branch=master\nbamboo_planRepository_1_branchDisplayName=master\nbamboo_repository_revision_number=7fe516ad9aceb7eb9240a684abca4887d1d655b7\nbamboo_resultsUrl=http://bamboo.polakams.com:8085/browse/HND-HNDUS-JOB1-8\nbamboo_build_working_directory=/var/bamboo/bamboo-home/xml-data/build-dir/HND-HNDUS-JOB1\nbamboo_planRepository_1_name=HND User Service\nbamboo_buildKey=HND-HNDUS-JOB1\nbamboo_shortPlanName=hnd-user-service\nbamboo_planRepository_name=HND User Service\nbamboo_buildNumber=8\nbamboo_shortJobName=Default Job\nbamboo_buildResultsUrl=http://bamboo.polakams.com:8085/browse/HND-HNDUS-JOB1-8\nbamboo_planRepository_repositoryUrl=ssh://git@bitbucket.polakams.com:7999/hnd/spring-cloud-hnd-services.git\nbamboo_agentId=360449\nbamboo_planName=help-next-door - hnd-user-service\nbamboo_repository_524292_revision_number=7fe516ad9aceb7eb9240a684abca4887d1d655b7\nbamboo_shortPlanKey=HNDUS\nbamboo_repository_524292_previous_revision_number=7fe516ad9aceb7eb9240a684abca4887d1d655b7\nbamboo_repository_524292_git_repositoryUrl=ssh://git@bitbucket.polakams.com:7999/hnd/spring-cloud-hnd-services.git\nbamboo_shortJobKey=JOB1\nbamboo_planRepository_revision=7fe516ad9aceb7eb9240a684abca4887d1d655b7\nbamboo_buildTimeStamp=2019-09-20T11:58:35.372-04:00\nbamboo_repository_previous_revision_number=7fe516ad9aceb7eb9240a684abca4887d1d655b7\nbamboo_planRepository_previousRevision=7fe516ad9aceb7eb9240a684abca4887d1d655b7\nbamboo_capability_system_jdk_JDK_1_8_0_221=/usr/java/jdk1.8.0_221-amd64\nbamboo_repository_git_branch=master\nbamboo_buildResultKey=HND-HNDUS-JOB1-8\nbamboo_repository_branch_name=master\nbamboo_buildPlanName=help-next-door - hnd-user-service - Default Job\nbamboo_planRepository_1_revision=7fe516ad9aceb7eb9240a684abca4887d1d655b7\nbamboo_repository_524292_git_username=\nbamboo_repository_name=HND User Service\nbamboo_dependenciesDisabled=false\nbamboo_buildFailed=false\nbamboo_capability_system_docker_executable=/usr/bin/docker\nbamboo_repository_524292_name=HND User Service\nbamboo_planRepository_branch=master\nbamboo_agentWorkingDirectory=/var/bamboo/bamboo-home/xml-data/build-dir\nbamboo_capability_system_git_executable=/usr/bin/git\nbamboo_repository_git_username=\nbamboo_planRepository_1_previousRevision=7fe516ad9aceb7eb9240a684abca4887d1d655b7\nbamboo_planRepository_branchDisplayName=master\nbamboo_planRepository_1_type=bbserver\nbamboo_planRepository_branchName=master\nbamboo_capability_system_jdk_JDK=/usr/java/jdk1.8.0_221-amd64\nbamboo_repository_524292_branch_name=master\nbamboo_plan_storageTag=plan-589827\nbamboo_hg_cache_directory=/var/bamboo/bamboo-home/xml-data/build-dir/_hg-repositories-cache\nbamboo_planRepository_1_username=\nbamboo_planRepository_type=bbserver\nbamboo_git_cache_directory=/var/bamboo/bamboo-home/xml-data/build-dir/_git-repositories-cache\nbamboo_ManualBuildTriggerReason_userName=polakams\nbamboo_repository_git_repositoryUrl=ssh://git@bitbucket.polakams.com:7999/hnd/spring-cloud-hnd-services.git\nbamboo_repository_524292_git_branch=master\nbamboo_capability_system_builder_node_Node_js=/usr/bin/node\nbamboo_capability_system_builder_mvn3_Maven_3=/opt/apache-maven-3.6.2/bin/mvn\nbamboo_tmp_directory=/var/bamboo/bamboo-home/temp\nbamboo_working_directory=/var/bamboo/bamboo-home/xml-data/build-dir/HND-HNDUS-JOB1\nbamboo_planKey=HND-HNDUS\nbamboo_planRepository_1_repositoryUrl=ssh://git@bitbucket.polakams.com:7999/hnd/spring-cloud-hnd-services.git\nbamboo_planRepository_username=\nbamboo_capability_system_jdk_JDK_1_8=/usr/java/jdk1.8.0_221-amd64\nbamboo_planRepository_1_branchName=master\n
build	20-Sep-2019 11:58:42	Sending build context to Docker daemon  28.16kB
build	20-Sep-2019 11:58:42	
build	20-Sep-2019 11:58:42	Step 1/5 : FROM openjdk:8-jdk-alpine
build	20-Sep-2019 11:58:42	 ---> a3562aa0b991
build	20-Sep-2019 11:58:42	Step 2/5 : VOLUME /tmp/docker
build	20-Sep-2019 11:58:42	 ---> Using cache
build	20-Sep-2019 11:58:42	 ---> b6bc44e1cc58
build	20-Sep-2019 11:58:42	Step 3/5 : COPY target/user-registration-1.0-SNAPSHOT.jar registration.jar
error	20-Sep-2019 11:58:42	COPY failed: stat /var/lib/docker/tmp/docker-builder454577464/target/user-registration-1.0-SNAPSHOT.jar: no such file or directory
simple	20-Sep-2019 11:58:42	Failing task since return code of [/usr/bin/docker build --force-rm=true --tag=polakams/hnd-user-registration-service /var/bamboo/bamboo-home/xml-data/build-dir/HND-HNDUS-JOB1/spring-cloud/spring-cloud-kubernetes/user-registration] was 1 while expected 0
error	20-Sep-2019 11:58:42	Error occurred while running Task 'Docker | Build HND User Registraion Service(2)' of type com.atlassian.bamboo.plugins.bamboo-docker-plugin:task.docker.cli.
error	20-Sep-2019 11:58:42	com.atlassian.bamboo.task.TaskException: Failed to execute task
error	20-Sep-2019 11:58:42		at com.atlassian.bamboo.plugins.docker.service.BuildService.execute(BuildService.java:57)
error	20-Sep-2019 11:58:42		at com.atlassian.bamboo.plugins.docker.tasks.cli.DockerCliTask.execute(DockerCliTask.java:70)
error	20-Sep-2019 11:58:42		at com.atlassian.bamboo.task.TaskExecutorImpl.lambda$executeTasks$3(TaskExecutorImpl.java:319)
error	20-Sep-2019 11:58:42		at com.atlassian.bamboo.task.TaskExecutorImpl.executeTaskWithPrePostActions(TaskExecutorImpl.java:252)
error	20-Sep-2019 11:58:42		at com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:319)
error	20-Sep-2019 11:58:42		at com.atlassian.bamboo.task.TaskExecutorImpl.execute(TaskExecutorImpl.java:112)
error	20-Sep-2019 11:58:42		at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:73)
error	20-Sep-2019 11:58:42		at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.executeBuildPhase(DefaultBuildAgent.java:204)
error	20-Sep-2019 11:58:42		at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:176)
error	20-Sep-2019 11:58:42		at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.lambda$waitAndPerformBuild$0(BuildAgentControllerImpl.java:131)
error	20-Sep-2019 11:58:42		at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:185)
error	20-Sep-2019 11:58:42		at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:125)
error	20-Sep-2019 11:58:42		at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:127)
error	20-Sep-2019 11:58:42		at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48)
error	20-Sep-2019 11:58:42		at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26)
error	20-Sep-2019 11:58:42		at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17)
error	20-Sep-2019 11:58:42		at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41)
error	20-Sep-2019 11:58:42		at java.lang.Thread.run(Thread.java:748)
error	20-Sep-2019 11:58:42	Caused by: com.atlassian.bamboo.docker.DockerException: Error running Docker build command
error	20-Sep-2019 11:58:42		at com.atlassian.bamboo.plugins.docker.client.DockerCmd.build(DockerCmd.java:113)
error	20-Sep-2019 11:58:42		at com.atlassian.bamboo.plugins.docker.service.BuildService.execute(BuildService.java:44)
error	20-Sep-2019 11:58:42		... 17 more
error	20-Sep-2019 11:58:42	Caused by: com.atlassian.utils.process.ProcessException: Error executing /usr/bin/docker build --force-rm=true --tag=polakams/hnd-user-registration-service /var/bamboo/bamboo-home/xml-data/build-dir/HND-HNDUS-JOB1/spring-cloud/spring-cloud-kubernetes/user-registration
error	20-Sep-2019 11:58:42		at com.atlassian.bamboo.plugins.docker.process.DockerTaskProcessService.execute(DockerTaskProcessService.java:64)
error	20-Sep-2019 11:58:42		at com.atlassian.bamboo.plugins.docker.client.DockerCmd.build(DockerCmd.java:111)
error	20-Sep-2019 11:58:42		... 18 more

1 answer

0 votes
Rafael Pinto Sperafico
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 23, 2019

Hi @Sarabhaiah Polakam ,

Based on the build log (HND-HNDUS-JOB1-8) you have provided, you are downloading some source code from ssh://git@bitbucket.polakams.com:7999/hnd/spring-cloud-hnd-services.git .

Assuming that the source code in this repository is a Maven project, then you should be running a Maven 3.x task instead of a Maven Dependency Processor task. Therefore replace the Maven Dependency Processor task and place a Maven 3.x task task instead.

Once you have the Maven 3.x task, you will be able to define what Maven should do in the same way as you would when running a Maven command from Terminal / Command Prompt. By default, the Maven 3.x task will execute "clean test" as a Goal, however, you should be replacing that with "clean package" or some other instruction defined in your pom.xml file, so the JAR file can be generated.

PlanMavenTaskConfiguration

It is important to notice that Maven 3.x task requires two dependencies:

  • Executable (Maven capability)
  • Build JDK (Java JDK capability)

The build log you provided suggests the build got executed against Bamboo Server, therefore, if you will continue on running this build against the Bamboo Server (Default Agent), then you must have those capabilities defined in the Bamboo Server.

This documentation Defining a new executable capability provide you with guidance on how to define capabilities to Bamboo Agents. Since running against Bamboo Server (Default Agent) that it a local agent, you should be focusing on Defining a local server executable capability section in link mentioned.

Kind regards,
Rafael

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events