2014-04-09 1 views
0

저지를 실행하는 동안 문제가 발생했습니다. 컴파일 오류가있어 프로젝트를 빌드 할 수 없습니다. 문제 해결을 도와주세요. 아래 코드를 지정했습니다.목표 org.apache.maven.plugins를 실행하지 못했습니다. maven-compiler

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. 
[INFO] Scanning for projects... 
[INFO]                   
[INFO] ------------------------------------------------------------------------ 
[INFO] Building JerseyJSONExample 0.0.1-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ JerseyJSONExample --- 
[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) @ JerseyJSONExample --- 
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent! 
[INFO] Compiling 3 source files to D:\Jersey\JerseyJSONExample\target\classes 
[INFO] ------------------------------------------------------------- 
[ERROR] COMPILATION ERROR : 
[INFO] ------------------------------------------------------------- 
[ERROR] Unable to locate the Javac Compiler in: 
    C:\Program Files\Java\jre7\..\lib\tools.jar 
Please ensure you are using JDK 1.4 or above and 
not a JRE (the com.sun.tools.javac.Main class is required). 
In most cases you can change the location of your Java 
installation by setting the JAVA_HOME environment variable. 
[INFO] 1 error 
[INFO] ------------------------------------------------------------- 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 1.349s 
[INFO] Finished at: Wed Apr 09 12:35:38 IST 2014 
[INFO] Final Memory: 4M/15M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project JerseyJSONExample: Compilation failure 
[ERROR] Unable to locate the Javac Compiler in: 
[ERROR] C:\Program Files\Java\jre7\..\lib\tools.jar 
[ERROR] Please ensure you are using JDK 1.4 or above and 
[ERROR] not a JRE (the com.sun.tools.javac.Main class is required). 
[ERROR] In most cases you can change the location of your Java 
[ERROR] installation by setting the JAVA_HOME environment variable. 
[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/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>com.javacodegeeks.enterprise.rest.jersey</groupId> 
    <artifactId>JerseyJSONExample</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 

    <repositories> 
     <repository> 
      <id>maven2-repository.java.net</id> 
      <name>Java.net Repository for Maven</name> 
      <url>http://download.java.net/maven/2/</url> 
      <layout>default</layout> 
     </repository> 
    </repositories> 

    <dependencies> 

     <dependency> 
      <groupId>com.sun.jersey</groupId> 
      <artifactId>jersey-server</artifactId> 
      <version>1.9</version> 
     </dependency> 

     <dependency> 
      <groupId>com.sun.jersey</groupId> 
      <artifactId>jersey-client</artifactId> 
      <version>1.9</version> 
     </dependency> 

     <dependency> 
      <groupId>com.sun.jersey</groupId> 
      <artifactId>jersey-json</artifactId> 
      <version>1.9</version> 
     </dependency> 


    </dependencies> 

답변

3

다음과 작품으로 당신의 JDK 이클립스가 사용하는 업데이트를 시도 할 수 :

창에 JRE를 추가하고 설정 -> 환경 설정 ...-> Java-> 설치된 JRE :

JRE type: Standard VM JRE 
Name: jdk1.6.0_18 
JRE home directory: C:\Program Files (x86)\Java\jdk1.6.0_18 

그렇지 않은 경우 JAVA_HOME 경로의 대괄호 및 공백이 문제를 일으킬 수 있습니다. JDK를 다른 위치로 복사하고 JAVA_HOME을 업데이트하십시오.