Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problems running Java 8 TestNG inside IntelliJ

Tags:

I am writing a Maven application using OpenJDK 1.8 and running tests using TestNG.

When I run Maven from the command line everything works fine, but when I try to run the test inside IntelliJ, then the make process is displaying the following error:

java: javacTask: source release 8 requires target release 1.8 

I have the project settings pointing to the 1.8 JDK and Project Language Level 8.

Inside Maven I have the following block (which I am guessing is not getting called yet as it seems to be the make causing the problem)

  <plugin>     <groupId>org.apache.maven.plugins</groupId>     <artifactId>maven-compiler-plugin</artifactId>     <version>2.3.2</version>     <configuration>       <source>1.8</source>       <target>1.8</target>     </configuration>   </plugin> 

I have even configured the Maven Runner JRE to point to the 1.8 JDK.

I just don't seem to be able to get IntelliJ 12.0.4 to run the tests properly

Am I missing something?

like image 930
Xetius Avatar asked Mar 25 '13 12:03

Xetius


People also ask

How do I run TestNG in IntelliJ?

Run a test suiteFrom the main menu, select Run | Edit Configurations. and from the list that opens, select TestNG. Name the new configuration. From the Test kind list, select Suite.

What is TestNG plugin for IntelliJ?

TestNG-J is a plugin that provides integration with the TestNG framework in a very similar way to the native IntelliJ IDEA integration with JUnit. TestNG-J adds its own type of run/debug configuration that allows for running tests. It also displays testing results and highlights failed and passed tests.


1 Answers

After the hint from CrazyCoder it turns out that .idea/compiler.xml had the following section in it

<bytecodeTargetLevel>      <module name="game" target="1.7" />  </bytecodeTargetLevel>  

I changed this to:

<bytecodeTargetLevel>      <module name="game" target="1.8" />  </bytecodeTargetLevel>  

and it worked

like image 193
Xetius Avatar answered Oct 11 '22 08:10

Xetius