extension_library.adoc 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. = Creating an extension library plugin
  2. :author:
  3. :revnumber:
  4. :revdate: 2016/03/17 20:48
  5. :relfileprefix: ../../
  6. :imagesdir: ../..
  7. ifdef::env-github,env-browser[:outfilesuffix: .adoc]
  8. This page describes how you can wrap any jar library into a plugin that a jMonkeyEngine SDK user can download, install and then use the contained library in his own game projects.
  9. Make sure you have your SDK set up for plugin development <<sdk/development/setup#,as described here>>.
  10. Creating the plugin project (in jMonkeyEngine SDK):
  11. * Create a new Module Suite (or use an existing one)
  12. * Open the suite, right-click the “Modules folder and select “Add new..
  13. * For “Project Name enter an all-lowercase name without spaces like `my-library`
  14. * Make sure the “Project Location is inside the module suite folder and press “Next
  15. * Enter the base java package for your plugin in “Code Name Base like `com.mycompany.plugins.mylibrary`
  16. * Enter a “Module Display Name for your plugin like “My Library
  17. * Press Finish
  18. Adding the library:
  19. * Right click the Module Project and select “New→Other
  20. * Under “Module Development select the “Java SE Library Descriptor template and press “Next
  21. * If you dont have the external library registered in the jMonkeyEngine SDK yet, click “Manage Libraries and do the following:
  22. ** Click “New Library, enter a name for the library and press OK
  23. ** In the “Classpath tab, press “Add JAR/Folder and select the jar file(s) needed for the library
  24. ** In the “JavaDoc tab, press “Add ZIP/Folder and add the javadoc for the library (zipped or folder)
  25. ** In the “Sources tab you can add a folder or jar file containing the source files of the library if available
  26. ** Press OK
  27. * Select the external library from the list and press “Next
  28. * Enter a name for the Library (used as filename for the description file)
  29. * Enter a display name for the Library (This is the name the user later sees in his library list)
  30. * Press OK
  31. You will notice a new file “MyLibrary.xml is created in the plugins base package and linked to in the layer.xml file. Additionally the jar file and sources /javadoc are copied into a “release folder in the project root. This is basically it, you can configure a version number, license file (should be placed in Module root folder) and more via the Module Properties.
  32. Note that the files in the release folder are *not* automatically updated when the library changes, you have to pack and replace the jar and zip files manually. See the build script extension in the link below on how you can make your module build script do that automatically.
  33. After you are done, you can <<sdk/development/setup#jmonkeyengine_sdk_contributions_update_center,contribute the plugin in the jMonkeyEngine SDK contribution update center>>.