Play! 1.2 build with Bamboo
Asked by h4tfield:

I'm trying to setup bamboo to work with a Play web application but it is not working. I'm using the script task to run the play script and it is complaining that it can't find a main class. However, if I open a shell and run play from the same directory it works fine. There is something about the environment which bamboo is running the script than the environment which the shell is using. Does anyone have any experience with Play 1.2 projects and Bamboo? (I'm not finding much help online).

You can reproduce by:

(note: I'm using Ubuntu 13 and OpenJDK 1.7)

1. Download the play 1.2 framework - I'm using <http://downloads.typesafe.com/play/1.2.5.3/play-1.2.5.3.zip>

2. unzip it and add the directory to your path (so that the 'play' command is on the path).

3. install bamboo with the express install and create a new project/plan.

4. create a play app in a source repo. For example, see [https://jhatfield@bitbucket.org/jhatfield/bambootest.git](https://jhatfield%40bitbucket.org/jhatfield/bambootest.git)

5. create a bamboo task to build and run the tests for the app. Use the script task and enter:

play auto-test

6. When I run the build it outputs:

simple23-Oct-2013 15:44:38Build bambooTest - bambooTest - Default Job #4 (BAM-BAM-JOB1-4) started building on agent Default Agent

simple23-Oct-2013 15:44:38Build working directory is /home/john/bamboo_home/xml-data/build-dir/BAM-BAM-JOB1

simple23-Oct-2013 15:44:38Executing build bambooTest - bambooTest - Default Job #4 (BAM-BAM-JOB1-4)

simple23-Oct-2013 15:44:38Starting task 'Checkout Default Repository' of type 'com.atlassian.bamboo.plugins.vcs:task.vcs.checkout'

simple23-Oct-2013 15:44:38Updating source code to revision: eaa676f578ac0c50aa381e9579b2b88751f6cd6c

simple23-Oct-2013 15:44:38Fetching 'refs/heads/master' from 'https://bitbucket.org/jhatfield/bambootest'.

simple23-Oct-2013 15:44:39Checking out revision eaa676f578ac0c50aa381e9579b2b88751f6cd6c.

simple23-Oct-2013 15:44:39Already on 'master'

simple23-Oct-2013 15:44:39Updated source code to revision: eaa676f578ac0c50aa381e9579b2b88751f6cd6c

simple23-Oct-2013 15:44:39Finished task 'Checkout Default Repository'

simple23-Oct-2013 15:44:39Running pre-build action: Clover Grails PreBuild Action

simple23-Oct-2013 15:44:39Running pre-build action: VCS Version Collector

simple23-Oct-2013 15:44:39Starting task 'play auto-test' of type 'com.atlassian.bamboo.plugins.scripttask:task.builder.script'

command23-Oct-2013 15:44:39Beginning to execute external process for build 'bambooTest - bambooTest - Default Job #4 (BAM-BAM-JOB1-4)'\\n ... running command line: \\n/bin/sh /home/john/bamboo/atlassian-bamboo-5.2/temp/BAM-BAM-JOB1-4-ScriptBuildTask-5809565771198221764.sh\\n ... in: /home/john/bamboo_home/xml-data/build-dir/BAM-BAM-JOB1\\n

error23-Oct-2013 15:44:40Error: Could not find or load main class

build23-Oct-2013 15:44:40\~ _ _

build23-Oct-2013 15:44:40\~ _ __ \| \| __ _ _ _\| \|

build23-Oct-2013 15:44:40\~ \| '_ \\\| \|/ _' \| \|\| \|_\|

build23-Oct-2013 15:44:40\~ \| __/\|_\|\\____\|\\__ (_)

build23-Oct-2013 15:44:40\~ \|_\| \|__/

build23-Oct-2013 15:44:40\~

build23-Oct-2013 15:44:40\~ play! 1.2.5.3, <http://www.playframework.org>

build23-Oct-2013 15:44:40\~ framework ID is test

build23-Oct-2013 15:44:40\~

build23-Oct-2013 15:44:40\~ Running in test mode

build23-Oct-2013 15:44:40\~ Ctrl+C to stop

build23-Oct-2013 15:44:40\~

build23-Oct-2013 15:44:40\~ Deleting /home/john/bamboo_home/xml-data/build-dir/BAM-BAM-JOB1/tmp

build23-Oct-2013 15:44:40\~

build23-Oct-2013 15:44:40\~

build23-Oct-2013 15:44:40\~ Oops, application has not started?

build23-Oct-2013 15:44:40\~

simple23-Oct-2013 15:44:40Failing task since return code of \[/bin/sh /home/john/bamboo/atlassian-bamboo-5.2/temp/BAM-BAM-JOB1-4-ScriptBuildTask-5809565771198221764.sh\] was 255 while expected 0

simple23-Oct-2013 15:44:40Finished task 'play auto-test'

simple23-Oct-2013 15:44:40Running post build plugin 'NCover Results Collector'

simple23-Oct-2013 15:44:40Running post build plugin 'Clover Results Collector'

simple23-Oct-2013 15:44:40Running post build plugin 'Artifact Copier'

simple23-Oct-2013 15:44:40Finalising the build...

simple23-Oct-2013 15:44:40Stopping timer.

simple23-Oct-2013 15:44:40Build BAM-BAM-JOB1-4 completed.

simple23-Oct-2013 15:44:40Running on server: post build plugin 'NCover Results Collector'

simple23-Oct-2013 15:44:40Running on server: post build plugin 'Clover Delta Calculator'

simple23-Oct-2013 15:44:40Running on server: post build plugin 'Build Hanging Detection Configuration'

simple23-Oct-2013 15:44:40Running on server: post build plugin 'Maven Dependencies Postprocessor'

simple23-Oct-2013 15:44:40All post build plugins have finished

simple23-Oct-2013 15:44:40Generating build results summary...

Note that it runs fine from a shell:

john@ubuntu:\~$ cd /home/john/bamboo_home/xml-data/build-dir/BAM-BAM-JOB1

john@ubuntu:\~/bamboo_home/xml-data/build-dir/BAM-BAM-JOB1$ play auto-test

\~ _ _

\~ _ __ \| \| __ _ _ _\| \|

\~ \| '_ \\\| \|/ _' \| \|\| \|_\|

\~ \| __/\|_\|\\____\|\\__ (_)

\~ \|_\| \|__/

\~

\~ play! 1.2.5.3, <http://www.playframework.org>

\~ framework ID is test

\~

\~ Running in test mode

\~ Ctrl+C to stop

\~

\~ Deleting /home/john/bamboo_home/xml-data/build-dir/BAM-BAM-JOB1/tmp

\~

CompilerOracle: exclude jregex/Pretokenizer.next

Listening for transport dt_socket at address: 8000

15:46:45,926 INFO \~ Starting /home/john/bamboo_home/xml-data/build-dir/BAM-BAM-JOB1

15:46:47,064 WARN \~ You're running Play! in DEV mode

\~

\~ Go to [http://localhost:9000/@tests](http://localhost:9000/%40tests) to run the tests

\~

\~ 3 tests to run:

\~

\~ BasicTest... PASSED 1s

\~ ApplicationTest... PASSED 0s

\~ Application... PASSED 3s

\~

\~ All tests passed

\~

what am I missing?

Thanks,

John


Answers:
author: rverschoor
body: Setenv.sh can put trailing spaces JAVA_OPTS, and Play chokes on that.  
The workaround is to call "unset JAVA_OPTS" just before you call "play".  
Bamboo 5.6.2 will fix this (<https://jira.atlassian.com/browse/BAM-14966>)


author: Przemek Bruski
body: put:

unset JAVA_OPTS

before your 'play' line


author: Walter Heestermans
body: How did you solve the issue?

Walter


author: Gretchen
body: Are you running it from the command line on the bamboo server as the bamboo user? You might look at the environment variables as well. It could be that the bamboo user doesn't have access to the same environment variables as "you" do (are yours user variables not system variables?). You may have to add something to the env variables field in the bamboo task. I'm not familiar with Play but it doesn't look like a problem with your build any way if it will run from the command line. Make sure you've got your exe's location correct. I don't know how you're running this but scripts behave differently than commands so if this is scripted it may not be finding an executable but not be reporting it.

Also if you ran it in the bamboo workspace from the command line first it may have mucked up the filesystem permissions so that when bamboo goes to execute it doesn't have the correct permissions on something.

looks like it fails on this:

CompilerOracle: exclude jregex/Pretokenizer.next (present in your output from cmd line but not bamboo).

Could it be that you don't have oracle_home or something like that configured properly for bamboo or that bamboo doesn't have access to start oracle?

Just some suggestions.


Tags: bamboo-administration