Managing common values for multiple Maven archetypes -
I have several types of Maven architectures, which are structured as follows
. One ???? One ???? One ???? Bundle a ???? One ???? Bundle-k-jcrinstall One ???? Line Beginner-content A "????" Line Launchpad-standalone "A" ??? Launchpad-Webpap is a "???" Line Servlet 'one' ???? Taglib For these, I would like a source of common values, e.g. Plugin version, so that I can convert them to just one place for all modules. Changes should end in generated pom.xml, so I define the example bundle / src / main / resource / root-processing / pom.xml containing & Lt; Build & gt; & Lt; Plugins & gt; & Lt; Plugin & gt; & Lt; Group & gt; Org.apache.felix & lt; / Group & gt; & Lt; ArtifactId & gt; Maven-scr-plugin & lt; / ArtifactId> & Lt; Version & gt; $ {scrplugin.version} & lt; / Edition & gt; & Lt; Hanging & gt; & Lt; Execution & gt; & Lt; ID & gt; Generated-scr-descriptor & lt; / Id & gt; & Lt; Goals & gt; & Lt; Goal & gt; Scr & lt; / Target & gt; & Lt; / Targets & gt; & Lt; / Execution & gt; & Lt; / Hanging & gt; & Lt ;! - Cutting ... - & gt; and then bundle / palm. Supply the value in the xml file , ideally inherited from a parent palm. The problem is, I do not know how to provide this value in bundle / pom.xml so that it is available to generate the pom.xml file. Any ideas about how to do this, or other ways to solve this problem is more than appreciating.
Resource file filtering is not by default, so you have to turn it on.
In the Palm of its original project; Add your desired asset:
& lt; Scrplugin.version & gt; 1.14.0 & lt; /scrplugin.version> In the original pom, add a resource filtering (assuming you're using the standard Maven organization)
& lt; Build & gt; & Lt; Resources & gt; & Lt; Resources & gt; & Lt; Directory & gt; src / home / resources & lt; / Directory & gt; & Lt; Filtering & gt; True & lt; / Filtering & gt; & Lt; Included & gt; & Lt; Included & gt; ** / * & lt; / Include & gt; & Lt; / Include & gt; & Lt; / Resources & gt; & Lt; / Resources & gt; & Lt; Extensions & gt; & Lt; Expansion & gt; & Lt; Group & gt; Org.apache.maven.archetype & lt; / Group & gt; & Lt; ArtifactId & gt; Original Model-Packaging & lt; / ArtifactId> & Lt; Version & gt; 2.2 & lt; / Edition & gt; & Lt; / Extension & gt; & Lt; / Extensions & gt; & Lt; PluginManagement & gt; & Lt; Plugins & gt; & Lt; Plugin & gt; & Lt; ArtifactId & gt; Maven- Archetype-plugin & lt; / ArtifactId> & Lt; Version & gt; 2.2 & lt; / Edition & gt; & Lt; / Plugin & gt; & Lt; / Plugins & gt; & Lt; / pluginManagement & gt; & Lt; / Create & gt; This will process your palm to replace any property that you have defined; If you do not do this, you do not do this, it will put the property in the origin of the output jar, so it will be a set version whenever you use this basic library when you run the archetype: Reduce command.
Hope that helps.
-Stopp
Comments
Post a Comment