Java – Removing warning messages on IntelliJ IDEA while building Java project

intellij-ideajava

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?

Best Solution

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