Skip to main content

Development Environment Setup

IntelliJ Based Setup

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

  2. Make sure you have Maven 3.6.3 or higher installed

  3. Install IntelliJ community/ultimate edition

  4. Clone OneDev source code into a directory. Assume it is ~/Projects/onedev/server:

    $ git clone https://code.onedev.io/onedev/server ~/Projects/onedev/server
  5. Run below command to install OneDev into local Maven repository:

    $ cd ~/Projects/onedev/server
    $ mvn clean install -Pce
  6. Start IntelliJ and open the folder ~/Projects/onedev/server. IntelliJ should prompt you whether or to trust folder ~/Projects/onedev. Trust it and IntelliJ should open it as a maven project with multiple modules

  7. Open project setting to check if Java sdk is 11. Normally IntelliJ can detect your JDK 11 installation automatically. In case it does not, manually specify the location

  8. Open the maven tool window, and hit the generate source and update folder for all projects icon like below:

  9. Create a configuration to run OneDev like below:

  10. Now you can run/debug OneDev via created configuration above

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:

CLI Based Setup

If you don't want to use Eclipse for any reason it is also possible to compile/run OneDev via CLI:

  1. Make sure you have JDK 11 installed

  2. Make sure you have Maven version 3.6.3 or higher installed

  3. Make sure you have Git version 2.11.1 or higher installed

  4. Clone OneDev source code

    git clone https://code.onedev.io/onedev/server onedev-server
  5. Run maven install from ./onedev-server

    cd onedev-server
    mvn install -Pce
  6. Run the Boostrap class from ./server-product

    cd server-product
    mvn exec:java -Dexec.mainClass="io.onedev.commons.bootstrap.Bootstrap"