开发者

Show compiler warnings without editing pom.xml

I would like to always show compiler warning and deprecation when I compile with Maven. I know how to do it by editing the pom.xml, but I want this behavior by default only for myself (so I can't edit the pom.xml).

I tried:

mvn -Dmaven.compiler.showWarnings=true -Dmaven.compiler.showDeprecation=true clean compile

but this doesn't show any warnings (if I modify the pom.xml to show them, they are there).

Both expressions (m开发者_如何转开发aven.compiler.showWarnings and maven.compiler.showDeprecation) exist.

What do I miss?


Try this.

mvn clean install -Dmaven.compiler.showDeprecation=true -Dmaven.compiler.showWarnings=true > warnings.txt


You could perhaps wrap these in a maven profile, and instead specific the profile with -P.

It would be something like this (I did not test this though):

<profiles>
    <profile>
        <id>development</id>
        <build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <!-- compiler options go here -->
            </configuration>
        </plugin>
        </build>
    </profile>
</profiles>

And then run as

mvn compile -Pdebug
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜