How can I speed up my maven2 build?

前端 未结 8 2154
孤独总比滥情好
孤独总比滥情好 2020-12-13 04:29

I\'m using a local artifactory to proxy the request, but the build and test phases are still a bit slow. It\'s not the actual compile and tests that are slow, it\'s the \"wa

8条回答
  •  不思量自难忘°
    2020-12-13 04:52

    1. Adjust memory configurations to optimum for eg: add this line to mvn.bat set MAVEN_OPTS=-Xmx512m -XX:MaxPermSize=256m

    2. Clean phase of mvn normally deletes target folder. Instead if we are renaming target folder the cleaning phase will be much faster.

    3. -Dmaven.test.skip=true will skip the test execution.

    4. Add -Denforcer.skip=true to mvn command line argument (This is enforcing versions of maven, jdk etc ,we can skip it after initial runs)

    5. Disable non-critical operations during build phase: Analysis, javadoc generation, source packaging. This will save huge time.

    6. Spawnig new process also helps in time improvement -Dmaven.junit.fork=true (fork the junit tests into a new process) -Dmaven.compile.fork=true (forks the compilation)

      Hope it helps.

提交回复
热议问题