-1

Any help appreciated!

I had this working a day ago, I get the feeling that it's a maven problem but I'm not sure how to fix it. Running Maven gives a build error :

No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

And also this compilation error :

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project FYP4: Compilation failure

Project Structure : https://gyazo.com/bce728b6e84ee04aad74e82d3c7fb0fc

Here is the pom.xml :

<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<modelVersion>4.0.0</modelVersion>
<groupId>com.DH</groupId>
<artifactId>FYP4</artifactId>
<packaging>war</packaging>
<version>1</version>

<properties>
    <springframework.version>4.0.6.RELEASE</springframework.version>
    <hibernate.version>4.3.6.Final</hibernate.version>
    <mysql.version>5.1.31</mysql.version>
    <joda-time.version>2.3</joda-time.version>
    <testng.version>6.9.4</testng.version>
    <mockito.version>1.10.19</mockito.version>
    <h2.version>1.4.187</h2.version>
    <dbunit.version>2.2</dbunit.version>
</properties>

<dependencies>
    <!-- Spring -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>${springframework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>${springframework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${springframework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-tx</artifactId>
        <version>${springframework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-orm</artifactId>
        <version>${springframework.version}</version>
    </dependency>

    <!-- Hibernate -->
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>${hibernate.version}</version>
    </dependency>

    <!-- jsr303 validation -->
    <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
        <version>1.1.0.Final</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <version>5.1.3.Final</version>
    </dependency>

    <!-- MySQL -->
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>${mysql.version}</version>
    </dependency>

    <!-- Joda-Time -->      
    <dependency>
        <groupId>joda-time</groupId>
        <artifactId>joda-time</artifactId>
        <version>${joda-time.version}</version>
    </dependency>

    <!-- To map JodaTime with database type -->         
    <dependency>
        <groupId>org.jadira.usertype</groupId>
        <artifactId>usertype.core</artifactId>
        <version>3.0.0.CR1</version>
    </dependency>

    <!-- Servlet+JSP+JSTL -->
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.1.0</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>javax.servlet.jsp-api</artifactId>
        <version>2.3.1</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>


    <!-- Testing dependencies -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-test</artifactId>
        <version>${springframework.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>${testng.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-all</artifactId>
        <version>${mockito.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <version>${h2.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>dbunit</groupId>
        <artifactId>dbunit</artifactId>
        <version>${dbunit.version}</version>
        <scope>test</scope>
    </dependency>

</dependencies>

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <warSourceDirectory>src/main/webapp</warSourceDirectory>
                    <warName>FYP4</warName>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
    <finalName>FYP4</finalName>
</build>

Barbaros Özhan
  • 59,113
  • 10
  • 31
  • 55
tescos
  • 1
  • 1

2 Answers2

0

Try to compile it on the shell and check the mentioned paths in Eclipse:

You should have mvn and javac in your %PATH%. Additionally you can set your JAVA_HOME for example to C:\Program Files\Java\jdk1.8.0_144

Good screenshots of the Eclipse and Windows settings are already shown here

Sammy
  • 1
  • 1
  • 1
  • I had those settings already configured prior to these errors. I went into the command line and compiled my project. It created a war file under user\.m2 and I imported that into eclipse. Its working now but now I can't access my java files https://gyazo.com/3ab5b997bde2bd036d291e71227e5ada – tescos Nov 01 '17 at 22:39
0

If you are building in Eclipse then make sure you are using a JDK to build and not a JRE.

Goto: Window -> Preferences -> Java -> Installed JREs Then: Verify you are using a JDK and not a JRE.

enter image description here

javaPlease42
  • 4,699
  • 7
  • 36
  • 65