maven - 执行 org.apache.maven.plugins:maven-site-plugin:3.7.1:site:org/apache/maven/reporting/AbstractMavenReport 时缺少必需的类
问题描述
我尝试使用mvn site
为我的 Maven 项目创建站点,但出现以下错误。我试图从我的 .m2/repository 中删除maven-site-plugin/
和删除/org/apache/maven/reporting
,但它不起作用。有没有人知道如何解决这个问题?
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.7.1:site (default-site) on project tutorial: Execution default-site of goal org.apache.maven.plugins:maven-site-plugin:3.7.1:site failed: A required class was missing while executing org.apache.maven.plugins:maven-site-plugin:3.7.1:site: org/apache/maven/reporting/AbstractMavenReport
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.apache.maven.plugins:maven-site-plugin:3.7.1
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/Users/yangguanrong/.m2/repository/org/apache/maven/plugins/maven-site-plugin/3.7.1/maven-site-plugin-3.7.1.jar
[ERROR] urls[1] = file:/Users/yangguanrong/.m2/repository/org/apache/maven/reporting/maven-reporting-exec/1.4/maven-reporting-exec-1.4.jar
[ERROR] urls[2] = file:/Users/yangguanrong/.m2/repository/org/apache/maven/reporting/maven-reporting-api/3.0/maven-reporting-api-3.0.jar
...
我的 pom.xml 的一部分如下所示:
<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<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>
</plugins>
</pluginManagement>
</build>
因为org/apache/maven/reporting/AbstractMavenReport
是一个类maven-reporting-impl
,所以我尝试添加maven-reporting-impl
为依赖项。但是,它仍然不起作用。
<!-- https://mvnrepository.com/artifact/org.apache.maven.reporting/maven-reporting-impl -->
<dependency>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-impl</artifactId>
<version>3.0.0</version>
</dependency>
解决方案
推荐阅读
- python - Pandas 读取包含 nan 和 null 作为字符串的文件
- php - 如何将字符串转换为 json,并在 PHP 中获取所有键的值
- python-3.x - 如何向网站发出请求并下载搜索数据
- python - 表达式中的 Python 函数 - 推迟评估
- ios - 如何在 SwiftUI 的 NavigationView 中放置徽标?
- docker - 使用 Grafana docker 映像忽略 custom.ini
- reactjs - 导入使用 React-Router-Dom 的自定义模块组件时出现问题
- git - Git 无法使用 LF 在 Linux 上签出使用 CRLF 存储的文件
- angular - 在 onSubmit 中等待有效性检查的最佳方法是什么
- python - 如何通过链接到我需要的信息