Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

214
Views
Maven How to show warnings of codes when compiling

I'm using maven to build a new project. There are some warnings in my codes which are underlined by yellow line. I wish maven could report these warnings in console. How can I accomplish that? Can I just add some parameters in the command such as mvn -XXX clean compile?

about 4 years ago · Santiago Trujillo
3 answers
Answer question

0

<showDeprecation>
Sets whether to show source locations where deprecated APIs are used.

  • Default value is: false
  • User property is: maven.compiler.showDeprecation

<showWarnings>
Set to true to show compilation warnings.

  • Default value is: false
  • User property is: maven.compiler.showWarnings

-- Maven Doku

As simple as mvn clean install -Dmaven.compiler.showDeprecation=true -Dmaven.compiler.showWarnings=true all in one line.

You could even remove the =true part because, when you add a maven parameter with -D it automatically sets its value to true, if not set to something else.

about 4 years ago · Santiago Trujillo Report

0

With maven 3.3.9, using the maven-compiler-plugin and Java 1.8, you need a <configuration> section like the following:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.8.0</version>
    <executions>
        <execution>
            <id>compile</id>
            <phase>compile</phase>
            <goals>
                <goal>compile</goal>
            </goals>
        </execution>
        <execution>
            <id>testCompile</id>
            <phase>test-compile</phase>
            <goals>
                <goal>testCompile</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <compilerArgument>-Xlint:all</compilerArgument>
        <showWarnings>true</showWarnings>
        <showDeprecation>true</showDeprecation>
    </configuration>
</plugin>

I got this answer from here when none of the above worked for me: http://frequal.com/java/EnableWarningsInMaven.html

about 4 years ago · Santiago Trujillo Report

0

I am guessing you are using the compiler plugin. Have you tried this?

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!