public static PluginInfo create(File jarFile) {
    try {
      PluginManifest manifest = new PluginManifest(jarFile);
      return create(jarFile, manifest);

    } catch (IOException e) {
      throw new IllegalStateException("Fail to extract plugin metadata from file: " + jarFile, e);
    }
  }
@Test
  public void fail_when_jar_is_not_a_plugin() throws IOException {
    // this JAR has a manifest but is not a plugin
    File jarRootDir = temp.newFolder();
    FileUtils.write(new File(jarRootDir, "META-INF/MANIFEST.MF"), "Build-Jdk: 1.6.0_15", StandardCharsets.UTF_8);
    File jar = temp.newFile();
    ZipUtils.zipDir(jarRootDir, jar);

    assertThatThrownBy(() -> PluginInfo.create(jar))
      .isInstanceOf(MessageException.class)
      .hasMessage("File is not a plugin. Please delete it and restart: " + jar.getAbsolutePath());
  }