2017-06-22 28 views
0

執行Maven的錯誤基於Maven

**[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:3.0:testCompile (default-testCompile) @ com.amazon.hybrid --- 
[INFO] Changes detected - recompiling the module! 
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent! 
[INFO] Compiling 6 source files to G:\My Learnings\Framework\target\test-classes 
[INFO] -------------------------------------------------------------** 
**[ERROR] COMPILATION ERROR : 
[INFO] ------------------------------------------------------------- 
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? 
[INFO] 1 error** 
[INFO] ------------------------------------------------------------- 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 5.483s 
[INFO] Finished at: Thu Jun 22 23:27:00 IST 2017 
[INFO] Final Memory: 9M/153M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:testCompile (default-testCompile) on project com.amazon.hybrid: Compilation failure 
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? 
[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.amazon.hybrid</groupId> 
    <artifactId>com.amazon.hybrid</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <description>This is used to order items from Amazon.in</description> 


    <dependencies> 

     <dependency> 
      <groupId>org.seleniumhq.selenium</groupId> 
      <artifactId>selenium-java</artifactId> 
      <version>2.53.0</version> 
     </dependency>  

     <dependency> 
      <groupId>org.testng</groupId> 
      <artifactId>testng</artifactId> 
      <version>6.7</version> 
      <scope>test</scope> 
     </dependency> 

     <dependency> 
      <groupId>com.aventstack</groupId> 
      <artifactId>extentreports</artifactId> 
      <version>3.0.6</version> 
     </dependency> 

     <dependency> 
      <groupId>org.apache.poi</groupId> 
      <artifactId>poi</artifactId> 
      <version>3.14</version> 
     </dependency> 

     <dependency> 
      <groupId>org.apache.poi</groupId> 
      <artifactId>poi-ooxml</artifactId> 
      <version>3.14</version> 
     </dependency> 

    </dependencies> 

    <build> 

    <plugins> 

    <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-compiler-plugin</artifactId> 
     <version>3.0</version> 

     <configuration> 
      <compilerVersion>1.8</compilerVersion> 
      <source>1.6</source> 
      <target>1.6</target> 
     </configuration>    
    </plugin> 

    <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-surefire-plugin</artifactId> 
     <version>2.17</version> 

     <configuration> 
      <suiteXmlFiles> 
       <suiteXmlFile>testng.xml</suiteXmlFile>   
      </suiteXmlFiles> 
     </configuration> 

    </plugin> 

    </plugins> 

    </build> 

</project> 

注:

我通過Window - > Preferences - > Java - > Installed JREs - >添加了JDK並選擇了JDK,將環境從JRE更改爲JDK 2.更新了項目

即使在完成前面的步驟之後,問題仍然沒有解決。

任何幫助解決這個問題表示讚賞。

問候, ANUPĴ

+0

請問您的JDK版本是什麼?不能相信它是JDK 2 ^^我猜你需要JDK 7或8。 –

回答

0

您正在使用幾乎所有出現在你的pom.xml的很舊版本 你可以從這裏---下載最新版本>Maven repository link to get latest dependencies

我中號提幾個:

<dependency> 
    <groupId>org.seleniumhq.selenium</groupId> 
    <artifactId>selenium-java</artifactId> 
    <version>3.4.0</version> 
</dependency> 

TestNG的

<dependency> 
    <groupId>org.testng</groupId> 
    <artifactId>testng</artifactId> 
    <version>6.11</version> 
</dependency> 

同樣,你可以找到從上面給出鏈接的相關性休息。

讓我知道它是否有幫助。 :)

+0

您是否嘗試過該解決方案? –

+0

它適合你嗎? –

+0

嗨Anuj,謝謝你的迴應..我試過這個解決方案,但我相信最新版本的硒和Firefox版本存在兼容性問題。除此之外,Firefox還不支持最新的壁虎驅動程序..因此,我使用「Selenium 2」版本來避免這些兼容性問題 –