javadoc-bundle-options/package-list 파일 누락에 대한 maven-javadoc-plugin 경고를 해결하는 방법은 무엇입니까?

javadoc-bundle-options/package-list 파일 누락에 대한 maven-javadoc-plugin 경고를 해결하는 방법은 무엇입니까?

maven-javadoc-plugin을 사용하여 JavaDoc Java 아카이브 리소스를 생성할 때 다음 경고가 표시됩니다.

[WARNING] javadoc: warning - Error reading file: /maven-javadoc-example/target/javadoc-bundle-options/package-list

Apache Maven JavaDoc 플러그인 mojo 페이지를 확인했습니다.
https://maven.apache.org/plugins/maven-javadoc-plugin/javadoc-mojo.html

플래그를 사용하여 디버그 정보를 확인했습니다 -X.
mvn javadoc:jar@main-javadoc -X

Oracle Java Tool 페이지(JDK12)를 확인했습니다.
https://docs.oracle.com/en/java/javase/12/tools/javadoc.html

JDK11에 대해 테스트 코드를 실행/컴파일하는 동시에 JDK8에 대해 프로덕션 코드를 컴파일할 수 있도록 Maven 프로젝트 설정이 있다는 사실과 관련이 있는 것 같습니다(Maven 컴파일러 플러그인에 대한 구성을 제거할 때, JDK11에 대해서만 컴파일하는 다른 프로젝트에는 경고가 표시되지만 경고는 중단됩니다.

다음은 이 경고를 재현하기 위한 최소 Apache Maven POM입니다(소스 경로에 Java 클래스 소스가 하나 이상 있어야 함).

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.superuser.maven</groupId>
    <artifactId>maven-javadoc-example</artifactId>
    <version>1.0.0</version>

    <properties>
        <!-- Settings: maven-resource-plugin -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <!-- Settings: maven-compiler-plugin -->
        <maven.compiler.main-jdk>8</maven.compiler.main-jdk>
        <maven.compiler.test-jdk>11</maven.compiler.test-jdk>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <executions>
                    <execution>
                        <id>default-compile</id>
                        <phase>none</phase>
                    </execution>
                    <execution>
                        <id>main-compile</id>
                        <phase>compile</phase>
                        <configuration>
                            <source>${maven.compiler.main-jdk}</source>
                            <target>${maven.compiler.main-jdk}</target>
                            <showWarnings>true</showWarnings>
                            <showDeprecation>true</showDeprecation>
                            <compilerArgs>
                                <arg>-Xlint:all,-processing,-cast,-serial,-try</arg>
                            </compilerArgs>
                            <excludes>
                                <exclude>module-info.java</exclude>
                            </excludes>
                        </configuration>
                    </execution>
                    <execution>
                        <id>default-testCompile</id>
                        <phase>none</phase>
                    </execution>
                    <execution>
                        <id>test-compile</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                        <configuration>
                            <release>${maven.compiler.test-jdk}</release>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <source>${maven.compiler.test-jdk}</source>
                    <target>${maven.compiler.test-jdk}</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.1.1</version>
                <executions>
                    <execution>
                        <id>main-javadoc</id>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <sourceFileExcludes>module-info.java</sourceFileExcludes>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <quiet>true</quiet>
                    <failOnWarnings>false</failOnWarnings>
                    <failOnError>true</failOnError>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

프로덕션 코드를 컴파일하고 (아마도) 두 개의 서로 다른 JDK API에 대해 테스트 코드를 컴파일하는 단일 Maven 모듈을 계속 유지하면서 이 경고를 해결할 수 있는 방법이 있습니까?

편집하다:

  • JDK 및/또는 %JAVA_HOME%을 변경해도 이 문제가 해결되지 않습니다.
  • module-info.java 파일을 추가/제거해도 이 문제가 해결되지 않습니다.
  • 두 개의 서로 다른 JDK API에 대한 컴파일이 원인일 수 있다고 의심되는 이유를 추가했습니다.
  • JDK8에 대해 컴파일/패키징/javadoc할 때 JavaDoc에서 오류가 발생하지 않도록 실행 정의를 수정했습니다.

답변1

나에게 도움이 된 것은원천그리고표적Maven 컴파일러 플러그인 일반 구성의 태그를 가져와 새 실행 구성에 배치합니다.

POM은 다음과 같습니다.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.superuser.maven</groupId>
    <artifactId>maven-javadoc-example</artifactId>
    <version>1.0.0.Final</version>

    <properties>
        <!-- Settings: maven-resource-plugin -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <!-- Settings: maven-compiler-plugin -->
        <maven.compiler.main-jdk>8</maven.compiler.main-jdk>
        <maven.compiler.test-jdk>11</maven.compiler.test-jdk>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <executions>
                    <execution>
                        <id>default-compile</id>
                        <phase>none</phase>
                        <configuration>
                            <release>${maven.compiler.test-jdk}</release>
                        </configuration>
                    </execution>
                    <execution>
                        <id>main-compile</id>
                        <phase>compile</phase>
                        <configuration>
                            <release>${maven.compiler.test-jdk}</release>
                        </configuration>
                    </execution>
                    <execution>
                        <id>main-compile-jdk8</id>
                        <phase>none</phase>
                        <configuration>
                            <source>${maven.compiler.main-jdk}</source>
                            <target>${maven.compiler.main-jdk}</target>
                            <excludes>
                                <exclude>module-info.java</exclude>
                            </excludes>
                        </configuration>
                    </execution>
                    <execution>
                        <id>default-testCompile</id>
                        <phase>none</phase>
                    </execution>
                    <execution>
                        <id>test-compile</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                        <configuration>
                            <release>${maven.compiler.test-jdk}</release>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <showWarnings>true</showWarnings>
                    <showDeprecation>true</showDeprecation>
                    <compilerArgs>
                        <arg>-Xlint:all,-processing,-cast,-serial,-try</arg>
                    </compilerArgs>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.1.1</version>
                <executions>
                    <execution>
                        <id>main-javadoc</id>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <sourceFileExcludes>module-info.java</sourceFileExcludes>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <quiet>true</quiet>
                    <failOnWarnings>false</failOnWarnings>
                    <failOnError>true</failOnError>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

관련 정보