【问题标题】:Build Failure in the First Maven Project using Eclipse使用 Eclipse 在第一个 Maven 项目中构建失败
【发布时间】:2014-01-26 03:29:21
【问题描述】:

在执行 maven clean 时没有问题,但是在使用 maven install 时,我得到了以下堆栈跟踪。

堆栈跟踪

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[WARNING] 
[WARNING] Some problems were encountered while building the effective settings
[WARNING] Failed to use environment variables for interpolation: Cannot run program "cmd.exe": CreateProcess error=740, The requested operation requires elevation @ 
[WARNING] 
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building lsm Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ lsm ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ lsm ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ lsm ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\EclipseWorkspace\lsm\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ lsm ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.10:test (default-test) @ lsm ---
[INFO] No tests to run.
[INFO] Surefire report directory: D:\EclipseWorkspace\lsm\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.366s
[INFO] Finished at: Wed Jan 08 12:04:33 IST 2014
[INFO] Final Memory: 9M/152M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test (default-test) on project lsm: Error while executing forked tests.; nested exception is java.io.IOException: Cannot run program "cmd.exe" (in directory "D:\EclipseWorkspace\lsm"): CreateProcess error=740, The requested operation requires elevation -> [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/MojoExecutionException

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>com.lejhro</groupId>
  <artifactId>lsm</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>lsm Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <finalName>lsm</finalName>
  </build>
</project>

我已经设置了 MAVEN_HOME、M2_HOME、JAVA_HOME 变量。 在命令提示符下 mvn -version 工作正常。 我也完成了 Maven-> 更新项目。

【问题讨论】:

  • 可能是您正在以较少的权限执行程序。尝试以管理员身份运行它
  • 以下错误表明您正在以较低的特​​权使用它来运行它。 [错误] 无法在项目 lsm 上执行目标 org.apache.maven.plugins:maven-surefire-plugin:2.10:test (default-test):执行分叉测试时出错。;嵌套异常为 java.io.IOException:无法运行程序“cmd.exe”(在目录“D:\EclipseWorkspace\lsm”中):CreateProcess 错误=740,请求的操作需要提升 -> [帮助 1]
  • 我认为告诉你权限错误的错误是一个提示。
  • 是的,问题出在权限上,为此我关闭了 UAC 设置..但忘记重新启动系统,所以在重新启动其工作后...谢谢..

标签: java eclipse maven


【解决方案1】:

在eclipse快捷方式或exe上

Right click > Run as administrator

【讨论】:

    猜你喜欢
    • 2015-05-10
    • 1970-01-01
    • 2012-01-19
    • 2022-12-16
    • 2016-06-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多