Changes between Version 107 and Version 108 of DevelopersGuide/DevelopingPlugins
- Timestamp:
- 2021-09-02T14:00:01+02:00 (4 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
DevelopersGuide/DevelopingPlugins
v107 v108 9 9 You can choose either method to build, depending on what you prefer, even setting up both build systems on one project is possible. However if you want to put your plugin into the SVN repo for JOSM plugins, it's generally preferred to use the Ant build described below. 10 10 11 11 12 == Setting up the environment == 12 13 * Check out the plugin environment into an empty directory called {{{josm}}}. Make sure path contains only ASCII characters, otherwise build may fail. … … 15 16 }}} 16 17 * If the old URL https://svn.openstreetmap.org/applications/editors/josm is used, then go to the working copy and call {{{svn relocate}}} with the new URL. 17 * Create a new plugin directory {{{josm/plugins/yourpluginname}}}. You may create a copy of the template directory [source:osm/applications/editors/josm/plugins/00_plugin_dir_template/ 00_plugin_dir_template]. It includes a directory layout, a[source:osm/applications/editors/josm/plugins/00_plugin_dir_template/LICENSElicense file]and a template for the [source:osm/applications/editors/josm/plugins/00_plugin_dir_template/build.xml build.xml].18 * Open the ant script ({{{build.xml}}}) in your plugin directory and configure the properties in the configuration section. 18 * Create a new plugin directory {{{josm/plugins/yourpluginname}}}. You may create a copy of the template directory [source:osm/applications/editors/josm/plugins/00_plugin_dir_template/ 00_plugin_dir_template]. It includes a directory layout, two GPL licenses ([source:osm/applications/editors/josm/plugins/00_plugin_dir_template/GPL-v2.0.txt GPL2] and [source:osm/applications/editors/josm/plugins/00_plugin_dir_template/GPL-v3.0.txt GPL3]) but no license file like [source:/trunk/LICENSE JOSM core] (see [#LegalStuff Legal Stuff] below) and a template for the [source:osm/applications/editors/josm/plugins/00_plugin_dir_template/build.xml build.xml]. 19 * Open the ant script ({{{build.xml}}}) in your plugin directory and configure the properties in the configuration section. The important thing of your build script is, that it places some attributes into the {{{MANIFEST.MF}}} of the jar file. See below. {{{build.xml}}} in the template directory takes care of this. 19 20 * [source:osm/applications/editors/josm/plugins/00_plugin_dir_template/README.template This readme] explains how your plugin is built and made available to other JOSM users. 20 21 22 21 23 == Building JOSM core == 22 23 24 A binary version of JOSM core is required for building a plugin. This is how you compile it yourself: 24 25 {{{ … … 27 28 }}} 28 29 It will create the file `josm/core/dist/josm-custom.jar`. Alternatively you download a release (latest or tested) and move the .jar file to this location. 30 29 31 30 32 == Building == … … 35 37 ant dist 36 38 }}} 39 37 40 38 41 == Testing == … … 52 55 </table> 53 56 }}} 57 54 58 55 59 == Debugging (using Eclipse) == … … 63 67 1. Create a `Run Configuration` (Properties -> Run/Debug Settings -> New -> Java Application). Main class must be set to `org.openstreetmap.josm.gui.MainApplication`. 64 68 1. You can now tweak your plugin and/or set breakpoints… etc. 69 65 70 66 71 == Automated testing == … … 80 85 It will then be run automatically in the Jenkins build, see: 81 86 [/jenkins/job/JOSM-Plugins/lastCompletedBuild/testReport/ Test Report] 87 82 88 83 89 == JOSM plugins == … … 194 200 195 201 === The manifest file for a JOSM plugin === 196 197 202 You have to put some information into the manifest file of your jar. If you use ant, you can set these values within the {{{build.xml}}} file. 198 203 … … 233 238 * The perl script [source:osm/applications/editors/josm/i18n/i18n.pl i18n.pl] must be called with a destination directory and the '''.po''' files to create translation data. 234 239 240 235 241 == Publishing a plugin == 236 242 The plugin list a user sees ([/plugin here]) is automatically generated at regular intervals (currently about 10 minutes) from plugin JAR files (**built with Java 8**) that are located in [source:osm/applications/editors/josm/dist/ josm/dist] on the OSM.org SVN repository (referred to as "internal" plugins) and from links that are embedded in the [wiki:/Plugins Plugins] page (referred to as "external" plugins). Each method has advantages and disadvantages. … … 285 291 286 292 287 == Legal stuff (Imis opinion) == 293 == Legal stuff (Imis opinion) ==#LegalStuff 288 294 Just because I have been asked: JOSM is licensed under GPL and if any code is a "derived work" of JOSM, then it has to be under GPL too. It is my belief that any JOSM-Plugin is a derived work of JOSM, so GPL is the only possible license for a JOSM-Plugin. If you want to include non-GPL code into a plugin, it has to be separated from the classes that use JOSM. "Use" as in "import org.openstreetmap.josm...". See the 'Class-Path' - MANIFEST.MF attribute for a way to include other jar files. 289 295