Question

I just set up a new project using maven 3. I added the following statement to my code:

    if(5==5){

    }

Which results in a comparing identical expressions warning in eclipse.

I use the following configuration for the maven-compiler-plugin:

        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>

            <configuration>
                <compilerArgument>-Xlint:unchecked</compilerArgument>
                <optimize>true</optimize>
                <showDeprecation>true</showDeprecation>
                <showWarnings>true</showWarnings>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>

But it refuses to show the warning.

What should I try next?

Was it helpful?

Solution

The Xlint argument you're specifying will cause the javac compiler to warn about unchecked generic operations but, even with the other -Xlint options, there's no way to get the warning you're after from javac. You'll need to configure your build to use the Eclipse compiler. See the Maven documentation for how to use a non-javac compiler.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top