Using multiple cores/processors when compiling Java

前端 未结 6 632
梦如初夏
梦如初夏 2020-12-13 19:30

I use a desktop with eight cores to build a Java application using Ant (through a javac target). Is there a way to speed up the compilation by using more than one thread or

6条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-13 19:48

    As long as the javac you are calling doesn't use all the cores it doesn't really matter what you say in Ant. You can use the compiler attribute to define which java compiler should be used for the task.

    If you have several build targets you can use fork=yes to execute the target(s) externally.

    http://ant.apache.org/manual/Tasks/javac.html#compilervalues

提交回复
热议问题