Add profile for compilation with ECJ (#522)

diff --git a/.travis.sh b/.travis.sh
index c391c1c..dfbd8df 100755
--- a/.travis.sh
+++ b/.travis.sh
@@ -82,7 +82,7 @@
   mvn -V -B -e verify -Dbytecode.version=1.7
   ;;
 8 | 8-ea)
-  mvn -V -B -e verify -Dbytecode.version=1.8
+  mvn -V -B -e verify -Dbytecode.version=1.8 -Decj=${ECJ:-}
   ;;
 9-ea | 9-ea-stable)
   # Groovy version should be updated to get rid of "--add-opens" options (see https://twitter.com/CedricChampeau/status/807285853580103684)
diff --git a/.travis.yml b/.travis.yml
index 36ea75d..19f5d2b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -16,6 +16,8 @@
   - JDK=6
   - JDK=7
   - JDK=8
+  - JDK=8
+    ECJ=true
   - JDK=8-ea
   - JDK=9-ea
   - JDK=9-ea-stable
diff --git a/org.jacoco.build/pom.xml b/org.jacoco.build/pom.xml
index ad6472c..e746d6a 100644
--- a/org.jacoco.build/pom.xml
+++ b/org.jacoco.build/pom.xml
@@ -687,6 +687,40 @@
       </properties>
     </profile>
 
+    <!-- This profile is used for compilation with ECJ. -->
+    <profile>
+      <id>ecj</id>
+      <activation>
+        <property>
+          <name>ecj</name>
+        </property>
+      </activation>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-compiler-plugin</artifactId>
+            <version>3.6.0</version>
+            <configuration>
+              <compilerId>eclipse</compilerId>
+            </configuration>
+            <dependencies>
+              <dependency>
+                <groupId>org.eclipse.jdt.core.compiler</groupId>
+                <artifactId>ecj</artifactId>
+                <version>4.6.1</version>
+              </dependency>
+              <dependency>
+                <groupId>org.codehaus.plexus</groupId>
+                <artifactId>plexus-compiler-eclipse</artifactId>
+                <version>2.8.1</version>
+              </dependency>
+            </dependencies>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+
     <profile>
       <id>jdk16</id>
       <activation>
diff --git a/org.jacoco.doc/docroot/doc/build.html b/org.jacoco.doc/docroot/doc/build.html
index bc92656..89df34c 100644
--- a/org.jacoco.doc/docroot/doc/build.html
+++ b/org.jacoco.doc/docroot/doc/build.html
@@ -152,6 +152,14 @@
 </pre>
 
 <p>
+  Also Eclipse Compiler for Java can be used for compilation:
+</p>
+
+<pre>
+  mvn clean install -Decj
+</pre>
+
+<p>
   In addition JaCoCo can be compiled for higher class file versions than 1.5
   specifying the property <code>bytecode.version</code>. Note that in this case
   the version of the JVM running Maven must be at least the version of the
@@ -164,6 +172,7 @@
   <li>Maven with 1.6 JDK: <code>mvn clean install -Djdk.version=1.6 -Dbytecode.version=1.6</code></li>
   <li>Maven with 1.7 JDK: <code>mvn clean install -Djdk.version=1.7 -Dbytecode.version=1.7</code></li>
   <li>Maven with 1.8 JDK: <code>mvn clean install -Djdk.version=1.8 -Dbytecode.version=1.8</code></li>
+  <li>Maven with 1.8 JDK: <code>mvn clean install -Djdk.version=1.8 -Dbytecode.version=1.8 -Decj</code></li>
   <li>Maven with 1.9 JDK: <code>mvn clean install -Djdk.version=1.9 -Dbytecode.version=1.9</code></li>
 </ul>