Alex Rivera | Logout

How to compile Maven project effectively and fast

Asked 2012-07-24T11:45:19.443
11

I have a maven project with 13 sub modules. I have two questions how to optimize the build process:

  1. I want to compile the Java code only for x86-64 server. How I con configure Maven to do this?
  2. I have a server with 4 CPU cores. Is it possible to use multi-threading for compiling the code?
Edit
Report

2 Answers

5
  1. Maven invokes standard javac.
  2. Yes, it is possible, see Parallel builds in Maven 3
answered 2012-07-24T11:48:31.453
4

Some time ago I read about this pom configuration to improve compiler performance

       <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-compiler-plugin</artifactId>
           .....
           <dependencies>
               <dependency>
                   <groupId>org.codehaus.plexus</groupId>
                   <artifactId>plexus-compiler-javac</artifactId>
                   <version>1.8.6</version>
               </dependency>
           </dependencies>
       </plugin>

I did not try it but it may be interesting for you.

The explanation of this improvement can be found here.

answered 2012-07-24T14:26:52.830

Your Answer