Maven Dependency is not getting downloaded

Avatar

Avatar
Boost 1
Level 1
selva_billa
Level 1

Likes

0 likes

Total Posts

7 posts

Correct reply

0 solutions
Top badges earned
Boost 1
Validate 1
View profile

Avatar
Boost 1
Level 1
selva_billa
Level 1

Likes

0 likes

Total Posts

7 posts

Correct reply

0 solutions
Top badges earned
Boost 1
Validate 1
View profile
selva_billa
Level 1

07-11-2018

Hi Team,

I have created a simple maven project which queries AEM 6.4 repository and sends the mail with query results in excel attachment. I am using Apache POI Api to create excel. To add the POI jar, I used depfinder(/system/console/depfinder) and got the below dependency details.

<dependency>

     <artifactId>com.adobe.granite.poi</artifactId>

     <version>2.0.24</version>

     <groupId>com.adobe.granite</groupId>

</dependency>

I added the same in POM. But the build is failing with below error message.

Could not find artifact com.adobe.granite:com.adobe.granite.poi:jar:2.0.24 adobe (https://repo.adobe.com/nexus/content/groups/public/) -> [Help 1]

Can anyone let me know what is the suitable way to handle this scenario ? I have alternative way where in I can specify the dependency like below in my POM.

<dependency>

    <groupId>org.apache.poi</groupId>

    <artifactId>poi</artifactId>

    <version>4.0.0</version>

</dependency>

But I want to know how to make the above depfinder suggested dependency to work ?

Regards,

/S

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Give Back 50
Employee
Feike_Visser1
Employee

Likes

247 likes

Total Posts

970 posts

Correct reply

221 solutions
Top badges earned
Give Back 50
Give Back 5
Give Back 3
Give Back 25
Give Back 10
View profile

Avatar
Give Back 50
Employee
Feike_Visser1
Employee

Likes

247 likes

Total Posts

970 posts

Correct reply

221 solutions
Top badges earned
Give Back 50
Give Back 5
Give Back 3
Give Back 25
Give Back 10
View profile
Feike_Visser1
Employee

07-11-2018

You should really only need the uber-jar.

like this:

<dependency>
<groupId>com.adobe.aem</groupId>
<artifactId>uber-jar</artifactId>
<version>6.4.2</version>
<classifier>apis</classifier>
<scope>provided</scope>
</dependency>

Answers (6)

Answers (6)

Avatar

Avatar
Give Back 5
Level 2
manisha594391
Level 2

Likes

4 likes

Total Posts

43 posts

Correct reply

1 solution
Top badges earned
Give Back 5
Give Back 3
Give Back
Ignite 5
Ignite 3
View profile

Avatar
Give Back 5
Level 2
manisha594391
Level 2

Likes

4 likes

Total Posts

43 posts

Correct reply

1 solution
Top badges earned
Give Back 5
Give Back 3
Give Back
Ignite 5
Ignite 3
View profile
manisha594391
Level 2

13-04-2021

I am using uber jar 6.5.0. With that new XSSFWorkbook(inputStream) is working fine runtime and am able to generate excel, however the same is failing in PowerMockRunner junit with exception org.apache.poi.POIXMLException: java.lang.reflect.InvocationTargetException. Any pointers appreciated

Avatar

Avatar
Boost 1
Level 1
selva_billa
Level 1

Likes

0 likes

Total Posts

7 posts

Correct reply

0 solutions
Top badges earned
Boost 1
Validate 1
View profile

Avatar
Boost 1
Level 1
selva_billa
Level 1

Likes

0 likes

Total Posts

7 posts

Correct reply

0 solutions
Top badges earned
Boost 1
Validate 1
View profile
selva_billa
Level 1

13-11-2018

Thanks. It's working.

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,410 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,410 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

08-11-2018

I have confirmed that uber 6.4 jar works (as Feike pointed out) .

My class:

package com.adobe.excel.core;

import org.apache.poi.ss.usermodel.Cell;

import org.apache.poi.ss.usermodel.Row;

import org.apache.poi.xssf.usermodel.XSSFSheet;

import org.apache.poi.xssf.usermodel.XSSFWorkbook;

import java.io.FileNotFoundException;

import java.io.FileOutputStream;

import java.io.IOException;

import org.slf4j.Logger;

import org.slf4j.LoggerFactory;

import org.osgi.service.component.annotations.Component;

@Component

public class ExcelImpl implements Excel {

private final Logger logger = LoggerFactory.getLogger(getClass());

private static final String FILE_NAME = "C:\\AdobeCQ\\MyFirstExcel.xlsx";

public void createExcel()

{

XSSFWorkbook workbook = new XSSFWorkbook();

        XSSFSheet sheet = workbook.createSheet("Datatypes in Java");

        Object[][] datatypes = {

                {"Datatype", "Type", "Size(in bytes)"},

                {"int", "Primitive", 2},

                {"float", "Primitive", 4},

                {"double", "Primitive", 8},

                {"char", "Primitive", 1},

                {"String", "Non-Primitive", "No fixed size"}

        };

        int rowNum = 0;

        logger.info("Creating excel");

        for (Object[] datatype : datatypes) {

            Row row = sheet.createRow(rowNum++);

            int colNum = 0;

            for (Object field : datatype) {

                Cell cell = row.createCell(colNum++);

                if (field instanceof String) {

                    cell.setCellValue((String) field);

                } else if (field instanceof Integer) {

                    cell.setCellValue((Integer) field);

                }

            }

        }

        try {

            FileOutputStream outputStream = new FileOutputStream(FILE_NAME);

            workbook.write(outputStream);

            workbook.close();

        } catch (FileNotFoundException e) {

            e.printStackTrace();

        } catch (IOException e) {

            e.printStackTrace();

        }

        logger.info("Done");

    }

}

Parent POM:

<dependency>

    <groupId>com.adobe.aem</groupId>

    <artifactId>uber-jar</artifactId>

    <version>6.4.0</version>

    <classifier>apis</classifier>

    <scope>provided</scope>

</dependency>

             

  <dependency>

       <groupId>org.apache.geronimo.specs</groupId>

       <artifactId>geronimo-atinject_1.0_spec</artifactId>

       <version>1.0</version>

       <scope>provided</scope>

   </dependency>

CORE POM:

<?xml version="1.0" encoding="UTF-8"?>

<!--

|  Copyright 2017 Adobe Systems Incorporated

|

|  Licensed under the Apache License, Version 2.0 (the "License");

|  you may not use this file except in compliance with the License.

|  You may obtain a copy of the License at

|

|      http://www.apache.org/licenses/LICENSE-2.0

|

|  Unless required by applicable law or agreed to in writing, software

|  distributed under the License is distributed on an "AS IS" BASIS,

|  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

|  See the License for the specific language governing permissions and

|  limitations under the License.

-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <parent>

        <groupId>excelPOI</groupId>

        <artifactId>excelPOI</artifactId>

        <version>1.0-SNAPSHOT</version>

        <relativePath>../pom.xml</relativePath>

    </parent>

    <artifactId>excelPOI.core</artifactId>

    <packaging>bundle</packaging>

    <name>excelPOI - Core</name>

    <description>Core bundle for excelPOI</description>

    <build>

        <plugins>

            <plugin>

                <groupId>org.apache.sling</groupId>

                <artifactId>maven-sling-plugin</artifactId>

            </plugin>

            <plugin>

                <groupId>org.apache.felix</groupId>

                <artifactId>maven-bundle-plugin</artifactId>

                <extensions>true</extensions>

                <configuration>

                    <instructions>

                        <!-- Import any version of javax.inject, to allow running on multiple versions of AEM -->

                        <Import-Package>javax.inject;version=0.0.0,*</Import-Package>

                        <Sling-Model-Packages>

                            com.adobe.excel.core

                        </Sling-Model-Packages>

                    </instructions>

                </configuration>

            </plugin>

        </plugins>

    </build>

    <dependencies>

        <!-- OSGi Dependencies -->

         <dependency>

            <groupId>com.adobe.aem</groupId>

            <artifactId>uber-jar</artifactId>

            <classifier>apis</classifier>

        </dependency>

   

        <dependency>

            <groupId>org.apache.geronimo.specs</groupId>

            <artifactId>geronimo-atinject_1.0_spec</artifactId>

        </dependency>

        <dependency>

            <groupId>org.osgi</groupId>

            <artifactId>osgi.core</artifactId>

        </dependency>

        <dependency>

            <groupId>org.osgi</groupId>

            <artifactId>osgi.cmpn</artifactId>

        </dependency>

        <dependency>

            <groupId>org.osgi</groupId>

            <artifactId>osgi.annotation</artifactId>

        </dependency>

        <!-- Other Dependencies -->

        <dependency>

            <groupId>org.slf4j</groupId>

            <artifactId>slf4j-api</artifactId>

        </dependency>

        <dependency>

            <groupId>javax.jcr</groupId>

            <artifactId>jcr</artifactId>

        </dependency>

        <dependency>

            <groupId>javax.servlet</groupId>

            <artifactId>servlet-api</artifactId>

        </dependency>

        <dependency>

            <groupId>com.adobe.aem</groupId>

            <artifactId>uber-jar</artifactId>

            <classifier>apis</classifier>

        </dependency>

        <dependency>

            <groupId>org.apache.sling</groupId>

            <artifactId>org.apache.sling.models.api</artifactId>

        </dependency>

        <dependency>

            <groupId>junit</groupId>

            <artifactId>junit</artifactId>

        </dependency>

        <dependency>

            <groupId>org.mockito</groupId>

            <artifactId>mockito-core</artifactId>

        </dependency>

        <dependency>

            <groupId>junit-addons</groupId>

            <artifactId>junit-addons</artifactId>

        </dependency>

    </dependencies>

</project>

Compiled successfully:

Build.png

Bundle is Active

Active.png

Hope this helps....

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,410 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,410 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

08-11-2018

Feike and Arun are correct. I will test this too to make sure there are no issues.

Avatar

Avatar
Give Back 50
Employee
Feike_Visser1
Employee

Likes

247 likes

Total Posts

970 posts

Correct reply

221 solutions
Top badges earned
Give Back 50
Give Back 5
Give Back 3
Give Back 25
Give Back 10
View profile

Avatar
Give Back 50
Employee
Feike_Visser1
Employee

Likes

247 likes

Total Posts

970 posts

Correct reply

221 solutions
Top badges earned
Give Back 50
Give Back 5
Give Back 3
Give Back 25
Give Back 10
View profile
Feike_Visser1
Employee

08-11-2018

Here the list of uber-jar versions Index of /groups/public/com/adobe/aem/uber-jar

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,462 likes

Total Posts

3,328 posts

Correct reply

949 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,462 likes

Total Posts

3,328 posts

Correct reply

949 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

07-11-2018

Hi,

You can check all available versions at Index of /groups/public/com/adobe/granite/com.adobe.granite.poi