Package org.jboss.errai.forge.util

Examples of org.jboss.errai.forge.util.VersionOracle


  }

  protected void addTestScopedDependency(final Project project, final DependencyArtifact artifact) {
    final DependencyBuilder depBuilder = DependencyBuilder.create(artifact.toString());
    final MavenDependencyFacet dependencyFacet = project.getFacet(MavenDependencyFacet.class);
    final VersionOracle versionOracle = new VersionOracle(dependencyFacet);
   
    if (!dependencyFacet.hasDirectDependency(depBuilder)) {
      if (!versionOracle.isManaged(depBuilder)) {
        depBuilder.setVersion(versionOracle.resolveVersion(GwtMockito));
      }
      dependencyFacet.addDirectDependency(depBuilder);
    }
  }
View Full Code Here


  }

  @Override
  public boolean install() {
    final DependencyFacet depFacet = getProject().getFacet(DependencyFacet.class);
    final VersionOracle oracle = new VersionOracle(depFacet);

    for (final DependencyBuilder dep : dependencies) {
      if (dep.getCoordinate().getVersion() == null || dep.getCoordinate().getVersion().equals("")) {
        dep.setVersion(oracle.resolveVersion(dep.getGroupId(), dep.getCoordinate().getArtifactId()));
      }
      if (!depFacet.hasDirectManagedDependency(dep)) {
        depFacet.addDirectManagedDependency(dep);
      }
    }
View Full Code Here

  @Override
  public boolean install() {
    final DependencyFacet depFacet = getProject().getFacet(DependencyFacet.class);
    final MavenFacet coreFacet = getProject().getFacet(MavenFacet.class);
    final VersionOracle oracle = new VersionOracle(depFacet);

    for (DependencyBuilder dep : coreDependencies) {
      depFacet.addDirectDependency(getDependencyWithVersion(dep, oracle));
    }

    for (Entry<String, Collection<DependencyBuilder>> entry : profileDependencies.entrySet()) {
      addDependenciesToProfile(entry.getKey(), entry.getValue(), oracle);
    }

    final Model pom = coreFacet.getModel();
    final Map<String, Collection<DependencyBuilder>> blacklistProfileDependencies = new HashMap<String, Collection<DependencyBuilder>>();
    for (String profileId : ArtifactVault.getBlacklistProfiles()) {
      final Profile profile = MavenModelUtil.getProfileById(profileId, pom.getProfiles());
      for (final DependencyArtifact artifact : ArtifactVault.getBlacklistedArtifacts(profileId)) {
        final DependencyBuilder dep = getDependency(artifact);
        if (depFacet.hasEffectiveDependency(dep)
                && !hasProvidedDependency(profile, dep)) {
          final org.jboss.forge.addon.dependencies.Dependency existing = depFacet.getEffectiveDependency(dep);
          if (!oracle.isManaged(dep))
            dep.setVersion(existing.getCoordinate().getVersion());
          dep.setScopeType("provided");
          if (!blacklistProfileDependencies.containsKey(profileId))
            blacklistProfileDependencies.put(profileId, new ArrayList<DependencyBuilder>());
          blacklistProfileDependencies.get(profileId).add(dep);
View Full Code Here

  }

  @Override
  public boolean isInstalled() {
    final DependencyFacet depFacet = getProject().getFacet(DependencyFacet.class);
    final VersionOracle oracle = new VersionOracle(depFacet);
    for (final DependencyBuilder dep : coreDependencies) {
      if (!depFacet.hasDirectDependency(getDependencyWithVersion(dep, oracle))) {
        return false;
      }
    }
View Full Code Here

  @Override
  public boolean install() {
    final MavenFacet coreFacet = getProject().getFacet(MavenFacet.class);
    Model pom = coreFacet.getModel();
    Profile profile = MavenModelUtil.getProfileById(profileId, pom.getProfiles());
    final VersionOracle oracle = new VersionOracle(getProject().getFacet(DependencyFacet.class));

    if (profile == null) {
      addDependenciesToProfile(profileId, Collections.<DependencyBuilder> emptyList(), oracle);
      pom = coreFacet.getModel();
      profile = MavenModelUtil.getProfileById(profileId, pom.getProfiles());
    }

    if (profile.getBuild() == null) {
      profile.setBuild(new BuildBase());
    }

    Plugin plugin = getPlugin(getPluginArtifact(), profile.getBuild().getPlugins());

    if (plugin == null) {
      plugin = new Plugin();
      plugin.setArtifactId(getPluginArtifact().getArtifactId());
      plugin.setGroupId(getPluginArtifact().getGroupId());
      if (ArtifactVault.ERRAI_GROUP_ID.equals(plugin.getGroupId()))
        plugin.setVersion(Property.ErraiVersion.invoke());
      else
        plugin.setVersion(oracle.resolveVersion(plugin.getGroupId(), plugin.getArtifactId()));
      profile.getBuild().addPlugin(plugin);
    }

    final MavenPluginAdapter adapter = new MavenPluginAdapter(plugin);
    final Configuration config = adapter.getConfig();
    for (final ConfigurationElement elem : getConfigurations()) {
      mergeConfigurationElement(config, elem);
    }
    adapter.setConfig(config);

    for (final DependencyBuilder depBuilder : getDependencies()) {
      if (depBuilder.getCoordinate().getVersion() == null || depBuilder.getCoordinate().getVersion().equals("")) {
        if (ArtifactVault.ERRAI_GROUP_ID.equals(depBuilder.getGroupId())) {
          depBuilder.setVersion(Property.ErraiVersion.invoke());
        }
        else {
          depBuilder.setVersion(new VersionOracle(getProject().getFacet(DependencyFacet.class)).resolveVersion(
                  depBuilder.getGroupId(), depBuilder.getCoordinate().getArtifactId()));
        }
      }
      adapter.addDependency(MavenConverter.convert(depBuilder));
    }
View Full Code Here

    if (plugin == null) {
      plugin = new Plugin();
      plugin.setGroupId(pluginArtifact.getGroupId());
      plugin.setArtifactId(pluginArtifact.getArtifactId());
     
      final VersionOracle oracle = new VersionOracle(getFaceted().getFacet(DependencyFacet.class));
      plugin.setVersion(oracle.resolveVersion(pluginArtifact));
     
      profile.getBuild().addPlugin(plugin);
    }

    outer: for (final DependencyBuilder dep : getDependencies()) {
View Full Code Here

  @Override
  public boolean install() {
    final MavenPluginFacet pluginFacet = getProject().getFacet(MavenPluginFacet.class);
    final DependencyFacet depFacet = getProject().getFacet(DependencyFacet.class);
    final VersionOracle oracle = new VersionOracle(depFacet);
    final Dependency pluginDep = DependencyBuilder.create(getPluginArtifact().toString()).setVersion(
            oracle.resolveVersion(getPluginArtifact()));
    final MavenPluginBuilder plugin;

    if (pluginFacet.hasPlugin(pluginDep.getCoordinate())) {
      plugin = MavenPluginBuilder.create(pluginFacet.getPlugin(pluginDep.getCoordinate()));
      // So that it is not duplicated when added later on
      pluginFacet.removePlugin(pluginDep.getCoordinate());
    }
    else {
      plugin = MavenPluginBuilder.create();
      plugin.setCoordinate(pluginDep.getCoordinate());
    }

    Configuration config = plugin.getConfig();
    for (final ConfigurationElement configElem : getConfigurations()) {
      mergeConfigurationElement(config, configElem);
    }

    for (final DependencyBuilder dep : getDependencies()) {
      if (dep.getCoordinate().getVersion() == null || dep.getCoordinate().getVersion().equals("")) {
        if (dep.getGroupId().equals(ArtifactVault.ERRAI_GROUP_ID))
          dep.setVersion(Property.ErraiVersion.invoke());
        else
          dep.setVersion(oracle.resolveVersion(dep.getGroupId(), dep.getCoordinate().getArtifactId()));
      }
      plugin.addPluginDependency(dep);
    }

    for (final Execution exec : getExecutions()) {
View Full Code Here

TOP

Related Classes of org.jboss.errai.forge.util.VersionOracle

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.