views:

1249

answers:

5

Hey,

I'm in a bit of a pickle. I'm trying to run some environmental scripts before I run the build in a m2 project, but it seems no matter how hard I try - the 'pre' build script are never run early enough.

Before the 'pre-build' scripts are run, the project checks to see if the correct files are in the workspace - files that won't be there until the scripts I've written are executed.

To make them 'pre-build', I'm using the M2 Extra Steps plugin - but's it's not 'pre' enough.

Has anyone got any suggestions as to how I can carry out what I want to do?

Cheers.

A: 

Does adding another build step as a shell script work?

Robert Munteanu
Not really, it's an m2project rather than a free-style one - so the only way I can have pre-build setup scripts is to use the plugin mentioned above. It's just not pre 'enough' :(
Spedge
A: 

You should use the free form project type and not the maven project type.

If this is a problem (ie, there are projects that are expecting to be triggered by or triggering from), consider using a custom workspace location and having a free form project execute in this workspace before the maven project runs. The free form project can be used as the trigger for the maven project.

sal
A: 

My problem stemmed from the fact I wanted to set-up my workspace before I ran anything due to an issue with Dynamic Views (ClearCase) not being accessible from the workspace - I wanted to add a symlink to fix this.

However, Andrew Bayer has made a change to the plugin that I'm currently testing that should fix this...so the question is probably invalid in it's current form.

Will edit it once we come to a conclusion.

Spedge
+3  A: 

Have you considered breaking it up into two projects, and setting the pre-build project to be upstream of the build project?

e.g., Foo Pre-build Foo Build

After Foo Pre-build runs, cause "Foo Build" to run.

I have used this, admittedly in different scenarios than yours, quite successfully. This has the added benefit (if you need it) of allowing you to manually run a build without going through the pre-build steps, if you know they aren't necessary.

Jack Leow
A: 

Is it possible to add a pre-build script in a free style project in Hudson ? I have a free style grails project and I am building it using grails war. But I have to run an ant script which will update the application.properties and so that the manifest will be reflecting the version relative to hudson build number.

I think this plugin works for Maven 2-type projects only.

Any clue on this ?

Aranya