summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorRoland Grunberg2013-03-20 16:15:59 (EDT)
committer Jan Sievers2013-09-09 11:07:30 (EDT)
commit1f3435ecfabeb79becd0526ea88303e46c1b5204 (patch)
tree944b592f9e610ecf5b42171ec352ba32a1c19bcc
parent037d4b8b828a43acf93c81d3ba467d7e668e7ba6 (diff)
downloadorg.eclipse.tycho-1f3435ecfabeb79becd0526ea88303e46c1b5204.zip
org.eclipse.tycho-1f3435ecfabeb79becd0526ea88303e46c1b5204.tar.gz
org.eclipse.tycho-1f3435ecfabeb79becd0526ea88303e46c1b5204.tar.bz2
405385 Update to Plexus Compiler 2.2 APIrefs/changes/09/15509/6
so that tycho's jdt compiler can be used with maven-compiler-plugin 3.x Add integration test that covers this scenario. Bug: 405385 CQ: 7559 CQ: 7560 Signed-off-by: Roland Grunberg <rgrunber@redhat.com> Change-Id: Ibfef641b652c9db3f791922d5748f58652f7dfca
-rw-r--r--pom.xml4
-rw-r--r--tycho-compiler-jdt/src/main/java/org/eclipse/tycho/compiler/jdt/JDTCompiler.java55
-rw-r--r--tycho-compiler-jdt/src/test/java/org/eclipse/tycho/compiler/jdt/JDTCompilerTest.java80
-rw-r--r--tycho-compiler-plugin/src/main/java/copied/org/apache/maven/plugin/AbstractCompilerMojo.java19
-rw-r--r--tycho-compiler-plugin/src/main/java/copied/org/apache/maven/plugin/CompilationFailureException.java14
-rw-r--r--tycho-its/projects/TYCHO590annotationProcessing/annotated-project/pom.xml2
-rw-r--r--tycho-its/projects/TYCHO590annotationProcessing/pom.xml2
-rw-r--r--tycho-its/projects/compiler.mavenCompilerPlugin/pom.xml41
-rw-r--r--tycho-its/projects/compiler.mavenCompilerPlugin/src/main/java/Foo.java4
-rw-r--r--tycho-its/src/test/java/org/eclipse/tycho/test/compiler/MavenCompilerPluginTest.java34
10 files changed, 167 insertions, 88 deletions
diff --git a/pom.xml b/pom.xml
index f89e457..7cd5c9d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -224,12 +224,12 @@ $CMD -DpomFile=org.eclipse.jdt.compiler.apt.pom \
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-api</artifactId>
- <version>1.8.1</version>
+ <version>2.2</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-manager</artifactId>
- <version>1.8.1</version>
+ <version>2.2</version>
</dependency>
<dependency>
<groupId>org.eclipse.tycho</groupId>
diff --git a/tycho-compiler-jdt/src/main/java/org/eclipse/tycho/compiler/jdt/JDTCompiler.java b/tycho-compiler-jdt/src/main/java/org/eclipse/tycho/compiler/jdt/JDTCompiler.java
index f87983d..13220d1 100644
--- a/tycho-compiler-jdt/src/main/java/org/eclipse/tycho/compiler/jdt/JDTCompiler.java
+++ b/tycho-compiler-jdt/src/main/java/org/eclipse/tycho/compiler/jdt/JDTCompiler.java
@@ -19,7 +19,6 @@ import java.io.PrintWriter;
import java.io.StringReader;
import java.io.StringWriter;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -28,9 +27,11 @@ import java.util.regex.Pattern;
import org.codehaus.plexus.compiler.AbstractCompiler;
import org.codehaus.plexus.compiler.CompilerConfiguration;
-import org.codehaus.plexus.compiler.CompilerError;
import org.codehaus.plexus.compiler.CompilerException;
+import org.codehaus.plexus.compiler.CompilerMessage;
+import org.codehaus.plexus.compiler.CompilerMessage.Kind;
import org.codehaus.plexus.compiler.CompilerOutputStyle;
+import org.codehaus.plexus.compiler.CompilerResult;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.cli.CommandLineException;
@@ -69,7 +70,8 @@ public class JDTCompiler extends AbstractCompiler {
// Compiler Implementation
// ----------------------------------------------------------------------
- public List<CompilerError> compile(CompilerConfiguration config) throws CompilerException {
+ @Override
+ public CompilerResult performCompile(CompilerConfiguration config) throws CompilerException {
CustomCompilerConfiguration custom = new CustomCompilerConfiguration();
File destinationDir = new File(config.getOutputLocation());
@@ -81,20 +83,19 @@ public class JDTCompiler extends AbstractCompiler {
String[] sourceFiles = getSourceFiles(config);
if (sourceFiles.length == 0) {
- return Collections.emptyList();
+ return new CompilerResult();
}
getLogger().info(
"Compiling " + sourceFiles.length + " " + "source file" + (sourceFiles.length == 1 ? "" : "s") + " to "
+ destinationDir.getAbsolutePath());
- @SuppressWarnings("unchecked")
- Map<String, String> customCompilerArguments = config.getCustomCompilerArguments();
+ Map<String, String> customCompilerArguments = config.getCustomCompilerArgumentsAsMap();
checkCompilerArgs(customCompilerArguments, custom);
String[] args = buildCompilerArguments(config, custom, sourceFiles);
- List<CompilerError> messages;
+ CompilerResult messages;
if (config.isFork()) {
String executable = config.getExecutable();
@@ -277,10 +278,10 @@ public class JDTCompiler extends AbstractCompiler {
* name of the executable to launch
* @param args
* arguments for the executable launched
- * @return List of CompilerError objects with the errors encountered.
+ * @return CompilerResult with the errors and warnings encountered.
* @throws CompilerException
*/
- List<CompilerError> compileOutOfProcess(File workingDirectory, String executable, String[] args)
+ CompilerResult compileOutOfProcess(File workingDirectory, String executable, String[] args)
throws CompilerException {
if (true /* fork is not supported */) {
throw new UnsupportedOperationException("compileoutOfProcess not supported");
@@ -300,7 +301,7 @@ public class JDTCompiler extends AbstractCompiler {
int returnCode;
- List<CompilerError> messages;
+ List<CompilerMessage> messages;
try {
returnCode = CommandLineUtils.executeCommandLine(cli, out, err);
@@ -314,11 +315,11 @@ public class JDTCompiler extends AbstractCompiler {
if (returnCode != 0 && messages.isEmpty()) {
// TODO: exception?
- messages.add(new CompilerError("Failure executing javac, but could not parse the error:" + EOL
- + err.getOutput(), true));
+ messages.add(new CompilerMessage("Failure executing javac, but could not parse the error:" + EOL
+ + err.getOutput(), Kind.ERROR));
}
- return messages;
+ return new CompilerResult(returnCode == 0, messages);
}
/**
@@ -327,12 +328,12 @@ public class JDTCompiler extends AbstractCompiler {
*
* @param args
* arguments for the compiler as they would be used in the command line javac
- * @return List of CompilerError objects with the errors encountered.
+ * @return CompilerResult with the errors and warnings encountered.
* @throws CompilerException
*/
- List<CompilerError> compileInProcess(String[] args, CustomCompilerConfiguration custom) throws CompilerException {
+ CompilerResult compileInProcess(String[] args, CustomCompilerConfiguration custom) throws CompilerException {
- List<CompilerError> messages;
+ List<CompilerMessage> messages;
StringWriter out = new StringWriter();
StringWriter err = new StringWriter();
@@ -357,19 +358,19 @@ public class JDTCompiler extends AbstractCompiler {
// low-level, e.g. configuration error
throw new CompilerException(err.toString());
}
- return messages;
+ return new CompilerResult(success, messages);
}
/**
- * Parse the output from the compiler into a list of CompilerError objects
+ * Parse the output from the compiler into a list of CompilerMessage objects
*
* @param input
* The output of the compiler
- * @return List of CompilerError objects
+ * @return List of CompilerMessage objects
* @throws IOException
*/
- protected static List<CompilerError> parseModernStream(BufferedReader input) throws IOException {
- List<CompilerError> errors = new ArrayList<CompilerError>();
+ protected static List<CompilerMessage> parseModernStream(BufferedReader input) throws IOException {
+ List<CompilerMessage> messages = new ArrayList<CompilerMessage>();
String type = null;
String file = null;
int lineNr = -1;
@@ -377,7 +378,7 @@ public class JDTCompiler extends AbstractCompiler {
for (String line = input.readLine(); line != null; line = input.readLine()) {
Matcher matcher = LINE_PATTERN.matcher(line);
if (matcher.matches()) {
- addErrorIfFound(errors, type, file, lineNr, messageBuffer.toString());
+ addMessageIfFound(messages, type, file, lineNr, messageBuffer.toString());
/* String errorNr = */matcher.group(1);
type = matcher.group(2);
file = matcher.group(3);
@@ -395,13 +396,15 @@ public class JDTCompiler extends AbstractCompiler {
}
}
}
- addErrorIfFound(errors, type, file, lineNr, messageBuffer.toString());
- return errors;
+ addMessageIfFound(messages, type, file, lineNr, messageBuffer.toString());
+ return messages;
}
- private static void addErrorIfFound(List<CompilerError> errors, String type, String file, int line, String message) {
+ private static void addMessageIfFound(List<CompilerMessage> messages, String type, String file, int line,
+ String message) {
if (type != null) {
- errors.add(new CompilerError(file, "ERROR".equals(type), line, 0, line, 0, message));
+ Kind kind = "ERROR".equals(type) ? Kind.ERROR : Kind.WARNING;
+ messages.add(new CompilerMessage(file, kind, line, 0, line, 0, message));
}
}
diff --git a/tycho-compiler-jdt/src/test/java/org/eclipse/tycho/compiler/jdt/JDTCompilerTest.java b/tycho-compiler-jdt/src/test/java/org/eclipse/tycho/compiler/jdt/JDTCompilerTest.java
index 6f1c51f..a432a60 100644
--- a/tycho-compiler-jdt/src/test/java/org/eclipse/tycho/compiler/jdt/JDTCompilerTest.java
+++ b/tycho-compiler-jdt/src/test/java/org/eclipse/tycho/compiler/jdt/JDTCompilerTest.java
@@ -20,7 +20,8 @@ import java.io.IOException;
import java.io.StringReader;
import java.util.List;
-import org.codehaus.plexus.compiler.CompilerError;
+import org.codehaus.plexus.compiler.CompilerMessage;
+import org.codehaus.plexus.compiler.CompilerMessage.Kind;
import org.junit.Test;
public class JDTCompilerTest {
@@ -29,33 +30,33 @@ public class JDTCompilerTest {
@Test
public void testParseModernStreamErrorWithLineAndTrailingSpace() throws IOException {
- List<CompilerError> errors = JDTCompiler.parseModernStream(createOutputForLines(
+ List<CompilerMessage> messages = JDTCompiler.parseModernStream(createOutputForLines(
"1. ERROR in foo bar (at line 3) ", "2. ERROR in test (at line 5)"));
- assertEquals(2, errors.size());
- CompilerError error = errors.get(0);
- assertTrue(error.isError());
- assertEquals("", error.getMessage());
- assertEquals("foo bar", error.getFile());
- assertEquals(3, error.getStartLine());
- error = errors.get(1);
- assertTrue(error.isError());
- assertEquals("", error.getMessage());
- assertEquals("test", error.getFile());
- assertEquals(5, error.getStartLine());
+ assertEquals(2, messages.size());
+ CompilerMessage message = messages.get(0);
+ assertTrue(message.isError());
+ assertEquals("", message.getMessage());
+ assertEquals("foo bar", message.getFile());
+ assertEquals(3, message.getStartLine());
+ message = messages.get(1);
+ assertTrue(message.isError());
+ assertEquals("", message.getMessage());
+ assertEquals("test", message.getFile());
+ assertEquals(5, message.getStartLine());
}
@Test
public void testParseModernStreamContextLines() throws IOException {
- List<CompilerError> errors = JDTCompiler.parseModernStream(createOutputForLines("prologue (must be discarded)",
- "1. ERROR in foo bar (at line 3) ", "message line1", "message line2"));
- assertEquals(1, errors.size());
- CompilerError error = errors.get(0);
+ List<CompilerMessage> messages = JDTCompiler.parseModernStream(createOutputForLines(
+ "prologue (must be discarded)", "1. ERROR in foo bar (at line 3) ", "message line1", "message line2"));
+ assertEquals(1, messages.size());
+ CompilerMessage error = messages.get(0);
assertEquals(EOL + "message line1" + EOL + "message line2", error.getMessage());
}
@Test
public void testParseModernStreamIgnoreSeparatorLines() throws IOException {
- List<CompilerError> errors = JDTCompiler.parseModernStream(createOutputForLines(//
+ List<CompilerMessage> messages = JDTCompiler.parseModernStream(createOutputForLines(//
"----------",//
"1. ERROR in foo bar (at line 3) ", //
"a context line",//
@@ -64,13 +65,13 @@ public class JDTCompilerTest {
"2. WARNING in test2 (at line 4)",//
"second context line",//
"----------"));
- assertEquals(2, errors.size());
- CompilerError error = errors.get(0);
+ assertEquals(2, messages.size());
+ CompilerMessage error = messages.get(0);
assertTrue(error.isError());
assertEquals("foo bar", error.getFile());
assertEquals(3, error.getStartLine());
assertEquals(EOL + "a context line", error.getMessage());
- error = errors.get(1);
+ error = messages.get(1);
assertFalse(error.isError());
assertEquals("test2", error.getFile());
assertEquals(4, error.getStartLine());
@@ -79,33 +80,34 @@ public class JDTCompilerTest {
@Test
public void testParseModernStreamErrorWithoutLine() throws IOException {
- List<CompilerError> errors = JDTCompiler.parseModernStream(createOutputForLines("1. ERROR in baz"));
- assertEquals(1, errors.size());
- CompilerError error = errors.get(0);
- assertTrue(error.isError());
- assertEquals("baz", error.getFile());
- assertEquals(-1, error.getStartLine());
+ List<CompilerMessage> messages = JDTCompiler.parseModernStream(createOutputForLines("1. ERROR in baz"));
+ assertEquals(1, messages.size());
+ CompilerMessage message = messages.get(0);
+ assertTrue(message.isError());
+ assertEquals("baz", message.getFile());
+ assertEquals(-1, message.getStartLine());
}
@Test
public void testParseModernStreamWarning() throws IOException {
- List<CompilerError> errors = JDTCompiler
+ List<CompilerMessage> messages = JDTCompiler
.parseModernStream(createOutputForLines("2. WARNING in foo (at line 4)"));
- assertEquals(1, errors.size());
- CompilerError error = errors.get(0);
- assertFalse(error.isError());
- assertEquals("foo", error.getFile());
- assertEquals(4, error.getStartLine());
+ assertEquals(1, messages.size());
+ CompilerMessage message = messages.get(0);
+ assertEquals(Kind.WARNING, message.getKind());
+ assertEquals("foo", message.getFile());
+ assertEquals(4, message.getStartLine());
}
@Test
public void testParseModernStreamWarningNoNumber() throws IOException {
- List<CompilerError> errors = JDTCompiler.parseModernStream(createOutputForLines("WARNING in foo (at line 4)"));
- assertEquals(1, errors.size());
- CompilerError error = errors.get(0);
- assertFalse(error.isError());
- assertEquals("foo", error.getFile());
- assertEquals(4, error.getStartLine());
+ List<CompilerMessage> messages = JDTCompiler
+ .parseModernStream(createOutputForLines("WARNING in foo (at line 4)"));
+ assertEquals(1, messages.size());
+ CompilerMessage message = messages.get(0);
+ assertFalse(message.isError());
+ assertEquals("foo", message.getFile());
+ assertEquals(4, message.getStartLine());
}
private static BufferedReader createOutputForLines(String... lines) {
diff --git a/tycho-compiler-plugin/src/main/java/copied/org/apache/maven/plugin/AbstractCompilerMojo.java b/tycho-compiler-plugin/src/main/java/copied/org/apache/maven/plugin/AbstractCompilerMojo.java
index 74ba22c..34e361a 100644
--- a/tycho-compiler-plugin/src/main/java/copied/org/apache/maven/plugin/AbstractCompilerMojo.java
+++ b/tycho-compiler-plugin/src/main/java/copied/org/apache/maven/plugin/AbstractCompilerMojo.java
@@ -29,9 +29,10 @@ import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.codehaus.plexus.compiler.Compiler;
import org.codehaus.plexus.compiler.CompilerConfiguration;
-import org.codehaus.plexus.compiler.CompilerError;
import org.codehaus.plexus.compiler.CompilerException;
+import org.codehaus.plexus.compiler.CompilerMessage;
import org.codehaus.plexus.compiler.CompilerOutputStyle;
+import org.codehaus.plexus.compiler.CompilerResult;
import org.codehaus.plexus.compiler.manager.CompilerManager;
import org.codehaus.plexus.compiler.manager.NoSuchCompilerException;
import org.codehaus.plexus.compiler.util.scan.InclusionScanException;
@@ -417,28 +418,26 @@ public abstract class AbstractCompilerMojo extends AbstractMojo {
// Compile!
// ----------------------------------------------------------------------
- List messages;
+ CompilerResult result;
try {
- messages = compiler.compile(compilerConfiguration);
+ result = compiler.performCompile(compilerConfiguration);
} catch (Exception e) {
// TODO: don't catch Exception
throw new MojoExecutionException("Fatal error compiling", e);
}
- boolean compilationError = false;
+ List<CompilerMessage> messages = result.getCompilerMessages();
- for (Iterator i = messages.iterator(); i.hasNext();) {
- CompilerError message = (CompilerError) i.next();
- if (message.isError()) {
- compilationError = true;
- } else {
+ for (Iterator<CompilerMessage> i = messages.iterator(); i.hasNext();) {
+ CompilerMessage message = i.next();
+ if (!message.isError()) {
getLog().warn(message.toString());
i.remove();
}
}
- if (compilationError) {
+ if (!result.isSuccess()) {
throw new CompilationFailureException(messages);
}
}
diff --git a/tycho-compiler-plugin/src/main/java/copied/org/apache/maven/plugin/CompilationFailureException.java b/tycho-compiler-plugin/src/main/java/copied/org/apache/maven/plugin/CompilationFailureException.java
index 78dc4d8..a0dada0 100644
--- a/tycho-compiler-plugin/src/main/java/copied/org/apache/maven/plugin/CompilationFailureException.java
+++ b/tycho-compiler-plugin/src/main/java/copied/org/apache/maven/plugin/CompilationFailureException.java
@@ -16,11 +16,10 @@
package copied.org.apache.maven.plugin;
-import java.util.Iterator;
import java.util.List;
import org.apache.maven.plugin.MojoFailureException;
-import org.codehaus.plexus.compiler.CompilerError;
+import org.codehaus.plexus.compiler.CompilerMessage;
public class CompilationFailureException extends MojoFailureException {
/**
@@ -29,17 +28,14 @@ public class CompilationFailureException extends MojoFailureException {
private static final long serialVersionUID = 6116801730028853785L;
private static final String LS = System.getProperty("line.separator");
- public CompilationFailureException(List messages) {
+ public CompilationFailureException(List<CompilerMessage> messages) {
super(null, "Compilation failure", longMessage(messages));
}
- public static String longMessage(List messages) {
+ public static String longMessage(List<CompilerMessage> messages) {
StringBuffer sb = new StringBuffer();
-
- for (Iterator it = messages.iterator(); it.hasNext();) {
- CompilerError compilerError = (CompilerError) it.next();
-
- sb.append(compilerError).append(LS);
+ for (CompilerMessage compilerMessage : messages) {
+ sb.append(compilerMessage).append(LS);
}
return sb.toString();
}
diff --git a/tycho-its/projects/TYCHO590annotationProcessing/annotated-project/pom.xml b/tycho-its/projects/TYCHO590annotationProcessing/annotated-project/pom.xml
index 54ff1c2..e4095a5 100644
--- a/tycho-its/projects/TYCHO590annotationProcessing/annotated-project/pom.xml
+++ b/tycho-its/projects/TYCHO590annotationProcessing/annotated-project/pom.xml
@@ -15,7 +15,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
- <version>2.3.2</version>
+ <version>3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
diff --git a/tycho-its/projects/TYCHO590annotationProcessing/pom.xml b/tycho-its/projects/TYCHO590annotationProcessing/pom.xml
index 150521e..dd7fd2e 100644
--- a/tycho-its/projects/TYCHO590annotationProcessing/pom.xml
+++ b/tycho-its/projects/TYCHO590annotationProcessing/pom.xml
@@ -16,7 +16,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
- <version>2.3.2</version>
+ <version>3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
diff --git a/tycho-its/projects/compiler.mavenCompilerPlugin/pom.xml b/tycho-its/projects/compiler.mavenCompilerPlugin/pom.xml
new file mode 100644
index 0000000..29595d1
--- /dev/null
+++ b/tycho-its/projects/compiler.mavenCompilerPlugin/pom.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ - Copyright (c) 2013 SAP AG and others.
+ - All rights reserved. This program and the accompanying materials
+ - are made available under the terms of the Eclipse Public License v1.0
+ - which accompanies this distribution, and is available at
+ - http://www.eclipse.org/legal/epl-v10.html
+ -
+ - Contributors:
+ - SAP AG - initial API and implementation
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>tycho.its</groupId>
+ <artifactId>maven-compiler-jdt</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+
+ <packaging>jar</packaging>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.0</version>
+ <configuration>
+ <compilerId>jdt</compilerId>
+ <compilerArgument>-err:unused</compilerArgument>
+ </configuration>
+ <dependencies>
+ <dependency>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-compiler-jdt</artifactId>
+ <version>${tycho-version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+</project> \ No newline at end of file
diff --git a/tycho-its/projects/compiler.mavenCompilerPlugin/src/main/java/Foo.java b/tycho-its/projects/compiler.mavenCompilerPlugin/src/main/java/Foo.java
new file mode 100644
index 0000000..78b223b
--- /dev/null
+++ b/tycho-its/projects/compiler.mavenCompilerPlugin/src/main/java/Foo.java
@@ -0,0 +1,4 @@
+
+public class Foo {
+ private String unused;
+}
diff --git a/tycho-its/src/test/java/org/eclipse/tycho/test/compiler/MavenCompilerPluginTest.java b/tycho-its/src/test/java/org/eclipse/tycho/test/compiler/MavenCompilerPluginTest.java
new file mode 100644
index 0000000..35d12e1
--- /dev/null
+++ b/tycho-its/src/test/java/org/eclipse/tycho/test/compiler/MavenCompilerPluginTest.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2013 SAP AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tycho.test.compiler;
+
+import org.apache.maven.it.VerificationException;
+import org.apache.maven.it.Verifier;
+import org.eclipse.tycho.test.AbstractTychoIntegrationTest;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class MavenCompilerPluginTest extends AbstractTychoIntegrationTest {
+
+ @Test
+ public void testJDTCompilerId() throws Exception {
+ Verifier verifier = getVerifier("compiler.mavenCompilerPlugin", false);
+ try {
+ verifier.executeGoal("compile");
+ Assert.fail();
+ } catch (VerificationException e) {
+ // expected
+ verifier.verifyTextInLog("field Foo.unused is not used");
+ }
+ }
+
+}