IT박스

maven-site 플러그인 3.3 java.lang.ClassNotFoundException : org.apache.maven.doxia.siterenderer.DocumentContent

itboxs 2020. 11. 17. 07:55
반응형

maven-site 플러그인 3.3 java.lang.ClassNotFoundException : org.apache.maven.doxia.siterenderer.DocumentContent


오늘 밤부터 maven 사이트 3.3 플러그인이 작동하지 않습니다.

로컬 저장소를 삭제하려고하지만 변경 사항은 없습니다. Maven 3.3.9 자바 1.8

사이트 플러그인에 대해 pom에 정의 된 구성 또는 종속성 없음

[WARNING] Error injecting: org.apache.maven.report.projectinfo.CiManagementReport
java.lang.NoClassDefFoundError: org/apache/maven/doxia/siterenderer/DocumentContent

빌드 중에도이 문제가 발생하기 시작했습니다. 무엇 나를 위해 일한 것은 구체적으로 정의하는 것이었다 maven-site-plugin과를 maven-project-info-reports-plugin치어의 버전 번호와 함께.

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-site-plugin</artifactId>
  <version>3.7.1</version>
</plugin>
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-project-info-reports-plugin</artifactId>
  <version>3.0.0</version>
</plugin>

이것은 maven-project-info-reports-plugin이 3.0.0으로 업데이트되고 doxia-site-renderer 1.8 (이 클래스는 org.apache.maven.doxia.siterenderer.DocumentContent가 있음)에 의존하지만 maven-site로 인해 발생합니다. -plugin : 3.3은 doxia-site-renderer : 1.4에 의존합니다 (그리고 org.apache.maven.doxia.siterenderer.DocumentContent가 없습니다)

보고 부분에서 특정 maven-project-info-reports-plugin 버전을 지정할 수 있습니다.

<reporting>
        <plugins>           
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>2.9</version>
            </plugin>           
        </plugins>    
    </reporting>

또는 maven-site-plugin을 다음과 같이 최신 3.7.1로 지정할 수 있습니다.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-site-plugin</artifactId>
    <version>3.7.1</version>
</plugin>

pom의 빌드 부분에서


maven 사이트 플러그인의 버전도 빌드 섹션에서 명시 적으로 설정해야합니다. 다음은 그 예입니다.

<reporting>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-project-info-reports-plugin</artifactId>
            <version>3.0.0</version>
            <reportSets>
                <reportSet>
                    <reports>
                        <report>index</report>
                        <report>licenses</report>
                        <report>dependency-info</report>
                    </reports>
                </reportSet>
            </reportSets>
        </plugin>
    </plugins>
</reporting>

<build>
    <plugins>
        <!-- Part of Maven - specified version explicitly for compatibility
             with the maven-project-info-reports-plugin 3.0.0-->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-site-plugin</artifactId>
            <version>3.7.1</version>
        </plugin>
    </plugins>
</build>

더 많은 정보를 추가해야합니다 (BTW를 반대하지 않았습니다).

IIRC; 수명주기 단계에 바인딩 된 플러그인의 버전을 지정하지 않으면 최신 버전이 제공됩니다.

시험:

  • 최신 버전의 maven- 3.5.4로 업그레이드 ATOW
  • mvn help:effective-pomCI의 이전 로그가 있거나 비교할 위치에 관계없이 실제로 해결되는 버전을 실행 하고 확인합니다.
  • 섹션 에서 maven-site-plugin버전을 명시 적으로 설정pluginManagement
  • 종속성 추가 maven-site-plugin(아래 참조)

org/apache/maven/doxia/siterenderer/DocumentContent다음에서 찾을 수 있습니다 doxia-site-renderer.

    <dependency>
        <groupId>org.apache.maven.doxia</groupId>
        <artifactId>doxia-site-renderer</artifactId>
        <version>1.8.1</version>
    </dependency>

I suspect explicitly setting the version of maven-site-plugin to whatever you used to use (incidentally) will work.


Edit: Was chasing a similar issue in maven plugin build testing, explicitly setting maven-site-plugin version (3.7.1 ATOW) in integration pom used by maven-invoker-plugin has worked for me.


I also hit this error on some of my build jobs today. The fix suggested above, adding a concrete dependency for the maven-site-plugin does work and fixes this issue.

However, what it highlighted for me was the fact I was even running the mvn site goal, which I didn't even know we were running and we don't really require.

My fix was to therefore remove the site goal from my mvn arg, as although the site it creates is actually quite useful, I never knew we were creating it, we never published it anywhere and were actually deleting it every build anyway.


Maven 3 doesn't support Doxia anymore.

Use

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-project-info-reports-plugin</artifactId>
  <version>2.2</version>
</plugin>

Reference: https://maven.apache.org/plugins/maven-site-plugin/maven-3.html


The following versions in pom.xml fixed the problem for me:

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>3.7</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>2.9</version>
            </plugin>

I tried to follow Changhua's advice, and define maven-project-info-reports-plugin to version 3.0.0, and maven-site-plugin to 3.7.1 in my pom file, but found that the maven site still pulled in version 3.3 of the maven-site-plugin, regardless of how I set it.

I finally realized that my problem had to do with our project structure. We have a parent pom, in which we were defining the maven-site-plugin dependency, which was then inherited by the children poms. However, the build pom file was separate, and didn't define maven-site-plugin at all, which allowed maven to pull in the 3.3 version on its own. I added the maven-site-plugin dependency (version 3.7.1) to the build pom file, so that it now exists in both the build pom file and the parent pom file, and now the build is correctly using version 3.7.1, and is passing again.

참고URL : https://stackoverflow.com/questions/51091539/maven-site-plugins-3-3-java-lang-classnotfoundexception-org-apache-maven-doxia

반응형