Dynamically includes <module> dependencies if subfolder is available 
---------------------------------------------------------------------

                 Key: MNG-2886
                 URL: http://jira.codehaus.org/browse/MNG-2886
             Project: Maven 2
          Issue Type: Improvement
          Components: Reactor and workspace
    Affects Versions: 2.0.5
            Reporter: Dominick More


We would like to use Maven to build our multi-project using the <modules/> 
construct in a top level pom file. The project contains common libraries and 
war files. Since the war files are not dependent on each other, developers are 
used to exclude all other war project directories out of their SCM load 
configurations to reduce update time. Currently we have implemented ANT in such 
a way that if a project directory is not available at build time it will 
excluded from the build configuration. Since the sub-module pom contains the 
<dependency/> reference to a sibling build configuration anyway the build will 
fail if the dependency cannot be found.

Currently if a module is defined for which no project exists you get the 
following error:

E:\Temp\Maven\AXN>mvn install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).


Project ID: unknown

Reason: Could not find the model file 'E:\Temp\Maven\AXN\xyz\pom.xml'.
...

On further investigation I located the source of the exception is being thrown 
in the method org.apache.maven.DefaultMaven::collectProjects where the modules 
list added at line 496:

modulesFiles.add( moduleFile );

The following change would do the trick...

if( moduleFile.isFile()) {
  modulesFiles.add( moduleFile );
}


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to