Skip to content

Commit

Permalink
Merge pull request #131 from alfasoftware/plugin-ignore-additional-cl…
Browse files Browse the repository at this point in the history
…asspath

Ignore additional classpath on usecase when using the plugin
  • Loading branch information
RadikalJin authored Dec 4, 2024
2 parents 12c42a1 + e235b7f commit 7a38717
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,16 @@ public class RefactorMojo extends AbstractMojo {
@Override
public void execute() throws MojoExecutionException {

List<String> testClasspathElements;
try {
List<String> testClasspathElements;
try {
testClasspathElements = project.getTestClasspathElements();
} catch (DependencyResolutionRequiredException e) {
throw new MojoExecutionException("Unable to resolve test class path for the project", e);
}

// remove anything within this projects target directory as it has been
// remove anything within this projects target directory as this will invalidate it
testClasspathElements.removeIf(s -> s.startsWith(targetDirectory));

// might need to add source from other projects if running multi-module??

UseCase useCaseInstance = getUseCaseInstance();
AstraCore.run(sourceDirectory.getAbsolutePath(), new UseCase() {

Expand All @@ -86,9 +84,9 @@ public Predicate<String> getPrefilteringPredicate() {

@Override
public Set<String> getAdditionalClassPathEntries() {
HashSet<String> additionalClassPath = new HashSet<>(useCaseInstance.getAdditionalClassPathEntries());
additionalClassPath.addAll(testClasspathElements);
return additionalClassPath;
// This is a Maven plugin that can access the full classpath required for the source code Astra is running over - no additional help required.
return Set.of();

}
});

Expand Down

0 comments on commit 7a38717

Please sign in to comment.