0

I have a Bamboo plan that involves building with maven on Windows. The default path to the build directory under the bamboo user is long, and some files end up over the 255-char Windows limit. I wanted to solve the problem by (for this plan only) change the location where the Mavens are run to a short dir, C:\build. I can check out files, then run a script step to copy them from the build dir to C:\build. The Maven bamboo task is configured to override the project file, using C:\build\pom.xml instead. That all works fine. However, when it gets to the 'check in the updated pom' part of release:prepare, it somehow decides that the original build directory with the long path is right, dying with an error.

Anybody know how to specify that the updated pom is also supposed to come from C:\build? I tried overriding the 'Working Sub Directory' entry, but that won't let me specify a full path, so C:\build is out.

Dave Combs
  • 281
  • 2
  • 17

2 Answers2

0

Did you try to override the localRepoDirectory parameter?

The command-line local repository directory in use for this build (if specified).

Default value is: ${maven.repo.local}.

You may set this parameter using a property in the POM:

<properties>
  <propertyName>C:\build</propertyName>
</properties>
...
<localRepoDirectory>${propertyName}</localRepoDirectory>

It can be overridden in the Bamboo Maven command:

mvn -DpropertyName="D:\build" clean package

(Bamboo variables can also be used to set the propertyName)

You may define a single property with the desired path and use it in several places in the pom.xml.

Vlad.Bachurin
  • 1,340
  • 1
  • 14
  • 22
  • Vlad, thanks for the comment. I ultimately didn't have to try this, as the problem(s) turned out to be somewhat different. See my answer to my own question below. – Dave Combs Jan 02 '14 at 18:14
0

Turns out there were several different things going on with the Maven 3.x task:

  • By setting the Override Project File to C:\build\pom.xml, I was able to get the task to try to build in C:\build.

  • Part of my copying of files from the normal root directory to C:\build was wrong. I'd used xcopy but forgot to add a /H to copy the .svn data as well, so the 'check-in updated pom' step failed because it couldn't find the .svn files.

  • Once the release:prepare and release:perform were finished, a bamboo 'Artifact Copy' step had been defined earlier to copy several generated artifacts back to the maven repository. Turns out that while this step is somewhat configurable about what files to copy and where they are to be found, it does not support providing an absolute path as the directory to copy from, unlike the Override Project File for the maven tasks. So I had to introduce yet another step, a script to copy the generated artifacts back from C:\build... to under the build root.

All in all, I wasn't able to mess with the build root as I wanted to, but by using the Override Project File and two scripts to copy the source files to C:\build and the artifacts back from C:\build, I got done what I needed to do.

Dave Combs
  • 281
  • 2
  • 17