[ 
https://issues.apache.org/jira/browse/NIFI-11217?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17698075#comment-17698075
 ] 

Kevin Doran commented on NIFI-11217:
------------------------------------

Credit to Julien G for reporting and helping us identify the issue on the 
Apache NiFi Slack:
https://apachenifi.slack.com/archives/C0L9S92JY/p1676561597970849 

> NiFi NAR Maven Plugin fails to build external NARs with transitive, provided 
> dependencies.
> ------------------------------------------------------------------------------------------
>
>                 Key: NIFI-11217
>                 URL: https://issues.apache.org/jira/browse/NIFI-11217
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Tools and Build
>    Affects Versions: nifi-nar-maven-plugin-1.4.0
>            Reporter: Kevin Doran
>            Assignee: Kevin Doran
>            Priority: Major
>             Fix For: nifi-nar-maven-plugin-1.5.0
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> It appears that the NAR maven plugin was benefiting from behavior in older 
> version of the maven-dependency-tree library that would resolve artifacts in 
> addition to poms when crawling dependendncies. This guaranteed that they 
> would be in the local Maven repository/cache when in the Extension 
> Documentation generation phase of NAR building.
> Version 1.4.0 of the plugin upgraded maven-dependency-tree to 3.2.0, which 
> included this behavior change to only download poms:
> https://github.com/apache/maven-dependency-tree/commit/b330fa93b70e35c70a8afa75f0404cf47d5935d6
>  
> This broke building NARs that are external from the Apache NiFi 
> repository/project that inherit from (or depend on) NiFi NARs that have 
> transitive dependencies marked as provided, because the Extension 
> Documentation generation needs the full artifact resolved in order to create 
> a working ClassLoader. Not having artifacts resolved results in error 
> messages such as:
> {noformat}
> [INFO] --- nifi-nar-maven-plugin:1.4.0:nar (default-nar) @ 
> nifi-example-processors-nar ---
> [INFO] Copying nifi-example-processors-1.0.jar to 
> /Users/kdoran/dev/code/nifi-dependency-example/nifi-inherits-processor-bundle/nifi-example-processors-nar/target/classes/META-INF/bundled-dependencies/nifi-example-processors-1.0.jar
> [INFO] Generating documentation for NiFi extensions in the NAR...
> [INFO] Found NAR dependency of 
> org.apache.nifi:nifi-standard-services-api-nar:nar:1.20.0:compile
> [INFO] Found NAR dependency of 
> org.apache.nifi:nifi-jetty-bundle:nar:1.20.0:compile
> [INFO] Found a dependency on version 1.20.0 of NiFi API
> [ERROR] Could not generate extensions' documentation
> org.apache.maven.plugin.MojoExecutionException: Failed to create Extension 
> Documentation
>     at org.apache.nifi.NarMojo.generateDocumentation (NarMojo.java:534)
>     at org.apache.nifi.NarMojo.execute (NarMojo.java:505)
>     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo 
> (DefaultBuildPluginManager.java:137)
>     at org.apache.maven.lifecycle.internal.MojoExecutor.execute 
> (MojoExecutor.java:210)
>     at org.apache.maven.lifecycle.internal.MojoExecutor.execute 
> (MojoExecutor.java:156)
>     at org.apache.maven.lifecycle.internal.MojoExecutor.execute 
> (MojoExecutor.java:148)
>     at 
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject 
> (LifecycleModuleBuilder.java:117)
>     at 
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject 
> (LifecycleModuleBuilder.java:81)
>     at 
> org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build
>  (SingleThreadedBuilder.java:56)
>     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute 
> (LifecycleStarter.java:128)
>     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
>     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
>     at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
>     at org.apache.maven.cli.MavenCli.execute (MavenCli.java:972)
>     at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
>     at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
>     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
>     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke 
> (NativeMethodAccessorImpl.java:62)
>     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke 
> (DelegatingMethodAccessorImpl.java:43)
>     at java.lang.reflect.Method.invoke (Method.java:566)
>     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced 
> (Launcher.java:282)
>     at org.codehaus.plexus.classworlds.launcher.Launcher.launch 
> (Launcher.java:225)
>     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode 
> (Launcher.java:406)
>     at org.codehaus.plexus.classworlds.launcher.Launcher.main 
> (Launcher.java:347)
> Caused by: org.apache.maven.plugin.MojoExecutionException: Could not resolve 
> local dependency org.apache.nifi:nifi-framework-api:jar:1.20.0
>     at 
> org.apache.nifi.extension.definition.extraction.ExtensionClassLoaderFactory.getProvidedArtifact
>  (ExtensionClassLoaderFactory.java:224)
>     at 
> org.apache.nifi.extension.definition.extraction.ExtensionClassLoaderFactory.createProvidedEntitiesClassLoader
>  (ExtensionClassLoaderFactory.java:258)
>     at 
> org.apache.nifi.extension.definition.extraction.ExtensionClassLoaderFactory.createClassLoader
>  (ExtensionClassLoaderFactory.java:116)
>     at 
> org.apache.nifi.extension.definition.extraction.ExtensionClassLoaderFactory.createClassLoader
>  (ExtensionClassLoaderFactory.java:122)
>     at 
> org.apache.nifi.extension.definition.extraction.ExtensionClassLoaderFactory.createClassLoader
>  (ExtensionClassLoaderFactory.java:122)
>     at 
> org.apache.nifi.extension.definition.extraction.ExtensionClassLoaderFactory.createExtensionClassLoader
>  (ExtensionClassLoaderFactory.java:101)
>     at org.apache.nifi.NarMojo.generateDocumentation (NarMojo.java:531)
>     at org.apache.nifi.NarMojo.execute (NarMojo.java:505)
>     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo 
> (DefaultBuildPluginManager.java:137)
>     at org.apache.maven.lifecycle.internal.MojoExecutor.execute 
> (MojoExecutor.java:210)
>     at org.apache.maven.lifecycle.internal.MojoExecutor.execute 
> (MojoExecutor.java:156)
>     at org.apache.maven.lifecycle.internal.MojoExecutor.execute 
> (MojoExecutor.java:148)
>     at 
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject 
> (LifecycleModuleBuilder.java:117)
>     at 
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject 
> (LifecycleModuleBuilder.java:81)
>     at 
> org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build
>  (SingleThreadedBuilder.java:56)
>     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute 
> (LifecycleStarter.java:128)
>     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
>     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
>     at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
>     at org.apache.maven.cli.MavenCli.execute (MavenCli.java:972)
>     at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
>     at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
>     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
>     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke 
> (NativeMethodAccessorImpl.java:62)
>     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke 
> (DelegatingMethodAccessorImpl.java:43)
>     at java.lang.reflect.Method.invoke (Method.java:566)
>     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced 
> (Launcher.java:282)
>     at org.codehaus.plexus.classworlds.launcher.Launcher.launch 
> (Launcher.java:225)
>     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode 
> (Launcher.java:406)
>     at org.codehaus.plexus.classworlds.launcher.Launcher.main 
> (Launcher.java:347)
> {noformat}
> Specifically, our code needs to be updated so that artifacts are resolved, 
> using remote repositories if necessary, which they are not in the current 
> plugin implementation.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to