Short version:
Looking for suggestions to somehow distribute a filtered resource file containing common copyright info, project name, version, inceptionYear and currentYear, to multiple projects using something that doesn't give errors when used from Eclipse with the m2e plugin.
Description:
Right now, we have a project, buildInfo, containing a properties-file with stuff like ${project .name}, ${project.version}, ${inceptionYear}, ${currentYear}.
We have a parent.pom that does the following:
- defines the currentYear property using the build-helper-maven-plugin:timestamp-property goal
- unpacks the buildInfo properties-file to the ${project.build.directory}/buildInfo/${project.artifactId} using the dependency:unpack goal.
- copy and filters the properties-file to target/classes using the resources:copy-resources goal.
All projects inheriting from the parent.pom now gets a copy of the property-file, which is filtered with that project's specific name, version and inception year.
This is then used in each project to dump a copyright notice to the log when the project is initialized. Specifically, that project knows that its property-files lives in a subfolder named after the project.
Why:
To remove duplication of the property-file in each project that needs to dump copyright and version information we have put the property file in its own project.
We could not find any other way to look up the correct property-file, than to put it in a uniquely named folder for each project.
We build applications (re-)using lots of these projects, which means we need to find this information in many different jar files, so the name/path of the property-file needs to be unique.
Problems:
The Eclipse m2e-plugin does not like the dependency:unpack and the build-helper-maven-plugin:timestamp-property goals.
When checking out a project as a maven project using the m2e-plugin, it marks the pom-files inheriting from our parent.pom as having errors.
- We moved the execution of the two goals to the package phase, which should be m2e non-interesting phase, but still gets errors (see: https://docs.sonatype.org/display/M2ECLIPSE/Project+build+lifecycle+mapping).
- We have added the lifecycle-mapping plugin with configuration to ignore the timestamp-property goal, but it annoyingly still gives an error at checkout, which then disappears after the checkout.
- We have also added configuration to ignore the unpack goal.
With all three changes, it seems to work. Unfortunately, when running the projects from Eclipse, we no longer have the property-file...
Issue:
All this was done to remove duplication and to avoid the need to commit a file-change for each release,.
Annoyingly, our solution still require that we know which projects an application consist of to read the information from each jar and present in an About-box.
Question:
How would you suggest adding common information to multiple projects that is used in an application, and be able to look it up for each of the jar files?
And, can it be done with maven in a m2e-friendly way?
Looking forward to suggestions,
/Henrik