Hi Robert,

> On 19 Nov 2019, at 10:22, Robert Munteanu <[email protected]> wrote:
> 
> Sorry for the late reply. I'm not sure I follow. If you inline classes
> that require Java 11, doesn't the bundle effectively require Java 11?

We haven’t inlined classes that require Java 11 APIs.

Let me try to describe again what the issue was. Before switching to building 
the bundle with the bnd-maven-plugin, some of the project’s dependencies were 
embedded and inlined with the maven-bundle-plugin. The animal sniffer plugin’s 
job, though, was to make sure that the project’s classes don’t use APIs not 
available on the target JRE.

With the switch to the sling-bundle-parent, we don’t use the 
maven-bundle-plugin any more and the bnd-maven-plugin doesn’t provide an embed 
/ inline feature. So I delegated this to the maven-dependency-plugin for 
unpacking the “to embed” dependencies into ${project.build.outputDirectory} and 
the default maven-jar-plugin for packing. However, I was running the 
maven-dependency-plugin in the generate-resources phase. The sniffer plugin 
runs its checks in the process-classes phase by default. That led to the 
sniffer plugin checking also the dependencies’ classes (on Java 8 only; it’s 
disabled on Java 11 since the javac does the same checks better). However, like 
you noticed, some of the dependencies’ classes used APIs not available in the 
JRE, but provided by Sling and this made the build fail on Java 8. By default, 
the animal sniffer plugin doesn’t check dependencies. Even if the build failed 
with Java 8, the same module built with Java 11 will run without any issues on 
JRE 1.8, since that’s the target platform.

In version 2.1.16 I’ve corrected how the dependencies are inlined and, when 
building with Java 8, the animal sniffer plugin will only check the project’s 
source code, like before.

Cheers,
Radu


Reply via email to