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

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

pp June 11, 2024

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

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>

 

 

 

 

 

 

 

1 answer

1 vote
Khushboo Gupta
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 11, 2024

Hello @pp 

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.

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**
pp June 17, 2024

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 ? 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events