You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/07/05 09:12:48 UTC

[GitHub] [pulsar] cbornet opened a new issue, #16397: Incorrect detection of NAR files

cbornet opened a new issue, #16397:
URL: https://github.com/apache/pulsar/issues/16397

   **Describe the bug**
   In several parts of the code (`org.apache.pulsar.common.nar.FileUtils`, `NarClassLoader`, ...), the type of the archive  (NAR or JAR) is detected by looking at the existence of the `META-INF/bundled-dependencies` directory. But this directory doesn't necessarily exist in a NAR archive. For instance, if all the dependencies of the artifact are set as `provided` because they already exist in Pulsar. In that case the archive gets wrongly detected as a JAR.
   
   **To Reproduce**
   Steps to reproduce the behavior:
   1. Create new maven project ExclamationFunction
   ```java
   public class ExclamationFunction implements Function<String, String> {
       @Override
       public String process(String input, Context context) {
           return String.format("%s!", input);
       }
   }
   ```
   2. Write pom including nifi-nar-maven-plugin
   ```xml
   <?xml version="1.0" encoding="UTF-8"?>
   <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>
   
       <groupId>com.example</groupId>
       <artifactId>exclamation-function</artifactId>
       <version>1.0-SNAPSHOT</version>
   
       <build>
           <plugins>
               <plugin>
                   <groupId>org.apache.nifi</groupId>
                   <artifactId>nifi-nar-maven-plugin</artifactId>
                   <version>1.2.0</version>
                   <extensions>true</extensions>
                   <configuration>
                       <finalName>${project.artifactId}-${project.version}</finalName>
                   </configuration>
                   <executions>
                       <execution>
                           <id>default-nar</id>
                           <phase>package</phase>
                           <goals>
                               <goal>nar</goal>
                           </goals>
                       </execution>
                   </executions>
               </plugin>
               <plugin>
                   <groupId>org.apache.maven.plugins</groupId>
                   <artifactId>maven-compiler-plugin</artifactId>
                   <configuration>
                       <source>8</source>
                       <target>8</target>
                   </configuration>
               </plugin>
           </plugins>
       </build>
   </project>
   ```
   3. Package
   ```sh
   mvn clean package
   ```
   4. Inspect the generated NAR --> There is no `META-INF/bundled-dependencies` directory
   
   **Expected behavior**
   Another way to detect if the archive is a NAR should be used.
   Eg. checking if the `MANIFEST.MF` file contains the string `Nar-Id:`
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] cbornet commented on issue #16397: Incorrect detection of NAR files

Posted by GitBox <gi...@apache.org>.
cbornet commented on issue #16397:
URL: https://github.com/apache/pulsar/issues/16397#issuecomment-1325148298

   @shibd Is that the NAR built in `pulsar-functions-api-examples-builtin`. In that case, the artifact pulls `pulsar-functions-api-examples` as a dependency. This is not the way people generally build a NAR.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] github-actions[bot] commented on issue #16397: Incorrect detection of NAR files

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #16397:
URL: https://github.com/apache/pulsar/issues/16397#issuecomment-1207127131

   The issue had no activity for 30 days, mark with Stale label.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] github-actions[bot] commented on issue #16397: Incorrect detection of NAR files

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #16397:
URL: https://github.com/apache/pulsar/issues/16397#issuecomment-1364611720

   The issue had no activity for 30 days, mark with Stale label.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] shibd commented on issue #16397: Incorrect detection of NAR files

Posted by GitBox <gi...@apache.org>.
shibd commented on issue #16397:
URL: https://github.com/apache/pulsar/issues/16397#issuecomment-1176031918

   Have a question: If all dependency scope is provided, My test result is that there will be a jar package(function itself). 
   
   <img width="663" alt="image" src="https://user-images.githubusercontent.com/33416836/177525533-a92b67a2-6f38-4e3f-8a24-1ee5cb4925be.png">
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org