koushick
koushick

Reputation: 497

compling issues in maven

While i was using command -mvn install iam facing a issue like this.the issue is

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:testCompile (default-testCompile) on project Demo: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

Am running my program in my workspace default only jre1.8, but for previous program it ran successfully.for this alone am facing issues!

My POM File

<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>Demo</groupId>
  <artifactId>Demo</artifactId>
  <version>0.0.1-SNAPSHOT</version>

  <properties>
  <suiteXmlFile>src/main/resources/testng.xml</suiteXmlFile>
  </properties>

  <dependencies>            

        <dependency>                
            <groupId>org.seleniumhq.selenium</groupId>                              
            <artifactId>selenium-java</artifactId>                              
            <version>2.45.0</version>                               
        </dependency>               
        <dependency>                
            <groupId>org.testng</groupId>                               
            <artifactId>testng</artifactId>                             
            <version>6.8</version>                              
            <scope>test</scope>                                     
       </dependency>                
</dependencies>

<build>
<plugins>

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

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

    <configuration>

  <suiteXmlFiles>
  <suiteXmlFile>${suiteXmlFile}</suiteXmlFile>
  </suiteXmlFiles>

    </configuration>

</plugin>
</plugins>
</build>
</project>

Compiler issue

please help me to sort this one out!

Upvotes: 1

Views: 96

Answers (1)

galusben
galusben

Reputation: 6372

Try setting enviroment variable JAVA_HOME pointing to jdk. https://docs.oracle.com/cd/E19182-01/820-7851/inst_cli_jdk_javahome_t/

Also, try to set the maven compiler plugin to the version of the compiler you are using.

https://maven.apache.org/plugins/maven-compiler-plugin/usage.html

Upvotes: 2

Related Questions