Skip to content
Advertisement

mvn compile OK, but mvn compile exec:java -D exec.mainClass=”mygroup.TestExpression” fails

I’ve refered to this post: Resource specification not allowed here for source level below 1.7

I used the solution, but didn’t solve problem.

Well I’m not using eclipse but jdk 1.8 + vscode on win10, using maven to generate a new project:

mvn archetype:generate

add these lines in my pom.xml inside the top level <project> tag:

JavaScript

Then I have this code:

JavaScript

Using mvn compile ok, but using mvn compile exec:java -D exec.mainClass="mygroup.TestExpression" will fail:

It reports error:

JavaScript

You could see I’ve specified maven-compiler-plugin version 3.8.0, while command line output showed exec-maven-plugin:3.0.0:.

I’m not sure if this was the reason, what’s the difference between mvn compile and mvn compile exec:java -D exec.mainClass="mygroup.TestExpression"?

How to solve this problem(compile+run in one step)?

Thanks!

Advertisement

Answer

Try specifying java version in properties tag inside pom

JavaScript

Also check out this link, maybe you’ll find something new there

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement