Import library org.apache.commons.io.input from Java to Eclipse

0

I need to use the ReversedLinesFileReader class, which belongs to the org.apache.commons.io.input library.

@TomMelo told me that I should include a dependency on this library in the pom.xml file for Maven . This is the dependency: mvnrepository.com/artifact/commons-io/commons-io/2.5

I copied and pasted the dependency into the pom.xml file in a blank space, exactly as it was:

<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
    <groupId>commons-io</groupId>
    <artifactId>commons-io</artifactId>
    <version>2.5</version>
</dependency

So, should not I include some code before inserting the dependency?

The other question is: how do I import into my Java class that I'm writing in a Java Project in Eclipse? I've tried: import org.apache.commons.io.input; but Eclipse does not recognize org.apache, even though I have already included dependency in pow.xml.

Where is the error?

    
asked by anonymous 08.10.2017 / 23:18

1 answer

0

Well, according to user Jefferson Quesado, for dependencies declared in pom.xml to be seen by my project in Eclipse, this project needs to be a "Java Project, Maven "which is a library manager that comes with Eclipse.     In Eclipse itself I can turn my Java project into a Maven project. Or create from the beginning the project as Maven.

    
10.10.2017 / 02:40