alexo / wro4j

New project location is:https://github.com/wro4j/wro4j
442 stars 110 forks source link

Prevent buildDirectory from being null #205

Closed muffl0n closed 10 years ago

muffl0n commented 10 years ago

With my version of Maven (Embedded, 3.0.4) the parameter "buildDirectory" which should be set in AbstractWro4jMojo is always null. No matter what I do. I tried to fix it like described here http://books.sonatype.com/mvnref-book/reference/writing-plugins-sect-mojo-params.html but that didn't help either.

I think this is a change that happened between Maven 2.x and 3.x. To be compliant with both versions I added a workaround that get's the buildDirectory from "Build" as a fallback.

muffl0n commented 10 years ago

This problem just came to my attention when I tried to deploy the same project with two different jobs in Jenkins. The problem is that both jobs fell back to use /tmp as their buildDirectory in the wro-plugin. Then both were writing to the same build.properties, resulting in a mixup with hashsums. With this fix both jobs do just fine.

alexo commented 10 years ago

Thanks a lot! The only problem is that there are failed tests in this PR. Could you fix them?

muffl0n commented 10 years ago

I tried my best and could fix everything but one test. I'm kind of stuck with that one. Hope to have better luck later.

alexo commented 10 years ago

Great job! Merged into 1.7.x.

muffl0n commented 10 years ago

Weird. One my local machine the Test ro.isdc.wro.maven.plugin.Wro4jRunMojoIT.testMojoGoal() still failes.

Anyway, thanks for the quick merge!

alexo commented 10 years ago

It passes only when run from console (the travis build is also green).