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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]