You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-user@ant.apache.org by Tom Widmer <to...@gmail.com> on 2009/02/04 20:46:22 UTC

Problem with module depending on self

If a module depends on itself (module name matches), an exception is
thrown in Ivy, and resolve fails. (the message is 'a module is not
authorized to depend on itself'). This is problematic, since there are
reasons why a module might depend on itself. e.g.

* depends on older version (e.g. to generate some kind of delta, or get
information out of it)
* depends on something different which happens to have the same module
name, but which differs in extra attributes (e.g. a custom 'component'
attribute differs between the ivy.xml and the thing it is depending on)
* other reasons?


My proposed fix is below. Is it correct?

Thanks,

Tom

Index: C:/Dev/Ivy/src/java/org/apache/ivy/core/resolve/IvyNodeCallers.java
===================================================================
--- C:/Dev/Ivy/src/java/org/apache/ivy/core/resolve/IvyNodeCallers.java
(revision 740786)
+++ C:/Dev/Ivy/src/java/org/apache/ivy/core/resolve/IvyNodeCallers.java
(working copy)
@@ -149,7 +149,7 @@
              String[] dependencyConfs, DependencyDescriptor dd) {
          ModuleDescriptor md = callerNode.getDescriptor();
          ModuleRevisionId mrid = callerNode.getResolvedId();
-        if (mrid.getModuleId().equals(node.getId().getModuleId())) {
+        if (mrid.equals(node.getId())) {
              throw new IllegalArgumentException("a module is not
authorized to depend on itself: "
                      + node.getId());
          }