On Fri, 30 Sep 2005, Thomas Van de Velde wrote: Hi Thomas,
> Kenney, > > Thanks for your reply. I am still a bit puzzled though when SCM is brought > into the picture. > > Is the following hypothesis correct? > > - Setup the recommended M2 structure for multiple modules. > > - Generate an Eclipse project + class path per module by running the Eclipse > plugin from the root of this structure. Correct - the internal dependencies are resolved using the reactor, so if my-webapp depends on my-app you get a project reference in eclipse, not a classpath entry for the my-app artifact in your local repository. > - Check in the entire tree as a single SCM module. Correct. You can also use different scm repositories for each module if you want, as long as you specify the scm repository in the pom for that module. > - To work on an individual module: Check out the subsection of the structure > that holds the module and Eclipse project for that module. never check in eclipse projects! Generate them. If you work on a subsection of the structure, you don't have project references to other sections. If you were to check in eclipse project files you would have to decide beforehand wheter to use project references or not (in this last case you would have to run m2 eclipse:eclipse for each module seperately). > - To build the entire application: Check out the entire SCM module and run > the build from the structure's root. Correct. You can also build a subsection of the structure; you don't need to check out the entire project, as long as the repository where the missing poms and artifacts can be found is specified in the pom. This can cause a problem though: you usually define the artifact repository in the root pom; if you check out a submodule, m2 might not find the root pom in the correct repository; kinf of a chicken and egg problem. A solution is to specify a company wide (or project local) repository in your settings.xml. -- Kenney > Thanks > > Thomas > > > On 9/30/05, Kenney Westerhof <[EMAIL PROTECTED]> wrote: > > > > On Fri, 30 Sep 2005, Thomas Van de Velde wrote: > > > > Hi, > > > > > I ment to send this to the users list. Sorry for the double post! > > > > > > Cheers, > > > Thomas > > > > > > On 9/30/05, Thomas Van de Velde <[EMAIL PROTECTED]> > > wrote: > > > > > > > > Hi, > > > > > > > > I am wondering what the best way is to setup a project layout with M2 > > and > > > > Eclipse for multiple modules. The documentation< > > http://maven.apache.org/maven2/getting-started.html>recommends the > > following: > > > > > > > > +- pom.xml > > > > +- my-app > > > > | +- pom.xml > > > > +- my-webapp > > > > | +- pom.xml > > > > Yes, this is the recommended way. The topmost pom.xml is the parent pom, > > containing <module> sections for subdirectories. > > > > > > The only way I can see this work with Eclipse is to add the entire > > > > structure to a single Eclipse project. However this is not something > > I'd > > > > want to do because I don't want to have a single Eclipse classpath > > that is > > > > exposed to my-app and my-webapp. > > > > Why? Separate projects work fine. It's just nested non-pom projects that > > don't work well in eclipse. > > > > > > The only way around this, that I can currently see, is to do this: > > > > I don't see a problem.. > > > > > > +- my-master > > > > | +- pom.xml > > > > +- my-app > > > > | +- pom.xml > > > > +- my-webapp > > > > | +- pom.xml > > > > You're still missing the parent pom that defies my-master, my-app and > > my-webapp as modules. > > > > > > In this scenario; my-master, my-app, and my-webapp are all seperate > > > > Eclipse projects. To make this work, I need to change the master POM's > > > > modules element to the following: > > > > <modules> > > > > <module>../my-app</module> > > > > <module>../my-webapp</module> > > > > </modules> > > > > You don't, you just need to specify dependencies from my-webapp and > > my-app to my-master. > > > > Modules are normally located UNDER the project that defines them. > > The project that defines them usually has packaging 'pom'. > > So the only projects that produce artifacts tend to be leaf projects > > (no nested modules). Maven2 doesn't require this at all, but if > > you want to have in-place eclipse .project/.classpath this is recommended. > > > > If, in the maven2 recommended structure (the first one you mentioned), > > the root pom would produce an artifact, eclipse would break. What you > > can do in that case is run m2 eclipse:eclipse > > -Declipse.workspace=some/other/location; the plugin then creates a > > flattened project structure to overcome eclipse's nesting limitation. > > > > Also, never ever join all your subprojects in one eclipse project! > > That will require adding dependencies manually, and will break the > > separation of classpaths. Your code might end up requiring circular > > dependencies, breaking an m2 build. > > > > > > Have I missed something or is this the recommended way? > > > > Hope the above answers your question? > > > > -- Kenney > > > > > > > > > > Thanks! > > > > > > > > Thomas > > > > > > > > > > > -- > > Kenney Westerhof > > http://www.neonics.com > > GPG public key: http://www.gods.nl/~forge/kenneyw.key > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > -- Kenney Westerhof http://www.neonics.com GPG public key: http://www.gods.nl/~forge/kenneyw.key --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
