Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing warning messages on IntelliJ IDEA while building Java project

I am using IntelliJ IDEA Community Edition for the first time and using Maven to set up a TDD environment. The code that I am trying to test and the warning messages I had encountered along with the project structure are provided below.

Project Structure:

enter image description here

Code:

package miscellaneous;  import org.junit.Test;  import static org.junit.Assert.*;  public class TestHello {      // Methods to be tested.....     private int Add1Plus1(int i, int j) {         return (i + j);     }      @Test     public void testAdd1Plus1() throws Exception {         assertEquals(2, Add1Plus1(1, 1));     } } 

Configuration details:

  • Java compiler: 1.8.0_45
  • Maven Version: 3.0.5
  • Path to Maven user-settings file: /home/sandeep/Desktop/MyDocs/repos/git-repos/public/MavenCodeBase/settings.xml
  • Path to Maven local repository: /home/sandeep/Desktop/MyDocs/repos/maven-repos
  • pom.xml: http://pastebin.com/462Uytad

Warning messages:

Warning:java: source value 1.5 is obsolete and will be removed in a future release Warning:java: target value 1.5 is obsolete and will be removed in a future release Warning:java: To suppress warnings about obsolete options, use -Xlint:-options. 

Question:

What is causing these messages and what would be a good/recommended way to fix these warning messages?

like image 752
Sandeep Chatterjee Avatar asked Jun 07 '15 05:06

Sandeep Chatterjee


People also ask

How do I change the source release in Intellij?

From the main menu, select File | Project Structure Ctrl+Alt+Shift+S and click Project Settings | Modules. Select the necessary module and then open the Sources tab in the right-hand part of the dialog.

How do I see usage in Intellij?

Press ⌥F7 (macOS), or Alt+F7 (Windows/Linux), to bring up the Find Usages tool window. You can search a single file, your whole project, or customise the scope. You can also configure the color of the usages highlighting or disable the automatic highlighting of usages.


2 Answers

Check java version in your pom.xml(here you can find how to do it). Also check java version in Project Structure. And the last what you can do - check compiler version e.g.

enter image description here

like image 72
Vladyslav Sheruda Avatar answered Sep 20 '22 08:09

Vladyslav Sheruda


I did all of the above and still had one instance of the warning:

Warning:java: source value 1.5 is obsolete and will be removed in a future release 

I went into my project_name.iml file and replaced the following tag:

<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5" inherit-compiler-output="false"> 

with:

<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false"> 

And voila, no more error message. Hope this helps someone.

like image 32
Brod Avatar answered Sep 23 '22 08:09

Brod