Enable Reports Plugin in Custom Addon

Hi,

I am developing an addon project which then I use in a larger App project.

This addon project contains several screen fragments and logic. Among its routines I need to launch reports. I am able to install the report plugin in the App project, but then when I try to launch the report programatically FROM THE ADDON in the following fashion:

Report r = dataManager.load(Report.class).query("select r from report_Report r where r.name like :rn")
            .parameter("rn", "Report Name").one();
    byte[] bb = reportRunner.byReportEntity(r).withParams(params).run().getContent();
    downloader.download(bb, "Output Report.pdf");

I can’t get the IDE and framework to recognise and properly import the Report class and reportRunner. If I do it in the App application it will work. However it doesn’t in the sub addon.

When I try to enable the Reports plugin related libraries via adding the dependencies section in the Addon build.gradle file the following:

implementation 'io.jmix.reports:jmix-reports-rest-starter'
implementation 'io.jmix.reports:jmix-reports-ui-starter'
implementation 'io.jmix.reports:jmix-reports-starter'

I get errors claiming the implementation() method was not found. However if including those three lines in the build.gradle file of the App project it works.

I know this is a gradle and project structure issue, however I don’t reach to understand how to fix it. I have tried as well to include the proper repository and the dependency via:

classpath 'io.jmix.reports:jmix-reports:1.5.0' (implementation won't work)

in the Addon build.gradle file, but get no luck either, then it builds fine but the classes are not imported correctly and keep being unable to instantiate the Report class in my logic files.

Any straightforward way to solve this issue?

Thanks in advance for your help.

Carlos.

AMMENDMENT:

Got it solved by adding:

classpath 'io.jmix.reports:jmix-reports:1.5.0'

to the Addon build.gradle file. Don’t know why it was not working before. Suddenly I was able to import and use them. An IDE restart and clicking on Refresh Gradle Dependencies might have done the trick.

Regards.
Carlos.

Mark solved.
Thanks.
Carlos.

Normally the following configuration should suffice:

In the add-on:

myaddon.gradle

dependencies {
    api 'io.jmix.reports:jmix-reports-flowui-starter'
    api 'io.jmix.reports:jmix-reports-starter'
    api 'io.jmix.reports:jmix-reports-rest-starter'
    // ...
}

In the app:

build.gradle

dependencies {
    implementation 'com.company:myaddon-starter:0.0.1-SNAPSHOT'
    // ...
}