There is a very simple process here. Turn on filtering in the resource plugin, and add a .properties file that filters in what you need. Then get those properties. No problems with unit tests, no problems keeping track of _which_ MANIFEST.MF from classpath is the one you need.
On Fri, Jul 18, 2014 at 4:33 PM, Karl Heinz Marbaise <[email protected]> wrote: > Hi Jörg, > >> >> >> nice article ;-) >> >> There's one comment I do not understand though: >> >>> The main disadvantage of this approach is that you can only use the >>> Implementation and Specification parts of your MANIFEST.MF file which >>> might be enough in some situations but not in all. > > > The comment is related to the implementation in Java which allows only to > extract the implementation and specification part...via > this.getClass().getPackage().... > > http://docs.oracle.com/javase/7/docs/api/java/lang/Package.html > So can't use that in a very simple way... > >> >> You can add all kind of entries to the manifest. You may even overwrite >> the >> defaults. We use typically: > > > Of course you can so create an appropriate MANIFEST.MF file... > >> >> ===================== %< ====================== >> <archive> >> <manifest> >> >> <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries> >> >> <addDefaultImplementationEntries>true</addDefaultImplementationEntries> >> </manifest> >> <manifestEntries> >> <Specification-Version>${parsedVersion.majorVersion}. >> ${parsedVersion.minorVersion}</Specification-Version> >> <X-Compile-Source>${java.version.source}</X-Compile-Source> >> <X-Compile-Target>${java.version.target}</X-Compile-Target> >> <X-Builder>Maven ${maven.version}</X-Builder> >> <X-Build-Time>${maven.build.timestamp}</X-Build-Time> >> <X-Build-Os>${os.name}</X-Build-Os> >> </manifestEntries> >> </archive> >> ===================== %< ====================== >> >> With the $parsedVersion and $maven.version variables provided by the >> build- >> helper plugin. > > But the above entries can't be read via methods which already exists like > getPackage().... > > So you need to implement it your own...you have to take care about > classloading issue (classloaders in particular in larger apps etc.)... > so it get more and more complicated...lets talk about apps which comprise of > 150 jar files... > > So the simplest Solution is to use the templating-maven-plugin which solves > many of those issues. > > Kind regards > Karl-Heinz Marbaise > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
