0

在一个 Maven 项目中,我在运行 mvn 包时收到以下错误:

[ERROR] Failed to execute goal org.codehaus.mojo:jspc-maven-plugin:1.4.6:compile (jspc) on project cto-reporting: Execution jspc of goal org.codehaus.mojo:jspc-maven-plugin:1.4.6:compile failed: A required class was missing while executing org.codehaus.mojo:jspc-maven-plugin:1.4.6:compile: org/apache/commons/logging/LogFactory
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.codehaus.mojo:jspc-maven-plugin:1.4.6
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/c:/devapps/maven/repository/org/codehaus/mojo/jspc-maven-plugin/1.4.6/jspc-maven-plugin-1.4.6.jar
[ERROR] urls[1] = file:/c:/devapps/maven/repository/org/codehaus/plexus/plexus-utils/1.0.4/plexus-utils-1.0.4.jar
[ERROR] urls[2] = file:/c:/devapps/maven/repository/junit/junit/3.8.1/junit-3.8.1.jar
[ERROR] urls[3] = file:/c:/devapps/maven/repository/log4j/log4j/1.2.13/log4j-1.2.13.jar
[ERROR] urls[4] = file:/c:/devapps/maven/repository/tomcat/jasper-compiler/5.5.15/jasper-compiler-5.5.15.jar
[ERROR] urls[5] = file:/c:/devapps/maven/repository/javax/servlet/jsp-api/2.0/jsp-api-2.0.jar
[ERROR] urls[6] = file:/c:/devapps/maven/repository/ant/ant/1.6.5/ant-1.6.5.jar
[ERROR] urls[7] = file:/c:/devapps/maven/repository/tomcat/jasper-compiler-jdt/5.5.15/jasper-compiler-jdt-5.5.15.jar
[ERROR] urls[8] = file:/c:/devapps/maven/repository/org/eclipse/jdt/core/3.1.1/core-3.1.1.jar
[ERROR] urls[9] = file:/c:/devapps/maven/repository/tomcat/jasper-runtime/5.5.15/jasper-runtime-5.5.15.jar
[ERROR] urls[10] = file:/c:/devapps/maven/repository/javax/servlet/servlet-api/2.4/servlet-api-2.4.jar
[ERROR] urls[11] = file:/c:/devapps/maven/repository/commons-el/commons-el/1.0/commons-el-1.0.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[parent: ClassRealm[maven.api, parent: null]]]
[ERROR] 
[ERROR] -----------------------------------------------------: org.apache.commons.logging.LogFactory

从父 pom 我得到以下信息:

  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>jspc-maven-plugin</artifactId>
    <executions>
      <execution>
        <id>jspc</id>
        <goals>
          <goal>compile</goal>
        </goals>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
          <webFragmentFile>C:\temp\web-fragment.xml</webFragmentFile>
          <outputWebXml>C:\temp\jspweb.xml</outputWebXml>
        </configuration>
      </execution>
    </executions>
    <configuration>
      <source>1.5</source>
      <target>1.5</target>
      <webFragmentFile>C:\temp\web-fragment.xml</webFragmentFile>
      <outputWebXml>C:\temp\jspweb.xml</outputWebXml>
    </configuration>
  </plugin>

我试图在我的 pom 中添加 commons-logging,即使它已经在父 pom 中,我仍然得到同样的错误。有谁知道可能出了什么问题?以前该项目运行良好。

4

1 回答 1

1

报错的原因,是我改成了Maven 3.0.5,项目是在maven 2.2.1中创建的。所以通过改回2.2.1,一切都解决了。

于 2013-10-08T14:02:29.870 回答