Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Config Maven 2 to print out javac commands during compile phase

Is there any way to force Maven 2 (>2.0.10) to print the actual javac commands it's executing. We keep running out of memory even though we've bumped up the max using MAVEN_OPTS. I'd like to be able to see the actual command being executed that is running out of memory.

I've tried using the verbose setting below in the pom file's plugin management section but that doesn't seem to give me the javac command:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
        <source>1.5</source>
        <target>1.5</target>
        <maxmem>1024m</maxmem>
        <compilerArguments>
            <verbose/>
        </compilerArguments>
    </configuration>
</plugin>
like image 871
Chris Williams Avatar asked Feb 05 '10 19:02

Chris Williams


People also ask

Does Maven use Javac?

Maven is not a java compiler. Maven runs the java compiler for you and configures all the paths.

What is the way to compile Maven application?

To build a Maven project via the command line, you use the mvn command from the command line. The command must be executed in the directory which contains the relevant pom file. You pass the build life cycle, phase or goal as parameter to this command.

What command can you use to run the compile goal of the compiler plugin?

As both goals of the compiler plugin are automatically bound to phases in the Maven default lifecycle, we can execute these goals with the commands mvn compile and mvn test-compile.


1 Answers

Have you tried running Maven with the -X command to print debugging information?

$ mvn -?
...
 -X,--debug      Produce execution debug output

The maven-javac-plugin should then print out the classpath being used, the source directories/path, etc.

like image 131
matt b Avatar answered Nov 15 '22 13:11

matt b