[ http://jira.codehaus.org/browse/MNG-2270?page=all ] Brett Porter closed MNG-2270: -----------------------------
Assign To: Brett Porter Resolution: Won't Fix put the dependency in a profile. The profile can be set to activate only on jdk 1.3 > Support non-required dependencies > --------------------------------- > > Key: MNG-2270 > URL: http://jira.codehaus.org/browse/MNG-2270 > Project: Maven 2 > Type: New Feature > Components: Dependencies > Versions: 2.0.4 > Reporter: Felipe Leme > Assignee: Brett Porter > > > One feature I miss on Maven is the possibility of setting a dependency as > non-required. Let me explain an use case that would make it clearer: I'm > migrating dbunit to use Maven 2 (it uses Maven 1 currently) and in order to > compile it, either you use JDK 1.4+ or you add the javax.sql-jdbc-std-2.0 > dependency (dbunit requires JDK 1.3). > In other words, there is currently no way to build dbunit out-of-the box - > you have to either install the dependency manually (which is fine when > cutting a release or on CI builds) or comment the dependency in the POM > (which is not cool for occasional users of the framework - it goes against > the 'just type mvn and wait' philosophy). > So, what I think it would be nice is if I could declare that dependency as > non-required (I would say 'optional', but that already has another meaning): > if Maven cannot download that dependency, it would continue the build (of > course, if Maven is ran using JDK 1.3, it would fail; but in most cases, it > would suceed). It should be something like this: > <dependency> > <groupId>javax.sql</groupId> > <artifactId>jdbc-stdext</artifactId> > <version>2.0</version> > <required>false</required> > </dependency> > Or, even better, I could use a logic expression: > <dependency> > <groupId>javax.sql</groupId> > <artifactId>jdbc-stdext</artifactId> > <version>2.0</version> > <required>${java.version == 1.3}</required> > </dependency> > Or in a more powerful way: > <dependency> > <groupId>javax.sql</groupId> > <artifactId>jdbc-stdext</artifactId> > <version>2.0</version> > <required>${versionLessThan( java.version, '1.3' }</required> > </dependency> > Is that any plan to provide such a feature on Maven 2.1? I think the scenario > makes sense and it appers to be easy to implement (at least the initial > alternative that only accepts literals). > -- Felipe -- 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