You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nifi.apache.org by Mark Bean <ma...@gmail.com> on 2019/10/11 16:22:03 UTC

dependency scope

We are building Apache NiFi on a separate network with an internal Nexus
repository. When I attempt to build the rel/nifi-1.9.2 tag, I get
compilation errors due to an import failing. Specifically, it is
com.google.common.cache.Cache (and CacheBulider)
in nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/SnippetManager.java.

These classes are part of com.google.guava.guava. I ran a 'mvn
dependency:tree'
from nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core.
It shows:
[INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.9.7:compile
[INFO] +- org.apache.curator:curator-test:jar:2.9.1:test
[INFO] |  +- org.javassist:javassist:jar:3.18.1-GA:compile
[INFO] |  +- org.apache.commons:commons-math:jar:2.2:test
[INFO] |  \- com.google.guava:guava:jar:18.0:test

Note the scope of "test" for guava.

However, when I build the same dependency tree on an Internet-connected
system, I get a scope of "compile" on com.google.guava:guava:jar:18.0.

I checked the parent dependency,
com.fasterxml.jackson.core:jackson-core:2.9.7 pom file. It does not
explicitly have a scope of test.
Both the guava and jackson-core JAR files are identical between the two
systems.

Can someone explain why the scope is different? Is there something in one
of nifi's pom's that is assumed when it should be explicit?

Thanks,
Mark

Re: dependency scope

Posted by Bryan Bende <bb...@gmail.com>.
It is actually curator-test that is bringing in guava, and I think
that its technically wrong that we are then using guava in
SnippetManager without a compile scoped dependency on guava.

The reason it ends up working is because nifi-framework-nar ends up
having guava bundled from other modules it brings in, so at runtime
guava is actually there.

We should fix the framework core pom though.

On Fri, Oct 11, 2019 at 12:22 PM Mark Bean <ma...@gmail.com> wrote:
>
> We are building Apache NiFi on a separate network with an internal Nexus
> repository. When I attempt to build the rel/nifi-1.9.2 tag, I get
> compilation errors due to an import failing. Specifically, it is
> com.google.common.cache.Cache (and CacheBulider)
> in nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/SnippetManager.java.
>
> These classes are part of com.google.guava.guava. I ran a 'mvn
> dependency:tree'
> from nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core.
> It shows:
> [INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.9.7:compile
> [INFO] +- org.apache.curator:curator-test:jar:2.9.1:test
> [INFO] |  +- org.javassist:javassist:jar:3.18.1-GA:compile
> [INFO] |  +- org.apache.commons:commons-math:jar:2.2:test
> [INFO] |  \- com.google.guava:guava:jar:18.0:test
>
> Note the scope of "test" for guava.
>
> However, when I build the same dependency tree on an Internet-connected
> system, I get a scope of "compile" on com.google.guava:guava:jar:18.0.
>
> I checked the parent dependency,
> com.fasterxml.jackson.core:jackson-core:2.9.7 pom file. It does not
> explicitly have a scope of test.
> Both the guava and jackson-core JAR files are identical between the two
> systems.
>
> Can someone explain why the scope is different? Is there something in one
> of nifi's pom's that is assumed when it should be explicit?
>
> Thanks,
> Mark