Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show details during compile

Tags:

maven

maven-3

I have a Maven project which compiles JavaFX 8 application. Can you tell me how I can display detailed output during compile time? Usually this is done by -X argument but I want to configure this into the POM file.

like image 289
Peter Penzov Avatar asked Sep 21 '25 01:09

Peter Penzov


2 Answers

You can use the configuration of the maven-compiler-plugin to add such supplemental arguments like this:

<project>
  ...
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.1</version>
          <configuration>
            <compilerArgs>
              <arg>-Xmaxerrs=1000</arg>
              <arg>-Xlint</arg>
            </compilerArgs>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
  ...
</project>

Furthermore you can use the verbose option to enhance the output like this:

<project>
  ...
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.1</version>
          <configuration>
            <verbose>true</verbose>
            ..
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
  ...
</project>
like image 81
khmarbaise Avatar answered Sep 22 '25 23:09

khmarbaise


In addition to khmarbaise's answer:

-X compiler parameters that require values (eg. -Xmaxwarns) need to be passed to a separate <arg> tag.

Example:

  <plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
      <compilerArgs>
        <arg>-Xlint:all</arg>
        <arg>-Xmaxwarns</arg>
        <arg>50000</arg>
      </compilerArgs>
    </configuration>
  </plugin>

Tested with:

  • Maven 3.0.5 + Maven Compiler plugin 3.2
  • Maven 3.3.9 + Maven Compiler plugin 3.6.0
like image 26
Doroszlai Attila Avatar answered Sep 22 '25 23:09

Doroszlai Attila