Ejemplo n.º 1
0
 private void cachePhysicalPaths(final Collection<Path> paths) {
   final Collection<Path> pathsToCache = CollectionUtils.populate(new HashSet<Path>(), paths);
   if (!pathsToCache.contains(ROOT)) {
     pathsToCache.add(ROOT);
   }
   for (final Path path : pathsToCache) {
     pathLocations.put(path, path.getModulePath(this));
   }
 }
Ejemplo n.º 2
0
  /**
   * Constructor
   *
   * @param groupId the Maven groupId, explicit or inherited (required)
   * @param artifactId the Maven artifactId (required)
   * @param version the version of the artifact being built (required)
   * @param packaging the Maven packaging (required)
   * @param dependencies (can be <code>null</code> for none)
   * @param parent the POM's parent declaration (can be <code>null</code> for none)
   * @param modules the modules defined by this POM (only applies when packaging is "pom"; can be
   *     <code>null</code> for none)
   * @param pomProperties any properties defined in the POM (can be <code>null</code> for none)
   * @param name the Maven name of the artifact being built (can be blank)
   * @param repositories any repositories defined in the POM (can be <code>null</code> for none)
   * @param pluginRepositories any plugin repositories defined in the POM (can be <code>null</code>
   *     for none)
   * @param sourceDirectory the directory relative to the POM that contains production code (can be
   *     blank for the Maven default)
   * @param testSourceDirectory the directory relative to the POM that contains test code (can be
   *     blank for the Maven default)
   * @param filters any filters defined in the POM (can be <code>null</code> for none)
   * @param buildPlugins any plugins defined in the POM (can be <code>null</code> for none)
   * @param resources any build resources defined in the POM (can be <code>null</code> for none)
   * @param path the canonical path of this POM (required)
   * @param moduleName the Maven name of this module (blank for the project's root or only POM)
   * @param paths the {@link Path}s required for this module, in addition to the root (can be <code>
   *     null</code>)
   */
  public Pom(
      final String groupId,
      final String artifactId,
      final String version,
      final String packaging,
      final Collection<? extends Dependency> dependencies,
      final Parent parent,
      final Collection<? extends Module> modules,
      final Collection<? extends Property> pomProperties,
      final String name,
      final Collection<? extends Repository> repositories,
      final Collection<? extends Repository> pluginRepositories,
      final String sourceDirectory,
      final String testSourceDirectory,
      final Collection<? extends Filter> filters,
      final Collection<? extends Plugin> buildPlugins,
      final Collection<? extends Resource> resources,
      final String path,
      final String moduleName,
      final Collection<Path> paths) {
    Validate.notBlank(packaging, "Invalid packaging '%s'", packaging);
    Validate.notBlank(path, "Invalid path '%s'", path);

    // gav = new GAV(groupId, artifactId, version);
    this.moduleName = StringUtils.stripToEmpty(moduleName);
    this.name = StringUtils.stripToEmpty(name);
    this.packaging = packaging;
    this.parent = parent;

    if (version == null && parent.getVersion() != null) {
      gav = new GAV(groupId, artifactId, parent.getVersion());
    } else {
      gav = new GAV(groupId, artifactId, version);
    }

    this.path = path;
    this.sourceDirectory =
        StringUtils.defaultIfEmpty(sourceDirectory, Path.SRC_MAIN_JAVA.getDefaultLocation());
    this.testSourceDirectory =
        StringUtils.defaultIfEmpty(testSourceDirectory, Path.SRC_TEST_JAVA.getDefaultLocation());

    CollectionUtils.populate(this.buildPlugins, buildPlugins);
    CollectionUtils.populate(this.dependencies, dependencies);
    CollectionUtils.populate(this.filters, filters);
    CollectionUtils.populate(this.modules, modules);
    CollectionUtils.populate(this.pluginRepositories, pluginRepositories);
    CollectionUtils.populate(this.pomProperties, pomProperties);
    CollectionUtils.populate(this.repositories, repositories);
    CollectionUtils.populate(this.resources, resources);

    cachePhysicalPaths(paths);
  }
Ejemplo n.º 3
0
 /**
  * Constructs a new instance.
  *
  * @param details the member holders that should be stored in this instance (can be <code>null
  *     </code>)
  */
 MemberDetailsImpl(final Collection<? extends MemberHoldingTypeDetails> details) {
   Validate.notEmpty(details, "Member holding details required");
   CollectionUtils.populate(this.details, details);
 }