How do I access project.build.directory for a maven clover build

clover runs two lifecycles, one normal and one forked. The default non-clover workspace is ${project.build.directory} and the default clover workspace is ${project.build.directory}/clover. I have maven plugins that will write to the workspace in order to get files into certain artifacts. For example, one plugin writes to the ${project.build.directory}/classes/ directory to include the file in the jar and another writes to ${project.build.directory}/${project.build.finalName} to have files included in the assembly package. In order to get these files written to both places I have to set up plugin executions twice; once to write to ${project.build.directory} and once to write to ${project.build.directory}/clover. Is there a better way to do this? Originally I epxected that the clover fork would just reset ${project.build.directory} to evaluate to the clover output directory and then I could just use that parameter. But it does not seem to work.

1 answer

0 vote

Which version of Maven do you use? 2.x or 3.x? Do you want to use ${project.build.directory} in the pom.xml or access it from your plugin?

If case you use Maven 3.x and ${project.build.directory} in the pom.xml then it won't work. A reason is that the way how properties are evaluated have changed in Maven 3. Their values are not being refreshed for the forked lifecycle (as Maven 2 does) in pom.xml. However, you can still access valid value in a forked lifecycle from the mojo. You can find an examplary "hack" here.

If your case is different, then please give me a little bit more details so that I could investigate it.

Cheers
Marek

BTW: the name of the forked lifecycle ("clover") had never changed since the beginning so it's quite safe to assume that the location is "${project.build.directory}/clover" :-)

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published yesterday in Marketplace Apps

Tips on how to choose the best estimation method for your planning

Planning and grooming sessions all come with their own sets of rules. Team members meet to estimate stories or other work items, all according to an agreed-upon process. And with every session comes ...

63 views 0 11
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you