按照百度文库上一篇文章(http://wenku.baidu.com/view /0477e440a8956bec0975e394.html)配置maven site plugin,当将版本号由3.0-beta-3改为 3.0 运行 mvn site 时出现错 误:An API incompatibility was encountered while executing org.apache.maven.plugins:maven-site-plugin:3.0:site。该错误详细信息如下:
realm = plugin>org.apache.maven.plugins:maven-site-plugin:3.0 strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy urls[0] = file:/Users/nodje/.m2/repository/org/apache/maven/plugins/maven-site-plugin/3.0/maven-site-plugin-3.0.jar urls[1] = file:/Users/nodje/.m2/repository/org/apache/maven/reporting/maven-reporting-exec/1.0.1/maven-reporting-exec-1.0.1.jar urls[2] = file:/Users/nodje/.m2/repository/org/apache/maven/reporting/maven-reporting-api/3.0/maven-reporting-api-3.0.jar urls[3] = file:/Users/nodje/.m2/repository/org/apache/velocity/velocity/1.5/velocity-1.5.jar urls[4] = file:/Users/nodje/.m2/repository/oro/oro/2.0.8/oro-2.0.8.jar urls[5] = file:/Users/nodje/.m2/repository/velocity/velocity/1.5/velocity-1.5.jar urls[6] = file:/Users/nodje/.m2/repository/org/sonatype/aether/aether-util/1.7/aether-util-1.7.jar urls[7] = file:/Users/nodje/.m2/repository/org/sonatype/sisu/sisu-inject-bean/1.4.2/sisu-inject-bean-1.4.2.jar urls[8] = file:/Users/nodje/.m2/repository/org/sonatype/sisu/sisu-guice/2.1.7/sisu-guice-2.1.7-noaop.jar urls[9] = file:/Users/nodje/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14.jar urls[10] = file:/Users/nodje/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar urls[11] = file:/Users/nodje/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar urls[12] = file:/Users/nodje/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar urls[13] = file:/Users/nodje/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.2/doxia-sink-api-1.2.jar urls[14] = file:/Users/nodje/.m2/repository/org/apache/maven/doxia/doxia-logging-api/1.2/doxia-logging-api-1.2.jar urls[15] = file:/Users/nodje/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar urls[16] = file:/Users/nodje/.m2/repository/org/apache/maven/doxia/doxia-core/1.2/doxia-core-1.2.jar urls[17] = file:/Users/nodje/.m2/repository/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar urls[18] = file:/Users/nodje/.m2/repository/xml-apis/xml-apis/1.3.04/xml-apis-1.3.04.jar urls[19] = file:/Users/nodje/.m2/repository/org/apache/httpcomponents/httpclient/4.0.2/httpclient-4.0.2.jar urls[20] = file:/Users/nodje/.m2/repository/org/apache/httpcomponents/httpcore/4.0.1/httpcore-4.0.1.jar urls[21] = file:/Users/nodje/.m2/repository/commons-codec/commons-codec/1.3/commons-codec-1.3.jar urls[22] = file:/Users/nodje/.m2/repository/org/apache/maven/doxia/doxia-module-xhtml/1.2/doxia-module-xhtml-1.2.jar urls[23] = file:/Users/nodje/.m2/repository/org/apache/maven/doxia/doxia-module-apt/1.2/doxia-module-apt-1.2.jar urls[24] = file:/Users/nodje/.m2/repository/org/apache/maven/doxia/doxia-module-xdoc/1.2/doxia-module-xdoc-1.2.jar urls[25] = file:/Users/nodje/.m2/repository/org/apache/maven/doxia/doxia-module-fml/1.2/doxia-module-fml-1.2.jar urls[26] = file:/Users/nodje/.m2/repository/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar urls[27] = file:/Users/nodje/.m2/repository/org/apache/maven/doxia/doxia-decoration-model/1.2/doxia-decoration-model-1.2.jar urls[28] = file:/Users/nodje/.m2/repository/org/apache/maven/doxia/doxia-site-renderer/1.2/doxia-site-renderer-1.2.jar urls[29] = file:/Users/nodje/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar urls[30] = file:/Users/nodje/.m2/repository/org/apache/maven/shared/maven-doxia-tools/1.4/maven-doxia-tools-1.4.jar urls[31] = file:/Users/nodje/.m2/repository/org/codehaus/plexus/plexus-archiver/1.0/plexus-archiver-1.0.jar urls[32] = file:/Users/nodje/.m2/repository/org/codehaus/plexus/plexus-io/1.0/plexus-io-1.0.jar urls[33] = file:/Users/nodje/.m2/repository/org/codehaus/plexus/plexus-i18n/1.0-beta-7/plexus-i18n-1.0-beta-7.jar urls[34] = file:/Users/nodje/.m2/repository/org/codehaus/plexus/plexus-velocity/1.1.8/plexus-velocity-1.1.8.jar urls[35] = file:/Users/nodje/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.10/plexus-utils-1.5.10.jar urls[36] = file:/Users/nodje/.m2/repository/org/mortbay/jetty/jetty/6.1.25/jetty-6.1.25.jar urls[37] = file:/Users/nodje/.m2/repository/org/mortbay/jetty/servlet-api/2.5-20081211/servlet-api-2.5-20081211.jar urls[38] = file:/Users/nodje/.m2/repository/org/mortbay/jetty/jetty-util/6.1.25/jetty-util-6.1.25.jar urls[39] = file:/Users/nodje/.m2/repository/commons-lang/commons-lang/2.5/commons-lang-2.5.jar urls[40] = file:/Users/nodje/.m2/repository/commons-io/commons-io/1.4/commons-io-1.4.jar Number of foreign imports: 1 import: Entry[import from realm ClassRealm[maven.api, parent: null]]
(参见:http://comments.gmane.org/gmane.comp.jakarta.turbine.maven.user/123151) 与该文错误一致。
按照上文描述,可能是由于maven版本变换引起的问题,Plugins Compatibility Matrix for Maven 3中 有对Maven 3下maven-site-plugin可使用插件版本的要求。另外一个问题是,文库(http://wenku.baidu.com /view/0477e440a8956bec0975e394.html)中使用的是:jxr-maven-plugin 插件:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jxr-maven-plugin</artifactId>
</plugin>
将其修改成:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
</plugin>
并确认Maven 3下maven-site-plugin各插件版本是否符合要求,再次运行 mvn clean site命令即可编译成功。
另在运行mvn site 时出现”编码utf-8/gbk 的不可映射字符“的 警告,导致生成的apidocs中的汉字是乱码。需要将工程编码格式设置成UTF-8(选中项目——>Project——》Properties ——》Resource——》Text file encoding——》Other:UTF-8),并在pom.xml中进行相应配置:
1)
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.5</source>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
2)
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3)
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0</version>
<configuration>
<locales>zh_CN</locales>
<outputEncoding>UTF-8</outputEncoding>
............................
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
相关推荐
maven-site-plugin-3.3.jar
### Maven-javadoc-plugin 中文注释 API 解决乱码及时间问题详解 #### 一、背景介绍 在软件开发过程中,API文档对于提高代码可读性、方便团队成员之间的交流至关重要。Maven作为一款强大的自动化构建工具,在项目...
maven-site-plugin-3.7.1.jar
当maven-site-plugin和maven-scr-plugin同时使用时,可能遇到的问题是,site plugin试图清理target目录以准备生成新的站点文档,但因为maven-scr-plugin生成的服务元数据(通常位于target/OSGI-INF/serviceComposite...
exec-maven-plugin是Maven生态系统中的一个插件,它允许用户在Maven构建过程中执行外部命令或脚本。这使得Maven项目可以集成更多的自定义操作,比如运行特定的脚本、调用系统命令等。本文将详细介绍exec-maven-...
maven-plugin-api-3.2.1-sources.jar maven-release-plugin-2.0.jar maven-reporting-api-2.0.6.jar maven-reporting-api-2.0.8.jar maven-reporting-api-2.0.9.jar maven-repository-metadata-3.2.1-sources.jar ...
Maven 使用 tomcat8-maven-plugin 插件 Maven 是一个流行的构建自动化工具,它可以帮助开发者自动完成项目的编译、测试、打包、部署等任务。 Tomcat 是一个流行的 Web 服务器,Maven 提供了一个插件 tomcat8-maven-...
java运行依赖jar包
maven-plugin-api-3.0.jar
《深入解析修改版tomcat7-maven-plugin-2.2.jar》 在Java开发领域,Maven作为项目管理和构建工具,极大地简化了依赖管理和构建流程。而Tomcat,作为广泛使用的开源Servlet容器,是Java Web应用部署的首选平台。当...
`maven-compiler-plugin-3.8.0-source-release` 是 Maven 生态系统中不可或缺的一部分,它提供了可靠的源代码编译功能,使得开发者能够专注于编写代码,而无需关心构建过程的细节。通过理解 Maven 插件的工作原理和...
maven-jar-plugin-3.1.1.jar
maven-deploy-plugin-2.8.2.jar
【maven-eclipse-plugin】是Maven生态中的一个重要插件,它主要负责将Maven项目导入Eclipse这样的IDE中,以便于开发人员进行便捷的开发和管理。在使用Maven时,理解并熟练掌握这个插件的使用对于提高开发效率至关...
在apache-maven-3.5.2/conf/setting.xml中加入以下配置即可解决 alimaven aliyun maven http://maven.aliyun.com/nexus/content/repositories/central/ central junit junit Address/ ...
maven-site-plugin-1.7.2-sources.jar
本文将详细讨论如何将Jetty与Maven进行集成,并介绍关键的`maven-jetty-plugin`插件及其不同版本。 1. Maven与Jetty集成的意义: Maven通过其强大的依赖管理功能,使得项目构建变得简单和规范。而Jetty作为轻量级...
maven-jetty-jspc-plugin-6.1.22-site-component.jar
maven-antrun-plugin-3.0.0.jar
`maven-db-plugin` 插件有两个版本,即 `1.3` 和 `1.4`,这两个版本的 JAR 文件在压缩包中分别以 `maven-db-plugin-1.4.jar` 和 `maven-db-plugin-1.3.jar` 的形式存在。这些 JAR 文件包含了插件所需的全部类和资源...