main
ROOT /
pages /
development-environment-setup.md
81 lines | ISO-8859-1 | 3 KB

Development Environment Setup


Eclipse based setup

Procedure

  1. Make sure you have JDK 11 installed

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

  3. Install Eclipse Oxygen or higher for Java development

  4. Create a new directory as Eclipse workspace. Let's assume it to be /home/robin/workspace

  5. Clone OneDev source code into a sub directory under Eclipse workspace:

    cd /home/robin/workspace
    git clone https://code.onedev.io/onedev/server onedev-server
    
  6. Run Eclipse and open workspace /home/robin/workspace

  7. Specify JDK instead of JRE as default. Otherwise, Eclipse will not be able to access Java sources to get help

    use-jdk-as-default.png

  8. Edit Maven preferences to check the option Hide folders of physically nested modules:

    maven-preference.png

  9. Import existing maven projects as below:

    import-maven-projects.png

    Import Workspace Projects

  10. Wait patiently for Eclipse to download necessary dependencies and build. In case there are compilation errors, update the projects as below:

    update-project.png

  11. After build succeeds, you may run OneDev as below:

    run-as-java-application.png

    select-bootstrap-class.png

Trouble Shooting

  1. In case there are compilation errors even if you've updated the project as described in step 11 above, run below from command line to make sure it succeeds:
cd /home/robin/workspace/onedev-server
mvn clean package

If it still does not work, most probably your network has some issues downloading dependencies. Otherwise go back to Eclipse, refresh and update all projects, then errors should go away.

  1. In case OneDev reports Unable to find product directory upon running. Please check launched configuration and make sure project is specified as server-product as below:

    Run Configuration Project

    If you still get the error, check if directory /home/robin/workspace/onedev-server/server-product/target/sandbox exists. This directory should be created automatically as long as compilation is successful in Eclipse

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
    
  6. Run the Boostrap class from ./server-product

    cd server-product
    mvn exec:java -Dexec.mainClass="io.onedev.commons.bootstrap.Bootstrap"
    
Please wait...
Page is in error, reload to recover