Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handle different language and target levels for sources and tests with IntelliJ IDEA

I'm interested if someone has clue how to handle this pom in projects properties of IDEA:

<plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-compiler-plugin</artifactId>
   <configuration>
       <source>1.3</source>
       <target>1.3</target>
       <testSource>1.5</testSource>
       <testTarget>1.5</testTarget>
   </configuration>
   <version>3.0</version>
</plugin> 

Should I set project level 1.3 and module level 1.5 or wise verse around?

As well anytime when IDEA reloads maven project it sets language levels as it thinks from maven to 1.3 and after always complaints about test classes.

But this will go as bug report to JetBrains.

like image 835
Eugen Martynov Avatar asked Feb 01 '13 11:02

Eugen Martynov


People also ask

How do I change the language level in IntelliJ?

Configure module language levelFrom the main menu, select File | Project Structure Ctrl+Alt+Shift+S . Under Project Settings, select Modules | Sources. From the Language level list, select the necessary option. To use the project language level, select Project default.

Does IntelliJ IDEA support all languages?

Though designed primarily for Java development, IntelliJ IDEA understands many other programming languages, including Groovy, Kotlin, Scala, JavaScript, TypeScript, and SQL, and it provides smart coding assistance for each of them. Initial indexing of source code allows the IDE to create a virtual map of your project.

What is test sources root in IntelliJ?

The Test Sources Root is a folder that stores your test code. In the Project tool window, this folder is marked with the. icon. The IDE processes the code from different sources differently. For example, compilation results for sources and test sources are normally placed into different folders.

How do I create a new target in IntelliJ?

Select one of the supported run/debug configuration types. If you have already defined the target, select it from the Run on menu. Otherwise, click Manage targets… to add a new target.


1 Answers

Supporting test source/target levels is tracked by this request. Language level changed message is also a known issue.

like image 85
CrazyCoder Avatar answered Sep 21 '22 07:09

CrazyCoder