Search code examples
javarestmavenodataolingo

org.apache.olingo path is not resolved even after downloading the dependencies


I am trying to create an OData service using apache olingo V4 (https://olingo.apache.org/doc/odata4/tutorials/read/tutorial_read.html)

But when I am creating an Edm(Entity Data Model) provider class by inheriting the class CsdlAbstractEdmProvider of the package org.apache.olingo.commons.api.edm.provider (https://olingo.apache.org/javadoc/odata4/org/apache/olingo/commons/api/edm/provider/CsdlAbstractEdmProvider.html), getting the error The import org.apache can not be resolved

I understand that, I am missing the necessary library to be included in my project. Though I have created this as maven project and edited the pom.xml file as suggested in the tutorial. Even, to avoid any conflict I am using the same naming conventions for the file as been used in the tutorial.

Please suggest me how to deal with this situation. Feel free to ask about any further clarification about the question. Here I am including my pom.xml 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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <groupId>my.group.id</groupId>
    <artifactId>DemoService</artifactId>
    <packaging>war</packaging>
    <version>4.0.0</version>

    <name>DemoService Maven Webapp</name>
    <properties>
        <javax.version>2.5</javax.version>
        <odata.version>4.0.0</odata.version>
        <slf4j.version>1.7.7</slf4j.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>${javax.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.olingo</groupId>
            <artifactId>odata-server-api</artifactId>
            <version>${odata.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.olingo</groupId>
            <artifactId>odata-server-core</artifactId>
            <version>${odata.version}</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.olingo</groupId>
            <artifactId>odata-commons-api</artifactId>
            <version>${odata.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.olingo</groupId>
            <artifactId>odata-commons-core</artifactId>
            <version>${odata.version}</version>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>${slf4j.version}</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.11</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>  
    <build>
        <finalName>DemoService</finalName>
    </build>
  </project>

Here is the snapshot of my project folder structure [Project folder structure]


Solution

  • There was a problem with my maven installation. I installed it separately and set the path variable to C:\ProgramFiles\apache-maven-3.5.0\bin. To be sure you can run mvn -version in command prompt(https://maven.apache.org/install.html).

    Thank you