Search code examples
javasemantic-versioningpf4j

PF4J throws "Plugin-Version cannot be empty"


I set up a PF4J plugin as described on the github readme, but without using maven.

I get the following error:

[main] ERROR ro.fortsoft.pf4j.DefaultPluginManager - Plugin-Version cannot be empty
ro.fortsoft.pf4j.PluginException: Plugin-Version cannot be empty
at ro.fortsoft.pf4j.ManifestPluginDescriptorFinder.validatePluginDescriptor(ManifestPluginDescriptorFinder.java:135)
at ro.fortsoft.pf4j.ManifestPluginDescriptorFinder.find(ManifestPluginDescriptorFinder.java:50)
at ro.fortsoft.pf4j.DefaultPluginManager.loadPluginDirectory(DefaultPluginManager.java:804)
at ro.fortsoft.pf4j.DefaultPluginManager.loadPlugins(DefaultPluginManager.java:400)
at ...

but my MANIFEST.MF obviously contains a Plugin-Version:

Manifest-Version: 1.0
Built-By: myname
Build-Jdk: 1.8.0_121
Plugin-Class: my.first.WelcomePlugin
Plugin-Id: welcome-plugin
Plugin-Provider: providername
Plugin-Version: 0.0.1

I also added Java SemVer v0.9.0

What could be the problem?

UPDATE: I put the Plugin-Version line on top of the manifest file and now it seems to work ..


Solution

  • I put the Plugin-Version line on top of the manifest file and now it seems to work:

    Plugin-Version: 0.0.1
    Manifest-Version: 1.0
    Built-By: myname
    Build-Jdk: 1.8.0_121
    Plugin-Class: my.first.WelcomePlugin
    Plugin-Id: welcome-plugin
    Plugin-Provider: providername