0

As I run my below script to read data from excel functionality locally no issues in the execution.

public String getCellDataString(String sheetName, int rowNum, int colNum) throws IOException {      
        File file = new File(System.getProperty("user.dir")+"/excel/ExcelWorkBook.xlsx");
        FileInputStream fis = new FileInputStream(file);
        XSSFWorkbook wb = new XSSFWorkbook(fis);
        XSSFSheet sheet = wb.getSheet(sheetName);           
        String cellData = sheet.getRow(rowNum).getCell(colNum).getStringCellValue();             
        return cellData;                                                                         
}

I have all apache-poi added to pom.xml.

<dependency>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.7.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>4.1.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>4.1.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml-schemas</artifactId>
        <version>4.1.1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-scratchpad</artifactId>
        <version>4.1.1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>openxml4j</artifactId>
        <version>1.0-beta</version>
    </dependency>

As I upload to Azure DevOps and build, I get a package org.apache.poi.hssf.usermodel does not exist error for each of the imports and build failed.

  • package org.apache.poi.xssf.usermodel does not exist
  • cannot find symbol

Click here to see Azure DevOps Build failed error

I did tried below links but could not find any solution,

Link 1 Link 2

I see that Azure Devops unable to download sources, May I please know what am I missing ?

EDITED: Below is my Azure DevOps pipeline definition Azure DevOps Pipeline Definition

GSN
  • 123
  • 2
  • 13
  • 1
    Don't mix POI jars from different versions. See [FAQ](https://poi.apache.org/help/faq.html#faq-N10204). So don't mix versions `4.1.2` and `4.1.1`. And don't use the old `openxml4j` version `1.0-beta` with `apache poi 4.1.2`. The current `openxml4j` is part of `poi-ooxml` now. – Axel Richter Jul 07 '20 at 03:42
  • Does this issue persist? Could you please share some details about your pipeline definitions so that we can reproduce the issue? – LoLance Jul 09 '20 at 10:31
  • @LanceLi-MSFT Kindly find my updated pipeline definition above. – GSN Jul 19 '20 at 18:18
  • What if you use maven command in command line locally to do same job? I'm trying to figure out whether there's something wrong from project itself or pipeline settings. – LoLance Jul 23 '20 at 09:53
  • @LanceLi-MSFT I don't see any issues when I run locally. Below is my maven command looks like, clean test -Dusername=username -Dpassword=password -Denvironment=URL -Dbrowser=chrome – GSN Jul 29 '20 at 23:44

0 Answers0