0

I am not able to read values from csv file in a maven projects. Works perfectly when it is done using testng. Can Some one help me in knowing what else I am missing

Here's my code: import java.io.FileReader; import com.opencsv.CSVReader;

public static void Test() throws Exception
{

 @SuppressWarnings("resource")
    CSVReader reader = new CSVReader(new FileReader("File"));
      String [] csvCell;

       while ((csvCell = reader.readNext()) != null)
      { 



         String A = csvCell[0];
         String B = csvCell[1];
}
Maven Dependency 
    <dependency>
 <groupId>com.opencsv</groupId>
 <artifactId>opencsv</artifactId>
 <version>3.9</version>

Vinyasjain77
  • 31
  • 1
  • 7

1 Answers1

0

Try having the same dependency but with test scope

<dependency>
 <groupId>com.opencsv</groupId>
 <artifactId>opencsv</artifactId>
 <version>3.9</version>
</dependency>
<dependency>
 <groupId>com.opencsv</groupId>
 <artifactId>opencsv</artifactId>
 <version>3.9</version>
 <scope>test</scope>
</dependency>
Scott Conway
  • 975
  • 7
  • 13