Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MCOMPILER-544] don't add items to classpath that are not used for that #198

Merged
merged 1 commit into from
Oct 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ public class CompilerMojo extends AbstractCompilerMojo {

private Map<String, JavaModuleDescriptor> pathElements;

@Override
protected List<String> getCompileSourceRoots() {
return compileSourceRoots;
}
Expand All @@ -170,6 +171,7 @@ protected Map<String, JavaModuleDescriptor> getPathElements() {
return pathElements;
}

@Override
protected File getOutputDirectory() {
File dir;
if (!multiReleaseOutput) {
Expand All @@ -180,6 +182,7 @@ protected File getOutputDirectory() {
return dir;
}

@Override
public void execute() throws MojoExecutionException, CompilationFailureException {
if (skipMain) {
getLog().info("Not compiling main sources");
Expand Down Expand Up @@ -343,11 +346,14 @@ private List<File> getCompileClasspathElements(MavenProject project) {
list.add(new File(project.getBuild().getOutputDirectory()));

for (Artifact a : project.getArtifacts()) {
list.add(a.getFile());
if (a.getArtifactHandler().isAddedToClasspath()) {
list.add(a.getFile());
}
}
return list;
}

@Override
protected SourceInclusionScanner getSourceInclusionScanner(int staleMillis) {
if (includes.isEmpty() && excludes.isEmpty() && incrementalExcludes.isEmpty()) {
return new StaleSourceScanner(staleMillis);
Expand All @@ -362,6 +368,7 @@ protected SourceInclusionScanner getSourceInclusionScanner(int staleMillis) {
return new StaleSourceScanner(staleMillis, includes, excludesIncr);
}

@Override
protected SourceInclusionScanner getSourceInclusionScanner(String inputFileEnding) {
// it's not defined if we get the ending with or without the dot '.'
String defaultIncludePattern = "**/*" + (inputFileEnding.startsWith(".") ? "" : ".") + inputFileEnding;
Expand All @@ -374,10 +381,12 @@ protected SourceInclusionScanner getSourceInclusionScanner(String inputFileEndin
return new SimpleSourceInclusionScanner(includes, excludesIncr);
}

@Override
protected String getSource() {
return source;
}

@Override
protected String getTarget() {
return target;
}
Expand All @@ -387,14 +396,17 @@ protected String getRelease() {
return release;
}

@Override
protected String getCompilerArgument() {
return compilerArgument;
}

@Override
protected Map<String, String> getCompilerArguments() {
return compilerArguments;
}

@Override
protected File getGeneratedSourcesDirectory() {
return generatedSourcesDirectory;
}
Expand Down