`
东吴周郎
  • 浏览: 23711 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

maven-site-plugin An API incompatibility was encountered问题及编码utf-8/gbk 的不可映射字符

阅读更多

 按照百度文库上一篇文章(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>

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics