Skip to content

Commit 671ba68

Browse files
akurtakovrfscholte
authored andcommitted
#65 Add support for failOnWarning in eclipse compiler.
Signed-off-by: rfscholte <[email protected]>
1 parent 7476614 commit 671ba68

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

plexus-compilers/plexus-compiler-eclipse/src/main/java/org/codehaus/plexus/compiler/eclipse/EclipseJavaCompiler.java

+5
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,11 @@ public CompilerResult performCompile( CompilerConfiguration config )
151151
{
152152
args.add( "-parameters" );
153153
}
154+
155+
if(config.isFailOnWarning())
156+
{
157+
args.add("-failOnWarning");
158+
}
154159

155160
// Set Eclipse-specific options
156161
// compiler-specific extra options override anything else in the config object...
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package org.codehaus.plexus.compiler.eclipse;
2+
3+
import org.codehaus.plexus.compiler.AbstractCompilerTest;
4+
import org.codehaus.plexus.compiler.CompilerConfiguration;
5+
6+
import java.util.Arrays;
7+
import java.util.Collection;
8+
9+
public class EclipseCompilerFailOnWarningsTest extends AbstractCompilerTest
10+
{
11+
12+
protected void configureCompilerConfig( CompilerConfiguration compilerConfig )
13+
{
14+
compilerConfig.setFailOnWarning(true);
15+
}
16+
17+
protected String getRoleHint()
18+
{
19+
return "eclipse";
20+
}
21+
22+
protected int expectedErrors()
23+
{
24+
return 6;
25+
}
26+
27+
protected int expectedWarnings()
28+
{
29+
return 1;
30+
}
31+
32+
protected Collection<String> expectedOutputFiles()
33+
{
34+
return Arrays.asList( new String[] {
35+
"org/codehaus/foo/Deprecation.class",
36+
"org/codehaus/foo/ExternalDeps.class",
37+
"org/codehaus/foo/Person.class",
38+
"org/codehaus/foo/ReservedWord.class"
39+
});
40+
}
41+
}

0 commit comments

Comments
 (0)