Предотвращение запуска по умолчанию компилятора в Maven - PullRequest
0 голосов
/ 26 июня 2019

Я пытаюсь написать плагин компилятора для Maven:

            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <inherited>true</inherited>
                <executions>
                    <execution>
                        <id>my-custom-compiler</id>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                            <source>1.8</source>
                            <target>1.8</target>
                            <compilerVersion>1.8</compilerVersion>
                            <compilerArgument>-Xdiags:verbose</compilerArgument>
                            <compilerArgument>-proc:none</compilerArgument>
                            <compilerArgument>-Xlint:unchecked</compilerArgument>
                            <excludes>
                                <exclude>${project.basedir}\src\main\java\testfiles\</exclude>
                            </excludes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

Теперь, когда я запускаю mvn clean install, я вижу, что:

[INFO] --- maven-compiler-plugin: 3.8.1: compile (default-compile)

компилятор по умолчанию все еще выполняется. Всегда ли так бывает? Или есть способ остановить его выполнение. Это ничего не вредит. Но компиляция тех же 2000 нечетных файлов замедляет сборку.

1 Ответ

1 голос
/ 26 июня 2019

Почему бы вам просто не добавить свою конфигурацию к компиляции по умолчанию, например:

        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <inherited>true</inherited>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                        <compilerVersion>1.8</compilerVersion>
                        <compilerArgument>-Xdiags:verbose</compilerArgument>
                        <compilerArgument>-proc:none</compilerArgument>
                        <compilerArgument>-Xlint:unchecked</compilerArgument>
                        <excludes>
                            <exclude>${project.basedir}\src\main\java\testfiles\</exclude>
                        </excludes>
                    </configuration>
        </plugin>

Тогда clean install просто запустит вашу конфигурацию.

...