简体   繁体   中英

import errors in maven project

Getting import can not be resolved errors in maven project even though all the required dependencies have been added to the pom.xml. Here are the imports which are getting errored:

import org.apache.hadoop.fs.CreateFlag;
import org.apache.hadoop.fs.FileContext;
import org.apache.hadoop.fs.Options;
import org.apache.hadoop.fs.Options.CreateOpts;

And these are the dependencies that are there in pom.xml

<dependencies>
  <!-- https://mvnrepository.com/artifact/org.apache.hadoop/hadoop-common -->
        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-common</artifactId>
            <version>2.7.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-auth</artifactId>
            <version>2.7.1</version>
        </dependency>
     <dependency>
       <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-core</artifactId>
       <version>1.2.1</version>
    </dependency>   
  </dependencies>

Can someone please point out what could possibly be going wrong?

Thanks in advance!!

You can try out different solutions: - Try another version of the Hadoop libraries - Delete the complete .m2 repository in your user folder and redownload the libraries - Check if your project is configured as a Maven project in your IDE

Good luck!

I tried all the possible options like removing old .m2 directory, update project, checked settings.xml etc but none of them seemed to help. So I finally installed the eclipse again and it worked! Seems like there was something wrong with the IDE but not sure what exactly was wrong.

Thanks everyone for responding with the possible options.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM