On Thu, 2004-07-15 at 14:02, Jerome Lacoste wrote: > Let's say I have a piece of the code that I want to compile only if a > library is present.
This is never a good idea. Why? From first hand experience it was found with code in Turbine that optional packages often were left unloved, unmaintained and generally left to rot. Projects should not have optional things to build: whatever is believed to be optional should be moved out into another build and referenced from the build in question. Optional building based on the presence of resources is just nasty business because then you need constructs to deal with excludes for compilation, test compilation, test running and all the way down the line. The source modification element was introduced only because of commons-logging build problems with reference to JDK 1.4. When I look back I see what should have happened is that commons-logging should have been made to have a package with the API and a build for each of the supported logging systems. As commons logging uses discovery this would have worked perfectly. There is probably actually no need for the source modification element now. > I've done it before with ant without problem using available and if. > > In maven I probably first need to specify in the excludes the sources > that cannot be compiled without the library. > > But after is there a best practice to benefit from the already written > plugins in order to minimize the ? > > Pointer to a project/plugin that does that is appreciated. I've made a > quick search in the plugin.jelly files. Just don't do it is my advice. If this is necessary in build then I would say the build has some problems with it or you have a design problem with the code in question. If code is "optional" then it is probably "pluggable" which means it should be cordoned off into a separate build and pulled into the application in question by some form of discovery mechanism. -- jvz. Jason van Zyl [EMAIL PROTECTED] http://maven.apache.org happiness is like a butterfly: the more you chase it, the more it will elude you, but if you turn your attention to other things, it will come and sit softly on your shoulder ... -- Thoreau --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
