search

Home  >  Q&A  >  body text

Java only compiles the modified source files, not the entire file.

Currently, maven is used to compile the code. Changing a Java file will cause the entire project to be recompiled. (There is currently a lot of redundant code in the project, and it takes a long time to compile it all.)

Does the background compilation tool have an automatic compilation function similar to Eclipse? Only the changed code will be compiled each time?

女神的闺蜜爱上我女神的闺蜜爱上我2766 days ago1174

reply all(1)I'll reply

  • 黄舟

    黄舟2017-06-15 09:24:06

    maven-compiler-plugin has a parameter useIncrementalCompilation that does not set the default fasle

    1

    2

    3

    4

    5

    6

    7

    8

    9

    <code><plugin>

        <artifactId>maven-compiler-plugin</artifactId>

        <version>${maven.compiler.version}</version>

        <configuration>

            <source>${java.version}</source>

            <target>${java.version}</target>

        </configuration>

        <useIncrementalCompilation>true</useIncrementalCompilation>

    </plugin></code>

    reply
    0
  • Cancelreply