<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.noear</groupId>
        <artifactId>solon-parent</artifactId>
        <version>3.6.1-M3</version>
        <relativePath>../../../solon-parent/pom.xml</relativePath>
    </parent>

    <artifactId>solon-configuration-processor</artifactId>
    <name>${project.artifactId}</name>
    <packaging>jar</packaging>

    <dependencies>
        <dependency>
            <groupId>org.noear</groupId>
            <artifactId>snack3</artifactId>
        </dependency>

        <dependency>
            <groupId>org.noear</groupId>
            <artifactId>solon</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler.version}</version>
                <executions>
                    <!-- 禁用默认编译 -->
                    <execution>
                        <id>default-compile</id>
                        <phase>none</phase>
                    </execution>
                    <!-- 自定义编译，禁用注解处理 -->
                    <execution>
                        <id>compile-sources</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                            <proc>none</proc>
                            <compilerArgs>
                                <arg>-proc:none</arg>
                            </compilerArgs>
                            <excludes>
                                <exclude>**/resources/gradle</exclude>
                                <exclude>**/resources/services</exclude>
                            </excludes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>3.1.0</version>
                <executions>
                    <execution>
                        <id>copy-processor-service</id>
                        <phase>package</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <mkdir dir="${project.build.outputDirectory}/META-INF/services"/>
                                <mkdir dir="${project.build.outputDirectory}/META-INF/gradle"/>
                                <copy file="src/main/META-INF/services/javax.annotation.processing.Processor"
                                      tofile="${project.build.outputDirectory}/META-INF/services/javax.annotation.processing.Processor"/>
                                <copy file="src/main/META-INF/gradle/incremental.annotation.processors"
                                      tofile="${project.build.outputDirectory}/META-INF/gradle/incremental.annotation.processors"/>
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
