Вопрос

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?

Это было полезно?

Решение

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top