Bamboo not generating target jar for Maven Project
Asked by Sarabhaiah Polakam:

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 Agentsimple	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-JOB1simple	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 checkoutsimple	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-JOB1simple	20-Sep-2019 11:58:35	Updating source code to revision: 7fe516ad9aceb7eb9240a684abca4887d1d655b7simple	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: 7fe516ad9aceb7eb9240a684abca4887d1d655b7simple	20-Sep-2019 11:58:38	Finished task 'Checkout Default Repository' with result: Successsimple	20-Sep-2019 11:58:38	Running pre-build action: VCS Version Collectorsimple	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: Successcommand	20-Sep-2019 11:58:42	Substituting variable: ${bamboo.working.directory} with /var/bamboo/bamboo-home/xml-data/build-dir/HND-HNDUS-JOB1simple	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\nbuild	20-Sep-2019 11:58:42	Sending build context to Docker daemon  28.16kBbuild	20-Sep-2019 11:58:42	build	20-Sep-2019 11:58:42	Step 1/5 : FROM openjdk:8-jdk-alpinebuild	20-Sep-2019 11:58:42	 ---> a3562aa0b991build	20-Sep-2019 11:58:42	Step 2/5 : VOLUME /tmp/dockerbuild	20-Sep-2019 11:58:42	 ---> Using cachebuild	20-Sep-2019 11:58:42	 ---> b6bc44e1cc58build	20-Sep-2019 11:58:42	Step 3/5 : COPY target/user-registration-1.0-SNAPSHOT.jar registration.jarerror	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 directorysimple	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 0error	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 taskerror	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 commanderror	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 moreerror	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-registrationerror	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
```


Answers:
author: Rafael Pinto Sperafico
body: Hi [@Sarabhaiah Polakam](/t5/user/viewprofilepage/user-id/3562689) ,

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](https://confluence.atlassian.com/bamboo/defining-a-new-executable-capability-289277164.html "Maven Dependency Processor") task. Therefore replace the [Maven Dependency Processor](https://confluence.atlassian.com/bamboo/defining-a-new-executable-capability-289277164.html "Maven Dependency Processor") task and place a [Maven 3.x](https://confluence.atlassian.com/bamboo/maven-289277038.html "Maven 3.x") task task instead.

Once you have the [Maven 3.x](https://confluence.atlassian.com/bamboo/maven-289277038.html "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](https://confluence.atlassian.com/bamboo/maven-289277038.html "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](https://community.atlassian.com/t5/image/serverpage/image-id/67092iDA615F54EB08A7DE/image-dimensions/358x497?v=v2 "PlanMavenTaskConfiguration")

It is important to notice that [Maven 3.x](https://confluence.atlassian.com/bamboo/maven-289277038.html "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](https://confluence.atlassian.com/bamboo/defining-a-new-executable-capability-289277164.html "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