views:

243

answers:

2

I have a set of NetBeans java projects with dependencies between them. I added the project at the top of the dependency tree to Hudson for continuous integration. Everything works fine, except that the unit tests of dependent projects don't get run by Hudson. This is because the ant scripts that NetBeans creates has dependent projects setup to run the "jar" target and not a target that also runs the unit tests. I could add ant build steps for each dependent project in Hudson to run the unit tests, but I was hoping there's a simpler solution.

A: 

I presuming you have your main job and all dependent jobs set up separately in Hudson calling the Ant scripts. Hudson must know the dependencies between each individual job. This would be the items under "Build Trigger"->"Build after other projects are built" and "Post-build Actions"->"Build other projects".

Each of those jobs would need to run JUnit tests independently and generate the JUnit XML output to a directory.

You would turn on "Post-build Actions"->"Publish JUnit test result report" in all of your jobs (Main and all dependent ones).

Then in your parent main job, you would enable "Post-build Actions"->"Aggregate downstream test results" to have it coalesce the JUnit output into a result to display for the parent job.

This should give your main job a presentation of all of the test results for the main and any dependent projects.

Dougman
As mentioned in my question, I only added the project at the top of the dependency tree to Hudson. There are no dependent jobs in Hudson. I explicitly said I didn't want to do this because I didn't wanted to have redundant project dependency information in my Hudson configuration. See my answer for my solution.
Liron Yahdav
+1  A: 

It seems to me like there is no simple solution for this as far as I can tell. My solution will be to use Maven for managing dependencies. This way at I least won't have to manage dependencies redundantly. Both NetBeans and Hudson integrate well with Maven.

Liron Yahdav