Show compiler warnings without editing pom.xml

I want to always show warning and compiler fatigue when compiling with Maven. I know how to do this by editing pom.xml , but I want this behavior to be the default for me only (therefore, I cannot edit pom.xml ).

I tried:

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

but this does not show any warnings (if I change pom.xml to show them, they are).

Both expressions ( maven.compiler.showWarnings and maven.compiler.showDeprecation ) exist .

What am I missing?

+6
source share
2 answers

You could wrap them in a maven profile and set the profile with -P instead.

This would be something like this (I have not tested 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

 mvn compile -Pdebug 
0
source

Try it.

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

Source: https://habr.com/ru/post/892112/


All Articles