Improve methods to define the scope and packaging of dependencies
-----------------------------------------------------------------

         Key: MNG-1732
         URL: http://jira.codehaus.org/browse/MNG-1732
     Project: Maven 2
        Type: Improvement
    Versions: 2.0    
    Reporter: Bob Allison


I have been thinking about the way the dependency scope is being used, and I 
think there may be a need to expand the scope definitions so that more 
flexibility is available for defining what dependencies get packaged into 
artifacts and what dependencies are used in the various classpaths.  My thought 
is to create a new tag on the dependency XML tree called "usage"; it would look 
something like this:
<dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>3.8.1</version>
  <!--scope>test</scope-->
  <usage>
    <compile>true</compile>
    <test>true</test>
    <execute>false</execute>
    <jar>false</jar>
    <rpm>/usr/local/lib</rpm>
  </usage>
</dependency>

I see two classes of items within the <usage> tag:
--  classpath items (compile, test, execute above) which split out the current 
meaning of the scope value and would have the value of "true" or "false" to 
identify if the dependency should appear on the classpath; the default value 
for these would be "true"
-- packaging items (jar, rpm above) which control the packaging of the 
dependency into the specified type of artifact and would have the value "false" 
to omit the dependency, "true" to package the dependency in a package-specific 
default location (e.g., wars would default to "WEB-INF/lib"), or a path to 
package the dependency in a specific place in the artifact; the default value 
for these would be "false"

My expectation is that both <scope> and <usage> would be accepted and that 
<usage> would be configured as a Map.  If possible, it would be easier for 
mojos to use this arrangement if specifying <scope> would cause a 
pre-configured <usage> map to be placed in the usage variable so that mojos 
only have to look at the usage map and not interpolate the scope value as well.

I think this may also help with people who have a hard time remembering that a 
scope of "compile" means that the dependency is also available at runtime and 
which scopes make the dependency get packaged into the artifact.  It would also 
address some of the "how do I keep my war dependencies from appearing in my ear 
file" type of questions.

-- 
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


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to