I think a plug in could be written to do this, but that would mean that a plug in would have to be able to do some of the same work that the "reactor" does. I haven't had time to figure out how the reactor works or how difficult it would be to have one plug in be able to "invoke" (possibly non-child) sibling projects.
I wrote one plug in that used exec() to recursively call mvn within the context of a sibling project directory. This worked and was not that hard but seemed like a serious kludge, not to mention that it's probably less than optimally performant. I would be interested in knowing the right/fast way to implement this. If someone would like to give me some guidance, here are my questions: * Given a list of dependencies (getArtifacts()) is there an easy way to tell which ones are "in this project". It would be simply wonderful if this was a property of an artifact (is this a mvn core enhancement request?). Or even better, how about a method getProjectSiblingDependencies() which only return, well, the dependencies which were project siblings (meaning all projects transitively reachable from the top-level pom). * Given a handle to an Artifact which I know is "in this project" (is a project sibling), is there an easy way to find that Artifact's local (in project, not repository) pom.xml file. I'm betting that mvn has a way of finding this which is more efficient than doing directory scans up and down the filing system. Better, given an Artifact, how do I load that artifact's project-local pom.xml into a MavenProject. Presumably I would need that in order to "invoke" a phase on that project. (Might this be another mvn core enhancement request?) * The real, fundamental question is: from within a plug in on one project, how do I invoke/run a phase on another (sibling, possibly non-child) project (without calling exec())? The information is certainly in there. I would just like some help in getting at it and using it in the most performant possible way. For a project that has a lot of siblings, this has to be fast. Thanks for your support. Chris _____ From: Chris Bredesen [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 18, 2006 8:42 PM To: [email protected] Cc: [EMAIL PROTECTED] Subject: Transitive "sibling" builds Hello All, Just subscribed, and I wanted to revisit the discussion that took place regarding the above topic in this thread: http://www.mail-archive.com/[email protected]/msg32502.html There seems to be a lot of resistance from the community (lack of understanding, maybe) to implementing this sort of transitive build mechanism. I, too, do exactly what the original poster does, and the lack of support for this is the only real reason I haven't adopted Maven2 as my build tool of choice. I get closer each time, but since there's no way to build an entire WAR file in one shot, I have to give it up. I realize it CAN be done, but it seems that the WAR file has to be the parent of all its components. I wanted to add my own experience into this discussion, and possibly even spur enough information to contribute myself. I have my enterprise laid out as such, made of webapps (w) and components (c): w1 w2 w3 c1 c2 c3 c4 c5 Each of the webapps may use any of the components as dependencies, along with a slew of off-the-shelf API's. The problem for me is that these components can have only one parent directory. I have no way to separately build w1 and w2. Unless I'm missing, something, we'd need sibling communication in order to make this work. Currently each Ant buildfile knows which components are needed, but has no idea if they need to be built or not, thus causing me to build everything each time I compile. To avoid this, I also maintain Eclipse projects (one per app, not one big one) which have project-level dependencies on each other. This makes the local development compilation very fast, but I have to maintain both the Eclipse metadata AND the Ant buildfiles. Maven addresses all of this (I really love the Maven2 plugin for Eclipse), but since there's no support for sibling transitive builds, there is no way to just grab all the source and compile w1 or w2 in one shot. Eventually I'd like to use Continuum as well. If I'm missing something here, I'd sure like to know about it. If I can contribute and make this happen, I'd love to, when time permits. I fear I'd have a lot of catching up to do, though. Perhaps I can work on some documentation at the very least. Thoughts? ----------------------------------------- Attention: Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorized to state them to be the views of any such entity. The information contained in this message and or attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. If you received this in error, please contact the sender and delete the material from any system and destroy any copies.
