Example #1
0
  protected ResolvedArtifact findIvyFileRef(DependencyDescriptor dd) {
    if (isUsepoms()) {
      ModuleRevisionId moduleRevisionId = dd.getDependencyRevisionId();
      ArtifactRevisionId artifactRevisionId =
          ArtifactRevisionId.newInstance(
              moduleRevisionId,
              moduleRevisionId.getName(),
              "pom",
              "pom",
              moduleRevisionId.getExtraAttributes());
      Artifact pomArtifact = new DefaultArtifact(artifactRevisionId, null, null, true);
      return findResourceUsingPatterns(moduleRevisionId, getIvyPatterns(), pomArtifact, true);
    }

    return null;
  }
Example #2
0
 // private boolean isResolved(ResolveData data, ModuleRevisionId mrid) {
 // IvyNode node = getSystemNode(data, mrid);
 // return node != null && node.getModuleRevision() != null;
 // }
 //
 private void checkDescriptorConsistency(
     ModuleRevisionId mrid, ModuleDescriptor md, ResolvedResource ivyRef) throws ParseException {
   boolean ok = true;
   StringBuffer errors = new StringBuffer();
   if (!mrid.getOrganisation().equals(md.getModuleRevisionId().getOrganisation())) {
     Message.error(
         "\t"
             + getName()
             + ": bad organisation found in "
             + ivyRef.getResource()
             + ": expected='"
             + mrid.getOrganisation()
             + "' found='"
             + md.getModuleRevisionId().getOrganisation()
             + "'");
     errors.append(
         "bad organisation: expected='"
             + mrid.getOrganisation()
             + "' found='"
             + md.getModuleRevisionId().getOrganisation()
             + "'; ");
     ok = false;
   }
   if (!mrid.getName().equals(md.getModuleRevisionId().getName())) {
     Message.error(
         "\t"
             + getName()
             + ": bad module name found in "
             + ivyRef.getResource()
             + ": expected='"
             + mrid.getName()
             + " found='"
             + md.getModuleRevisionId().getName()
             + "'");
     errors.append(
         "bad module name: expected='"
             + mrid.getName()
             + "' found='"
             + md.getModuleRevisionId().getName()
             + "'; ");
     ok = false;
   }
   if (mrid.getBranch() != null
       && !mrid.getBranch().equals(md.getModuleRevisionId().getBranch())) {
     Message.error(
         "\t"
             + getName()
             + ": bad branch name found in "
             + ivyRef.getResource()
             + ": expected='"
             + mrid.getBranch()
             + " found='"
             + md.getModuleRevisionId().getBranch()
             + "'");
     errors.append(
         "bad branch name: expected='"
             + mrid.getBranch()
             + "' found='"
             + md.getModuleRevisionId().getBranch()
             + "'; ");
     ok = false;
   }
   if (ivyRef.getRevision() != null && !ivyRef.getRevision().startsWith("working@")) {
     ModuleRevisionId expectedMrid = ModuleRevisionId.newInstance(mrid, ivyRef.getRevision());
     if (!getSettings().getVersionMatcher().accept(expectedMrid, md)) {
       Message.error(
           "\t"
               + getName()
               + ": bad revision found in "
               + ivyRef.getResource()
               + ": expected='"
               + ivyRef.getRevision()
               + " found='"
               + md.getModuleRevisionId().getRevision()
               + "'");
       errors.append(
           "bad revision: expected='"
               + ivyRef.getRevision()
               + "' found='"
               + md.getModuleRevisionId().getRevision()
               + "'; ");
       ok = false;
     }
   }
   if (!getSettings().getStatusManager().isStatus(md.getStatus())) {
     Message.error(
         "\t"
             + getName()
             + ": bad status found in "
             + ivyRef.getResource()
             + ": '"
             + md.getStatus()
             + "'");
     errors.append("bad status: '" + md.getStatus() + "'; ");
     ok = false;
   }
   for (Iterator it = mrid.getExtraAttributes().entrySet().iterator(); it.hasNext(); ) {
     Entry extra = (Entry) it.next();
     if (extra.getValue() != null
         && !extra.getValue().equals(md.getExtraAttribute((String) extra.getKey()))) {
       String errorMsg =
           "bad "
               + extra.getKey()
               + " found in "
               + ivyRef.getResource()
               + ": expected='"
               + extra.getValue()
               + "' found='"
               + md.getExtraAttribute((String) extra.getKey())
               + "'";
       Message.error("\t" + getName() + ": " + errorMsg);
       errors.append(errorMsg + ";");
       ok = false;
     }
   }
   if (!ok) {
     throw new ParseException(
         "inconsistent module descriptor file found in '" + ivyRef.getResource() + "': " + errors,
         0);
   }
 }