How to create maven build on bamboo ? Unable to create by using profile as in pom.xml
Asked by pp:

I have already configured job with maven command as "clean install -Psample" (sample is my profile name in pom.xml as shown below) . But I started running the build it is giving issue as " Non-readable POM /appl/bamboo-agent/xml-data/build-dir/project/pom.xml (No such file or directory) The build could not read the project \[Help 1\]"

![sample.JPG](/t5/image/serverpage/image-id/329142iDF3D6237A400145A/image-size/large?v=v2&px=999 "sample.JPG")

1) How to configure bamboo job to generate maven build ?

2) How to run build with sample profile as shown below ?

3) Can we run "clean install" only to generate bamboo build ?

Below is my pom.xml  

```
<profile>
    <id>sample</id>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <goals>
       <goal>exec</goal>
    </goals>
    <activation>
       <activeByDefault>true</activeByDefault>
    </activation>
</profile>
```


Answers:
author: Khushboo Gupta
body: Hello [@pp](/t5/user/viewprofilepage/user-id/5517909)

Welcome to the Atlassian Community!

The error message you're encountering, `Non-readable POM /appl/bamboo-agent/xml-data/build-dir/project/pom.xml (No such file or directory)`, indicates that the Maven build process cannot find or access the `pom.xml` file in the specified directory.

* Check that the POM is available, and readable by the Bamboo user
* Try running the Maven build outside of Bamboo to see if the error persists.
* Ensure that the job or task in Bamboo that runs the Maven command is configured to use the correct working directory.

Post checking the pom.xml that you have provided profiles do not directly contain `groupId` and `artifactId` elements. Instead, these should be part of a `<plugin>` configuration within a `<plugins>` element.  

```
`<profile>    <id>sample</id>    <activation>        <activeByDefault>true</activeByDefault>    </activation>    <build>        <plugins>            <plugin>                <groupId>org.codehaus.mojo</groupId>                <artifactId>`exec-maven-plugin</artifactId>
<version>1.6.0</version> <!-- Specify the version you're using --> 
<executions> 
<execution> 
<goals> 
<goal>exec</goal> 
</goals>
</execution> 
</executions>
</plugin> 
</plugins> 
</build> 
</profile>
```

To answer your next query:
> How to configure bamboo job to generate maven build ?

`Please refer a Document which describe `[how to configure bamboo task to use Maven](https://confluence.atlassian.com/bamboo/maven-289277038.html)`.`
> 2) How to run build with sample profile as shown below ?

To run your Maven build with a specific profile, such as the "sample" profile you mentioned, you would include the profile in the "Goal" field of your Maven task configuration as you did:

* In the "Goal" field, append `-Psample` to your existing command, making it `clean install -Psample`.

3) Can we run "clean install" only to generate bamboo build ?  
Yes, you can use just "clean install" as your Maven goals for generating a Bamboo build. The `clean` goal will ensure that any previously compiled files or test results are removed, providing a fresh start for the build. The `install` goal compiles your project's code, packages it into a distributable format (like a JAR), and then installs it into your local Maven repository.  
Hope it helps!  
Regards,  
Khushboo Gupta  
**\*\*please don't forget to Accept the answer if your query was answered\*\***

comments: author: pp
body: Hello ,

I tried with above solutions but it is failing again. I have changed my pom.xml involving \<plugin\>\</plugin\> as well. but no success.

I am using maven version 3.0.5 locally as per requirement. I am unable to upgrade it. On bamboo , I am configuring maven version 3.9.6. Is this main reason for my build failure ?

**1.** I am unable to run bamboo build with maven 3.0.5 same as local. When I start to run it, it taking too much time \& getting failed. How to resolve this ? It was showing bamboo agent can not support this job.

**2.**When I trying to upgrade maven locally my application getting failed. What need to add locally so that I can run with bamboo ?