コード例 #1
0
  private void initDefaults() {
    RemoteRepository repo = new RemoteRepository();
    repo.setProject(project);
    repo.setId("central");
    repo.setUrl("http://repo1.maven.org/maven2/");
    project.addReference(Names.ID_CENTRAL, repo);

    repo = new RemoteRepository();
    repo.setProject(project);
    repo.setRefid(new Reference(project, Names.ID_CENTRAL));
    RemoteRepositories repos = new RemoteRepositories();
    repos.setProject(project);
    repos.addRemoterepo(repo);
    project.addReference(Names.ID_DEFAULT_REPOS, repos);

    // resolve maven.repo.local only once relative to project, as the basedir may change for <ant>
    // tasks
    String localRepoResolved = project.getProperty("maven.repo.local.resolved");
    if (localRepoResolved != null) {
      mavenRepoDirFromProperty = new File(localRepoResolved);
    } else {
      String mavenRepoProperty = project.getProperty("maven.repo.local");
      if (mavenRepoProperty != null) {
        mavenRepoDirFromProperty = project.resolveFile(mavenRepoProperty);
        project.setProperty(
            "maven.repo.local.resolved", mavenRepoDirFromProperty.getAbsolutePath());
      }
    }
  }
コード例 #2
0
  public File resolve(final Extension extension, final Project project) throws BuildException {
    if (null == m_location) {
      final String message = "No location specified for resolver";
      throw new BuildException(message);
    }

    return project.resolveFile(m_location);
  }