2012-10-28 43 views
0

我在開發中使用了Tomcat 7和JDK 7。當我在Juno Eclipse中執行這個maven目標clean package cargo:redeploy時,它顯示這個錯誤。希望能看到你的一些線索。如何使用maven糾正Tomcat7中的部署錯誤?

[INFO] ------------------------------------------------------------- 
[ERROR] COMPILATION ERROR : 
[INFO] ------------------------------------------------------------- 
[ERROR] Failure executing javac, but could not parse the error: 
javac: -endorseddirs requires an argument 
Usage: javac <options> <source files> 
use -help for a list of possible options 

[INFO] 1 error 
[INFO] ------------------------------------------------------------- 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 0.717s 
[INFO] Finished at: Sun Oct 28 09:25:37 MYT 2012 
[INFO] Final Memory: 12M/149M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project Web2: Compilation failure 
[ERROR] Failure executing javac, but could not parse the error: 
[ERROR] javac: -endorseddirs requires an argument 
[ERROR] Usage: javac <options> <source files> 
[ERROR] use -help for a list of possible options 
[ERROR] -> [Help 1] 
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 
[ERROR] Re-run Maven using the -X switch to enable full debug logging. 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles: 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException 

這是我的pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>org.huahsin68.web2</groupId> 
    <artifactId>Web2</artifactId> 
    <packaging>war</packaging> 
    <version>1.0-SNAPSHOT</version> 
    <name>Web2 Maven Webapp</name> 
    <url>http://maven.apache.org</url> 
    <dependencies> 
    <dependency> 
     <groupId>javax.servlet</groupId> 
     <artifactId>jstl</artifactId> 
     <version>1.2</version> 
    </dependency> 

    <dependency> 
     <groupId>javax.servlet.jsp</groupId> 
     <artifactId>jsp-api</artifactId> 
     <version>2.1</version> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring</artifactId> 
     <version>2.5.6</version> 
    </dependency> 
    <dependency> 
     <groupId>com.sun.faces</groupId> 
     <artifactId>jsf-api</artifactId> 
     <version>2.0.9</version> 
    </dependency> 
    <dependency> 
     <groupId>com.sun.faces</groupId> 
     <artifactId>jsf-impl</artifactId> 
     <version>2.0.9</version> 
    </dependency> 
    <dependency> 
     <groupId>javax.servlet</groupId> 
     <artifactId>javax.servlet-api</artifactId> 
     <version>3.0.1</version> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.glassfish.web</groupId> 
     <artifactId>el-impl</artifactId> 
     <version>2.2</version> 
    </dependency> 
    </dependencies> 
    <build> 
    <finalName>Web2</finalName> 
    <plugins> 

     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <configuration> 
       <source>1.7</source> 
       <target>1.7</target> 
       <compilerArguments> 
        <endorseddirs>${endorsed.dir}</endorseddirs> 
       </compilerArguments> 
      </configuration> 
     </plugin> 

     <plugin> 
      <groupId>org.codehaus.cargo</groupId> 
      <artifactId>cargo-maven2-plugin</artifactId> 
      <configuration> 
       <container> 
        <containerId>tomcat7x</containerId> 
        <type>remote</type> 
       </container> 
       <configuration> 
        <type>runtime</type> 
        <properties> 
         <cargo.remote.username>${tomcat.username}</cargo.remote.username> 
         <cargo.remote.password>${tomcat.password}</cargo.remote.password> 
        </properties> 
       </configuration> 
      </configuration> 
     </plugin> 
    </plugins> 
    </build> 
</project> 

回答

0

您正在使用這個配置maven的編譯器插件:

<compilerArguments> 
    <endorseddirs>${endorsed.dir}</endorseddirs> 
</compilerArguments> 

但好像你沒有設置變量${endorsed.dir}任何地方。因此,Maven在java命令行中添加了一個空的-endorseddirs參數。

因此,您應該從插件配置中刪除compilerArguments條目或正確設置變量。