Ejemplo n.º 1
0
  public PomClassLoader(ArtifactRepository localRepo, DependencyNode node, PomLoader pomLoader) {
    super(new URL[] {}, null);

    if (node.getArtifact().getFile() == null) {
      String s = localRepo.getBasedir() + File.separator + localRepo.pathOf(node.getArtifact());
      node.getArtifact().setFile(new File(s));
    }

    jarFile = node.getArtifact().getFile();
    if (jarFile == null) System.out.println("123");
    try {
      addURL(jarFile.toURI().toURL());
    } catch (MalformedURLException e) {
      throw new RuntimeException(e);
    }
    name =
        node.getArtifact().getGroupId()
            + "-"
            + node.getArtifact().getArtifactId()
            + "-"
            + node.getArtifact().getVersion();
    pomLoader.add(this);

    includeDependency(localRepo, pomLoader, node.getChildren());
    getJSClassLoader();
  }
Ejemplo n.º 2
0
 private void includeDependency(
     ArtifactRepository localRepo, PomLoader pomLoader, Collection<DependencyNode> nodes) {
   for (DependencyNode dn : nodes) {
     if ("test".equals(dn.getArtifact().getScope())) continue;
     String n =
         dn.getArtifact().getGroupId()
             + "-"
             + dn.getArtifact().getArtifactId()
             + "-"
             + dn.getArtifact().getVersion();
     PomClassLoader pcl = pomLoader.get(n);
     if (pcl == null) {
       pcl = new PomClassLoader(localRepo, dn, pomLoader);
     }
     parents.add(pcl);
   }
 }
Ejemplo n.º 3
0
  /*
      public PomClassLoader(File file, PomLoader pomLoader) throws IOException, XmlPullParserException {
          super(new URL[]{}, null);
          this.pomLoader = pomLoader;
          if (file.getName().endsWith(".xml") || file.getName().endsWith(".pom"))
              setJarFile(file);
          else {
              haveJSLib = false;
              addURL(file.toURI().toURL());
          }
      }
  */
  public PomClassLoader(
      ArtifactRepository localRepo,
      DependencyNode node,
      File file,
      String name,
      PomLoader pomLoader) {
    super(new URL[] {}, null);
    haveJSLib = false;
    jarFile = file;
    try {
      addURL(jarFile.toURI().toURL());
    } catch (MalformedURLException e) {
      throw new RuntimeException(e);
    }
    this.name = name;
    pomLoader.add(this);

    includeDependency(localRepo, pomLoader, node.getChildren());
    getJSClassLoader();
  }