This is a list of some Gradle tasks, which the gradle-josm-plugin
adds to your build.
If you want to do a full build (including unit tests and other tools you set up, like SpotBugs or PMD), use ./gradlew build
like you would also do without the plugin.
To see a list of available tasks, run ./gradlew tasks
in your project root and take special note of the part titled JOSM tasks
.
Note: Did you know? You can abbreviate Gradle tasks. E.g. for
runJosm
you could writerunJ
or evenrJ
as long as your abbreviation is not ambiguous.
./gradlew runJosm
This task starts up an isolated JOSM instance independent of any JOSM instances that you may have already installed (you do not need to have JOSM installed, Gradle will take care of downloading and running JOSM).
The isolation from other JOSM instances is achieved by using a separate JOSM_HOME
directory located at $projectDir/build/.josm/
. By default this directory persists between different executions of the task runJosm
. If you want to clear this directory to start with a fresh JOSM instance, run the task cleanJosm
before or together with runJosm
.
The JOSM version that is used, is the one you specify to compile your plugin against (see josm.josmCompileVersion
in the Setup documentation).
Your plugin is automatically compiled and activated in that JOSM instance, if you didn't do that before.
Also all plugins that your plugin requires are automatically activated in that JOSM instance.
./gradlew cleanJosm
Deletes the JOSM_HOME
directories located at $projectDir/build/.josm/cache
, $projectDir/build/.josm/pref
and $projectDir/build/.josm/userdata
that are used for the task runJosm
.
There are also the more specialized tasks cleanJosmCache
, cleanJosmPref
and cleanJosmUserdata
to only delete the respective directory.
./gradlew debugJosm
The same as runJosm
, but this task has remote debugging over JDWP (Java Debug Wire Protocol) enabled and waits, until someone listens at the port specified in the Setup documentation.
This task fails if you have not specified, on which port you want to listen.
./gradlew compileJava_minJosm compileJava_testedJosm compileJava_latestJosm
These are three variants of the compileJava
task, which compile against special versions of JOSM:
- the minimum JOSM version that your plugin is compatible with, according to your manifest (see
josm.manifest.minJosmVersion
in the Setup documentation). - the JOSM version that is currently available for download as
josm-tested.jar
- the JOSM version that is currently available for download as
josm-latest.jar
./gradlew localDist
This task creates a 'plugin site' inside your build/localDist/
directory. Point any JOSM instance at the URL, that this task reports to you and you can "download" your plugin from your build/
directory into that JOSM instance.
The task runJosm
is the preferred (and easier) method to test drive your plugin, but in some circumstances you might not want to test in an isolated environment, but in your normal JOSM setup. If that's the case, this task is for you.
- In JOSM open
Edit
→Preferences
→Plugins
- Make sure the
expert mode
checkbox at the bottom left corner of the window is checked. - Click
Configure sites
(bottom right corner) - Click
Add
- Add the full absolute URL to the
build/localDist/list
file. It should be displayed at the very end of the log output of the task and include thefile:/
prefix, e.g.:file:/C:/my-josm-plugin/build/localDist/list
file:/home/username/my-josm-plugin/build/localDist/list
- Click
Ok
to confirm in both open dialogs - Click the
Download list
button in the bottom bar - Search for your plugin, and enable it using the checkbox
- Click
Ok
to close the preferences
./gradlew generatePot
This task extracts the translatable strings from your source code and writes them to the file $buildDir/po/josm-plugin_MyAwesomePlugin.pot
.
Note: You have to have
xgettext
installed on your machine in order for this task to work.