Resolution: Not A Problem
Affects Version/s: 2.3.2
Fix Version/s: None
In a multi module project, it is not possible to generate the Eclipse project files of an Ear project when dependent projects are not installed in the local repository.
This is caused by the GenerateApplicationXmlMojo which requires all dependencies to be resolved before it is starten. The running of this mojo is part of the Maven core lifecycle. Because of this bug it is also impossible to build an ear package without installing all dependent projects in the local repository first.
In our project we have a big multi module project. We chose not to checkin all Eclipse project files (.project etc) in subversion. When a developer checks out the project, he/she must be able to generate the Eclipse file without having to compile, package and install all modules first.
It is very easy to reproduce this bug. Generate a new project using the simple j2ee archetype and run eclipse:eclipse in the new project directory.
I created a patch for this bug. The solution is very easy. The @requiresDependenciesResolution tag is removed from the GenerateApplicationXmlMojo. In the AbstractEarMojo the dependencies are resolved in the Mojo before the Ear Execution Context is created. For dependency resolution I looked at how the Eclipse plugin and the Maven core (for @requiresDependenciesResolution tags) implemented this. First the dependencies are looked up in the local repository. The ear project should only contain wars/jars of other modules and/or 3rd party libraries which are used in those modules so it should not be necessary to download any dependencies here. With this patch, the Ear plugin should work as it does now. The new configuration property 'useProjectReferences' is default 'false'. When set to 'true' in the Ear configuration, missing dependencies are lookup in the reactor and added to the project artifacts list.
With this fix it is possible to generate application xml and create and ear package without having to install the project modules .