Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d138bd4

Browse filesBrowse files
Christoph Läubrichslawekjaranowski
authored andcommitted
[MCOMPILER-544] don't add items to classpath that are not used for that
Currently simply all kind of items are added to the classpath leading to strange errors in the ECJ compiler plugin because it does not know how to handle pom or other possible types. This adds an additional check to see if the artifact handler actually claims the itme should be put on the classpath,
1 parent 8e748ec commit d138bd4
Copy full SHA for d138bd4

File tree

Expand file treeCollapse file tree

1 file changed

+13
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+13
-1
lines changed

‎src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java

Copy file name to clipboardExpand all lines: src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java
+13-1Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ public class CompilerMojo extends AbstractCompilerMojo {
151151

152152
private Map<String, JavaModuleDescriptor> pathElements;
153153

154+
@Override
154155
protected List<String> getCompileSourceRoots() {
155156
return compileSourceRoots;
156157
}
@@ -170,6 +171,7 @@ protected Map<String, JavaModuleDescriptor> getPathElements() {
170171
return pathElements;
171172
}
172173

174+
@Override
173175
protected File getOutputDirectory() {
174176
File dir;
175177
if (!multiReleaseOutput) {
@@ -180,6 +182,7 @@ protected File getOutputDirectory() {
180182
return dir;
181183
}
182184

185+
@Override
183186
public void execute() throws MojoExecutionException, CompilationFailureException {
184187
if (skipMain) {
185188
getLog().info("Not compiling main sources");
@@ -344,11 +347,14 @@ private List<File> getCompileClasspathElements(MavenProject project) {
344347
list.add(new File(project.getBuild().getOutputDirectory()));
345348

346349
for (Artifact a : project.getArtifacts()) {
347-
list.add(a.getFile());
350+
if (a.getArtifactHandler().isAddedToClasspath()) {
351+
list.add(a.getFile());
352+
}
348353
}
349354
return list;
350355
}
351356

357+
@Override
352358
protected SourceInclusionScanner getSourceInclusionScanner(int staleMillis) {
353359
if (includes.isEmpty() && excludes.isEmpty() && incrementalExcludes.isEmpty()) {
354360
return new StaleSourceScanner(staleMillis);
@@ -363,6 +369,7 @@ protected SourceInclusionScanner getSourceInclusionScanner(int staleMillis) {
363369
return new StaleSourceScanner(staleMillis, includes, excludesIncr);
364370
}
365371

372+
@Override
366373
protected SourceInclusionScanner getSourceInclusionScanner(String inputFileEnding) {
367374
// it's not defined if we get the ending with or without the dot '.'
368375
String defaultIncludePattern = "**/*" + (inputFileEnding.startsWith(".") ? "" : ".") + inputFileEnding;
@@ -375,10 +382,12 @@ protected SourceInclusionScanner getSourceInclusionScanner(String inputFileEndin
375382
return new SimpleSourceInclusionScanner(includes, excludesIncr);
376383
}
377384

385+
@Override
378386
protected String getSource() {
379387
return source;
380388
}
381389

390+
@Override
382391
protected String getTarget() {
383392
return target;
384393
}
@@ -388,14 +397,17 @@ protected String getRelease() {
388397
return release;
389398
}
390399

400+
@Override
391401
protected String getCompilerArgument() {
392402
return compilerArgument;
393403
}
394404

405+
@Override
395406
protected Map<String, String> getCompilerArguments() {
396407
return compilerArguments;
397408
}
398409

410+
@Override
399411
protected File getGeneratedSourcesDirectory() {
400412
return generatedSourcesDirectory;
401413
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.