public void execute() throws MojoExecutionException {
    MavenProject project = getProject();

    if (!supportedProjectTypes.contains(project.getPackaging())) {
      getLog().info("Ignoring packaging type " + project.getPackaging());
      return;
    } else if ("NONE".equalsIgnoreCase(obrRepository)) {
      getLog().info("OBR update disabled (enable with -DobrRepository)");
      return;
    }

    Log log = getLog();
    ObrUpdate update;

    String mavenRepository = localRepository.getBasedir();

    URI repositoryXml = ObrUtils.findRepositoryXml(mavenRepository, obrRepository);
    URI obrXmlFile = ObrUtils.toFileURI(obrXml);
    URI bundleJar;

    if (null == file) {
      bundleJar = ObrUtils.findBundleJar(localRepository, project.getArtifact());
    } else {
      bundleJar = file.toURI();
    }

    Config userConfig = new Config();

    update =
        new ObrUpdate(
            repositoryXml, obrXmlFile, project, bundleJar, mavenRepository, userConfig, log);

    update.updateRepository();
  }
Exemple #2
0
  /**
   * initialize information.
   *
   * @param repositoryXml path to the repository descriptor file
   * @param obrXml path and filename to the obr.xml file
   * @param project maven project description
   * @param mavenRepositoryPath path to the local maven repository
   * @param userConfig user information
   * @param logger plugin logger
   */
  public ObrUpdate(
      URI repositoryXml,
      URI obrXml,
      MavenProject project,
      String mavenRepositoryPath,
      Config userConfig,
      Log logger) {
    m_repositoryXml = repositoryXml;
    m_obrXml = obrXml;
    m_project = project;
    m_logger = logger;

    m_userConfig = userConfig;

    if (userConfig.isRemoteFile()) {
      m_baseURI = ObrUtils.toFileURI(mavenRepositoryPath);
    } else {
      m_baseURI = m_repositoryXml;
    }
  }