Search code examples
javaeclipsemavenselenium-webdriver

Why am i not seeing the import library option in Eclipse, i have added the required library in the build config path


`

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>Testfile</groupId>
  <artifactId>Testfile</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  
 <dependencies> 
     <dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>4.16.1</version>
</dependency>
  <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi-ooxml</artifactId>
    <version>5.2.5</version>
</dependency>
<dependency>
    <groupId>io.github.bonigarcia</groupId>
    <artifactId>webdrivermanager</artifactId>
    <version>5.8.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi</artifactId>
    <version>5.2.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>4.21.0</version>
</dependency>
<dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-core</artifactId>
    <version>2.20.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
    <groupId>org.testng</groupId>
    <artifactId>testng</artifactId>
    <version>7.10.2</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-api</artifactId>
    <version>2.20.0</version>
</dependency>
</dependencies>
</project>

` Appreciate any help on the above mentioned? Adding the snapshot hereImport library not visible to addConfig build path with added libraries

I am trying to import the library on hovering the mouse for the Java selenium keywords. and the libraries to get imported in my java class file by default , but i am unable to do this.


Solution

  • Your project seems to be using Maven as the build system, from the little that we can see in the screenshot. In that case you should specify all needed libraries as Maven dependencies in the pom.xml file and don't touch Eclipse build path at all. Basically Maven replaces the IDE build system. If you edit the build path manually it will produce inconsistent results. With Maven it should produce the same result in the command line or in the IDE.