0

I am trying to configure Bamboo CI server for to build the project. I am using maven resource plugin to copy resources. The build is successful on my local machine but when i am trying to build it through bamboo elastic agent on Amazon EC2 it throws the "permission denied" error.

pom.xml(Removed the dependancies as it is very big list)

      <project >
  <modelVersion>4.0.0</modelVersion>
  <groupId></groupId>
  <artifactId>portalogue</artifactId>
  <packaging>war</packaging>
  <version></version>
  <name></name>
  <url></url>


  <build>
            <plugins>
                <plugin>
                        <groupId>org.apache.tomcat.maven</groupId>
                        <artifactId>tomcat7-maven-plugin</artifactId>
                        <version>2.1</version>
                        <configuration>
                            <url></url>
                            <server>TomcatServer</server>
                            <path>/portalogue1</path>
                            <username>admin</username>
                            <password>admin</password>
                        </configuration>
        </plugin>

       <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <version>2.6</version>
            <executions>    
                <execution>
                    <id>copy-hbm.xml-to-folder</id>
                    <phase>Build</phase>
                    <goals>
                        <goal>copy-resources</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <outputDirectory>${user.home}/myapp/portalogue/target/portalogue1/WEB-INF/classes/com/xti/portalogue/application/db/hibernate</outputDirectory>
                <resources>
                    <resource>
                        <directory>${user.home}/myapp/portalogue/src/main/java/com/xti/portalogue/application/db/hibernate</directory>
                        <includes>
                            <include>**/*.hbm.xml</include>
                        </includes>
                    </resource>
                </resources>
            </configuration>
        </plugin>
   </plugins> 

        <finalName>portalogue1</finalName>
</build>

 <reporting>
    <plugins>
       <plugin> 
        <groupId>org.codehaus.mojo</groupId> 
        <artifactId>findbugs-maven-plugin</artifactId> 
        <version>2.5.3</version> 
        <configuration> 
            <effort>Max</effort> 
            <threshold>Low</threshold> 
            <xmlOutput>true</xmlOutput>
    <xmlOutputDirectory>${user.home}/outPutReports</xmlOutputDirectory>
        </configuration>
        </plugin>
        </plugins>
</reporting>

</project>

The Logs which i am getting from Bamboo are as below.

build   06-Jan-2014 18:55:19    [INFO] BUILD FAILURE
build   06-Jan-2014 18:55:19    [INFO] ------------------------------------------------------------------------
build   06-Jan-2014 18:55:19    [INFO] Total time: 0.554s
build   06-Jan-2014 18:55:19    [INFO] Finished at: Mon Jan 06 08:25:19 UTC 2014
build   06-Jan-2014 18:55:19    [INFO] Final Memory: 3M/15M
build   06-Jan-2014 18:55:19    [INFO] ------------------------------------------------------------------------
build   06-Jan-2014 18:55:19    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.6:resources (default-resources) on project portalogue: Cannot create resource output directory: /home/bamboo/myapp/portalogue/target/portalogue1/WEB-INF/classes/com/xti/portalogue/application/db/hibernate -> [Help 1]
build   06-Jan-2014 18:55:19    [ERROR] 
build   06-Jan-2014 18:55:19    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
build   06-Jan-2014 18:55:19    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
build   06-Jan-2014 18:55:19    [ERROR] 
build   06-Jan-2014 18:55:19    [ERROR] For more information about the errors and possible solutions, please read the following articles:
build   06-Jan-2014 18:55:19    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
simple  06-Jan-2014 18:55:19    Failing task since return code of [/opt/maven-3.0/bin/mvn --batch-mode -Djava.io.tmpdir=/tmp/MAV-POR-CCB process-resources] was 1 while expected 0
simple  06-Jan-2014 18:55:19    Finished task 'Process Resources'
simple  06-Jan-2014 18:55:19    Running post build plugin 'Artifact Copier'
simple  06-Jan-2014 18:55:19    Running post build plugin 'NCover Results Collector'
simple  06-Jan-2014 18:55:19    Running post build plugin 'Clover Results Collector'
simple  06-Jan-2014 18:55:19    Finalising the build...
simple  06-Jan-2014 18:55:19    Stopping timer.
simple  06-Jan-2014 18:55:19    Build MAV-POR-CCB-23 completed.

If anyone knows whats going wrong please let me know.

Vlad.Bachurin
  • 1,340
  • 1
  • 14
  • 22
Anup
  • 31
  • 1
  • 1
  • 6
  • You should check this: `${user.home}/myapp/portalogue/target/` cause a user.home is not a good idea in a Maven build. Just put the `.hbm.xml` into `src/main/resources/` folder and they will be copied automatically. – khmarbaise Jan 06 '14 at 09:49
  • Thanks khmarbaise. I tired to keep the hbm.xml files there. But it was not getting copied to desired folder placed in target folder. So, i am using this plugin to copy files to desired folder. – Anup Jan 06 '14 at 10:12

1 Answers1

0

You can login into your elastic instance, switch your user to the user that bamboo is running with (bamboo), then try to make the dir that you specified. Probably it is a restricted path.

Basically: find SSH key and ip of bamboo instance, login, then:

su bamboo

mkdir /home/bamboo/myapp/portalogue/target/portalogue1/WEB-INF/classes/com/xti/portalogue/application/db/hibernate

Or before that you can just login into the bamboo/elastic instance and execute the maven target on your own with the -eX switch and check what kind of detailed error message it gives you.

Community
  • 1
  • 1
Nikola Yovchev
  • 9,498
  • 4
  • 46
  • 72
  • I did create the folder structure required on local machine and its working fine on locals without resource plugin. Now when i try to change the folder structure on EC2 instance its not able to delete the previous files. May be permission issue. Anyone help me how to resolve this issue? – Anup Jan 07 '14 at 06:36
  • As i told you, login into the amazon instance and try to create the folder structure with the bamboo user. Don't try stuff on your local, just login into the EC2, switch user to the bamboo user, and then try to make that dir. – Nikola Yovchev Jan 07 '14 at 08:15