Problem adding plugin

52 views
Skip to first unread message

mill...@milligan.no

unread,
Apr 25, 2014, 5:13:05 AM4/25/14
to js...@googlegroups.com
Hello,

I am having some problems adding a very simple plugin compiled into a jar. 

I use the following snippet to load plugins:

PluginManager pm = PluginManagerFactory.createPluginManager();
PluginManagerUtil pmtools = new PluginManagerUtil(pm);

pm.addPluginsFrom(ClassURI.CLASSPATH); // Load internal plugins
pm.addPluginsFrom(new File("Plugins/").toURI(),new OptionReportAfter()); // Load external plugins

I put a jar file in the Plugins folder. The content of the jar file is my plugin (with the @PluginImplementation annotation) and the source of the interface file. The Plugins directory is found as expected (I don't get any errors about the path not existing) but still the plugin doesn't get loaded. What am I doing wrong?

I also tried linking directly to the jar, but that didn't work either.

Looking forwards to your reply,
Sincerely,
Kristoffer Milligan

mill...@milligan.no

unread,
Apr 28, 2014, 8:03:46 AM4/28/14
to js...@googlegroups.com, mill...@milligan.no
After having talked to Mr.Biedert he was able to locate my problem.

I was bundling the wrong files in my plugin jar (I was bundling the .java files, and JSPF needs the .class files). 

I am a Netbeans user so the plugin export feature presented in the howto video wasn't available to me. I fixed that by creating a few small scripts. In my build.xml, I put the following snippet:

<copy  todir="${build.home}/WEB-INF/classes">
      <fileset dir="${src.home}" excludes="**/*.java"/>
    </copy>

My compiler.sh contains the following lines:

#!/bin/bash
rm -rf "Plugins/"
mkdir "Plugins"
cd build/classes
for file in `ls net/myproject/plugins/`
do
FILE="${file%.*}"
jar cvf "../../Plugins/$FILE.jar" "net/myproject/plugins/$file"
done

This will effectively create a .jar with the compiled version of the plugin and place it in the Plugins folder of the project root.

Antonio Manuel Muñiz Martín

unread,
Apr 28, 2014, 12:11:07 PM4/28/14
to js...@googlegroups.com
You should use some build tool instead of complex, ugly and
unmaintainable shell scripts.
Give a try to Maven, Ant, Gradle, etc or any other build tool. Your
life will become easier spontaneously.
> --
> Sie erhalten diese Nachricht, weil Sie in Google Groups E-Mails von der
> Gruppe "jspf" abonniert haben.
> Wenn Sie sich von dieser Gruppe abmelden und keine E-Mails mehr von dieser
> Gruppe erhalten möchten, senden Sie eine E-Mail an
> jspf+uns...@googlegroups.com.
> Weitere Optionen finden Sie unter https://groups.google.com/d/optout.



--
Antonio Manuel Muñiz Martín
Software Developer at klicap - ingeniería del puzle

work phone + 34 954 894 322
www.klicap.es | blog.klicap.es
Reply all
Reply to author
Forward
0 new messages