sensepost/mallet

Errors building from maven

summitt opened this issue · 3 comments

I'm having some issues building the project using mvn package. First i was getting this error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project mallet: Fatal error compiling: invalid flag: --release -> [Help 1]

Then I removed the <release/> line from the pom.xml file and I got a little further. Now i'm getting several errors like this:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project mallet: Compilation failure: Compilation failure: 
[ERROR] /Users/josh/tools/mallet/src/main/java/com/sensepost/mallet/swing/editors/ReflectionEditor.java:[122,56] diamond operator is not supported in -source 1.6
[ERROR]   (use -source 7 or higher to enable diamond operator)
[ERROR] /Users/josh/tools/mallet/src/main/java/com/sensepost/mallet/swing/AutoEditor.java:[22,60] diamond operator is not supported in -source 1.6
[ERROR]   (use -source 7 or higher to enable diamond operator)
[ERROR] /Users/josh/tools/mallet/src/main/java/com/sensepost/mallet/Main.java:[115,44] multi-catch statement is not supported in -source 1.6
[ERROR]   (use -source 7 or higher to enable multi-catch statement)
...

Below are the versions i'm using:

❯ mvn -version
Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T13:41:47-05:00)
Maven home: /usr/local/Cellar/maven/3.6.0/libexec
Java version: 1.8.0_151, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.14.2", arch: "x86_64", family: "mac"
❯ java -version
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)

Hey Josh. I guess I have something wrong with the pom, that it is not setting the right source levels (Java compatibility levels) somehow.

Could you please try setting the <source> and <target> elements to 1.8, as shown here: https://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html

Perfect! That fixed it. Thanks @RoganDawes

Awesome! Did you remove the <release>11</release> element? Or did it work with both in place? Then I can update the pom, and commit.