Skip to main content

Develop Standalone Plugins

Standalone plugins do not ship together with OneDev, and can be deployed to an existing OneDev installation separately. Follow below steps to develop a standalone plugin:

  1. Visit OneDev releases page, select appropriate release, switch to artifacts tab to download the OneDev plugin archetype package (server-plugin-archetype-<version>.zip)

  2. Make sure you have JDK 11 installed and available as default JDK in system path

  3. Make sure you have Maven 3.6.3 or higher installed

  4. Install IntelliJ community/ultimate edition

  5. Extract the plugin archetype package, open a terminal to change into extracted directory, and run mvn install to install the archetype to local Maven repository

  6. Run below command from terminal to generate OneDev plugin project:

    $ mvn archetype:generate -DarchetypeGroupId=io.onedev -DarchetypeArtifactId=server-plugin-archetype -DgroupId=com.example -DartifactId=myplugin -Dversion=1.0.0-SNAPSHOT -Dpackage=com.example.myplugin -DinteractiveMode=false
  7. Open generated project with IntelliJ, wait for project to be synced, and click generate sources and update folders for all projects from maven tool window:

  8. Create a launch configuration of type Application, give it a name, and specify main class as io.onedev.commons.bootstrap.Bootstrap. Leave all other settings untouched.

  9. Now you can add functionalities to your plugin and run/debug above configuration to see it in action

  10. To package the plugin after development, run mvn clean package under the plugin folder. A plugin zip will be created under the target directory, for instance com.example.myplugin-1.0.0-SNAPSHOT.zip. This zip contains plugin code and necessary dependencies. To deploy the plugin, copy the zip into site/lib folder of a OneDev installation (version should not be less than the version of the archetype you downloaded) and restart OneDev

caution
  1. Each time you reload/sync projects with POM (for instance when add extra dependencies to POM), you need to click the generate sources and update folders for all projects icon as shown above.

  2. OneDev uses Apache Wicket as web framework, and its html tags are unknown to IntelliJ. To prevent IntelliJ from complaining about this, consider turn off the unbound namespace prefix check like below: