Skip to content

Commit

Permalink
hack for testing, revert after incremental
Browse files Browse the repository at this point in the history
  • Loading branch information
basil committed Apr 23, 2022
1 parent 00a8ed6 commit e9888ad
Showing 1 changed file with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,19 +206,19 @@ public void execute() throws MojoExecutionException, MojoFailureException {
String artifactId = groupArt[1];
String version = entry.getValue();
// Cannot use MavenProject.getArtifactMap since we may have multiple dependencies of different classifiers.
boolean found = false;
//boolean found = false;
for (Artifact a : project.getArtifacts()) {
if (!a.getGroupId().equals(groupId) || !a.getArtifactId().equals(artifactId)) {
continue;
}
found = true;
//found = true;
if (a.getArtifactHandler().isAddedToClasspath()) { // everything is added to test CP, so no need to check scope
additionalClasspathElements.add(replace(a, version).getFile().getAbsolutePath());
}
}
if (!found) {
throw new MojoExecutionException("could not find dependency " + key);
}
//if (!found) {
//throw new MojoExecutionException("could not find dependency " + key);
//}
}
Properties properties = project.getProperties();
getLog().info("Replacing POM-defined classpath elements " + classpathDependencyExcludes + " with " + additionalClasspathElements);
Expand Down Expand Up @@ -268,31 +268,31 @@ private static void pass(Map<String, String> overrides, MavenProject project, Lo
}
}
unappliedDependencies.removeAll(updatedDependencies);
if (!unappliedDependencies.isEmpty()) {
throw new MojoFailureException("could not find dependencies " + unappliedDependencies);
}
//if (!unappliedDependencies.isEmpty()) {
//throw new MojoFailureException("could not find dependencies " + unappliedDependencies);
//}
log.debug("adjusted dependencies: " + project.getDependencies());
if (project.getDependencyManagement() != null) {
log.debug("adjusted dependency management: " + project.getDependencyManagement().getDependencies());
}

// Now update the artifacts corresponding to the model changes
Set<String> updatedArtifacts = new HashSet<>();
//Set<String> updatedArtifacts = new HashSet<>();
for (Artifact artifact : project.getArtifacts()) {
String key = toKey(artifact);
if (updatedDependencies.contains(key)) {
String overrideVersion = overrides.get(key);
if (overrideVersion != null) {
artifact.setVersion(overrideVersion);
updatedArtifacts.add(key);
//updatedArtifacts.add(key);
}
}
}
Set<String> unappliedArtifacts = new HashSet<>(overrides.keySet());
unappliedArtifacts.removeAll(updatedArtifacts);
if (!unappliedArtifacts.isEmpty()) {
throw new MojoFailureException("could not find artifacts " + unappliedArtifacts);
}
//Set<String> unappliedArtifacts = new HashSet<>(overrides.keySet());
//unappliedArtifacts.removeAll(updatedArtifacts);
//if (!unappliedArtifacts.isEmpty()) {
//throw new MojoFailureException("could not find artifacts " + unappliedArtifacts);
//}
}

private static boolean updateDependency(
Expand Down

0 comments on commit e9888ad

Please sign in to comment.