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?

Était-ce utile?

La 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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top