private boolean areCoordinatesMatching(Coordinate coordinate1, Coordinate coordinate2) { return coordinate1.getArtifactId().equals(coordinate2.getArtifactId()) && coordinate1.getGroupId().equals(coordinate2.getGroupId()); }
private boolean isArquillianWildflySwarmDependencyInstalled(DependencyFacet dependencyFacet) { return dependencyFacet.getDependencies().stream() .map(dependency -> dependency.getCoordinate()) .anyMatch(coordinate -> "org.wildfly.swarm".equals(coordinate.getGroupId()) && "arquillian".equals(coordinate.getArtifactId())); }
public static MavenPlugin findDirectPlugin(Project project, final String artifactId) { MavenPluginFacet plugins = project.getFacet(MavenPluginFacet.class); List<MavenPlugin> list = plugins.listConfiguredPlugins(); Optional<MavenPlugin> maybePlugin = list.stream().filter(plugin -> plugin.getCoordinate().getArtifactId().equalsIgnoreCase(artifactId)).findFirst(); return maybePlugin.orElse(null); }
/** * @param mavenDep * A native Maven model of a Maven dependency artifact. * @param forgeDep * A forge model of a Maven dependency artifact. * @return True iff both models have the same group and artifact IDs. */ public static boolean areSameArtifact(final Dependency mavenDep, final org.jboss.forge.addon.dependencies.Dependency forgeDep) { return mavenDep.getGroupId().equals(forgeDep.getCoordinate().getGroupId()) && mavenDep.getArtifactId().equals(forgeDep.getCoordinate().getArtifactId()); }
public Collection<VertxDependency> getNotUsedDependencies() { List<Dependency> dependencies = getDependencyFacet().getDependencies(); List<String> artifactIds = dependencies.stream().map(d -> d.getCoordinate().getArtifactId()).collect(Collectors .toList()); return getAllDependencies().stream() .filter(dep -> !artifactIds.contains(dep.getArtifactId())) .collect(Collectors.toList()); }
public Collection<VertxDependency> getUsedDependencies() { List<Dependency> dependencies = getDependencyFacet().getDependencies(); List<String> artifactIds = dependencies.stream().map(d -> d.getCoordinate().getArtifactId()).collect(Collectors .toList()); return getAllDependencies().stream() .filter(dep -> artifactIds.contains(dep.getArtifactId())) .collect(Collectors.toList()); } }
private List<Exclusion> transformExclusions(List<Coordinate> excludedDependencies) { List<Exclusion> result = new ArrayList<Exclusion>(excludedDependencies.size()); for (Coordinate dependency : excludedDependencies) { Exclusion exclusion = new Exclusion(); exclusion.setArtifactId(dependency.getArtifactId()); exclusion.setGroupId(dependency.getGroupId()); result.add(exclusion); } return result; }
/** * @param dep1 * A native Maven model of a Maven dependency artifact. * @param dep2 * A native Maven model of a Maven dependency artifact. * @return True iff both models have the same group and artifact IDs. */ public static boolean areSameArtifact(final org.jboss.forge.addon.dependencies.Dependency dep1, final org.jboss.forge.addon.dependencies.Dependency dep2) { return dep1.getCoordinate().getGroupId().equals(dep2.getCoordinate().getGroupId()) && dep1.getCoordinate().getArtifactId().equals(dep2.getCoordinate().getArtifactId()); } }
public static Dependency findCamelArtifactDependency(Project project, String artifactId) { List<Dependency> dependencies = project.getFacet(DependencyFacet.class).getEffectiveDependencies(); for (Dependency d : dependencies) { if ("org.apache.camel".equals(d.getCoordinate().getGroupId()) && artifactId.equals(d.getCoordinate().getArtifactId())) { return d; } } return null; }
public void removeDependencies(List<VertxDependency> deps) { List<Dependency> dependencies = new ArrayList<>(getDependencyFacet().getDependencies()); deps.forEach(dep -> { for (Dependency dependency : dependencies) { if (dependency.getCoordinate().getArtifactId().equalsIgnoreCase(dep.getArtifactId())) { getDependencyFacet().removeDependency(dependency); } } }); save(); }
public static boolean isSkipped(Coordinate coordinate) { for (Entry<Coordinate, VersionRange> entry : map.entrySet()) { Coordinate pattern = entry.getKey(); VersionRange range = entry.getValue(); if (isPatternMatch(pattern.getGroupId(), coordinate.getGroupId()) && isPatternMatch(pattern.getArtifactId(), coordinate.getArtifactId()) && isPatternMatch(pattern.getClassifier(), coordinate.getClassifier())) { if (range.isEmpty() || range.includes(new SingleVersion(coordinate.getVersion()))) return true; } } return false; }
public static boolean isBlacklisted(final Dependency dep) { return isBlacklisted(dep.getCoordinate().getGroupId() + ":" + dep.getCoordinate().getArtifactId()); }
public static String getBlacklistedProfile(final Dependency dep) { return getBlacklistedProfile(dep.getCoordinate().getGroupId() + ":" + dep.getCoordinate().getArtifactId()); }
private MavenPlugin getPlugin(final Coordinate dependency, boolean managedPlugin, boolean effectivePlugin, org.jboss.forge.addon.maven.profiles.Profile profileParam) { String groupId = dependency.getGroupId(); groupId = (groupId == null) || groupId.equals("") ? DEFAULT_GROUPID : groupId; for (MavenPlugin mavenPlugin : listConfiguredPlugins(managedPlugin, effectivePlugin, profileParam)) { Coordinate temp = mavenPlugin.getCoordinate(); if (Dependencies.areEquivalent(temp, CoordinateBuilder.create(dependency).setGroupId(groupId))) { return mavenPlugin; } } throw new PluginNotFoundException(groupId, dependency.getArtifactId()); }
public static Artifact coordinateToMavenArtifact(final Coordinate dep) { Artifact artifact = new DefaultArtifact(dep.getGroupId(), dep.getArtifactId(), dep.getClassifier(), dep.getPackaging() == null ? "jar" : dep.getPackaging(), dep.getVersion()); return artifact; }
private void addVertxDependencies() { ForgeUtils.getOrAddDependency(getFaceted(), "io.vertx", "vertx-core"); ForgeUtils.getOrAddDependency(getFaceted(), "io.vertx", "vertx-unit", null, null, "test"); ForgeUtils.getOrAddDependency(getFaceted(), JUNIT_DEPENDENCY.getGroupId(), JUNIT_DEPENDENCY.getArtifactId(), JUNIT_DEPENDENCY.getVersion(), null, "test"); }
public static CoordinateBuilder create(Coordinate c) { CoordinateBuilder builder = create(); builder.setGroupId(c.getGroupId()).setArtifactId(c.getArtifactId()); builder.setClassifier(c.getClassifier()).setPackaging(c.getPackaging()).setVersion(c.getVersion()); return builder; }
@Override public Result execute(final UIExecutionContext context) throws Exception { final UIContext uiContext = context.getUIContext(); applyUIValues(uiContext); // add driver dependency final Project project = helper.getProject(uiContext); final DatabaseType database = dbType.getValue(); final Coordinate driverCoordinate = database.getDriverCoordinate(); SpringBootHelper.addDependency(project, driverCoordinate.getGroupId(), driverCoordinate.getArtifactId()) .setScopeType("runtime"); SpringBootHelper.addSpringBootDependency(project, SpringBootFacet.SPRING_BOOT_STARTER_DATA_JPA_ARTIFACT) .setScopeType("runtime"); return Results.success("Spring Boot JPA successfully set up!"); }
public MavenPluginAdapter(final MavenPlugin mavenPlugin) { Coordinate coordinate = mavenPlugin.getCoordinate(); setGroupId(coordinate.getGroupId()); setArtifactId(coordinate.getArtifactId()); setVersion(coordinate.getVersion()); setConfiguration(parseConfig(mavenPlugin.getConfig())); setExecutions(transformExecutions(mavenPlugin)); if (mavenPlugin.isExtensionsEnabled()) { setExtensions(true); } setDependencies(transformDependencies(mavenPlugin)); }
@Override public Dependency resolveProperties(final Dependency dependency) { MavenFacet mvn = getFaceted().getFacet(MavenFacet.class); DependencyBuilder builder = DependencyBuilder.create(dependency); builder.setGroupId(mvn.resolveProperties(dependency.getCoordinate().getGroupId())); builder.setArtifactId(mvn.resolveProperties(dependency.getCoordinate().getArtifactId())); builder.setVersion(mvn.resolveProperties(dependency.getCoordinate().getVersion())); builder.setClassifier(mvn.resolveProperties(dependency.getCoordinate().getClassifier())); builder.setPackaging(mvn.resolveProperties(dependency.getCoordinate().getPackaging())); builder.setScopeType(mvn.resolveProperties(dependency.getScopeType())); return builder; }