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

Development Environment Setup


Eclipse based setup

Procedure

  1. Make sure you have JDK 1.8 installed
  2. Make sure you have Git version 2.11.1 or higher installed
  3. Install Eclipse Oxygen or higher for Java development
  4. Install JavaScript development tools and web development tools from Eclipse menu Help/Install New Software like below:

    install_js_web_dev.png

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

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

    cd /home/robin/workspace
    git clone https://code.onedev.io/onedev-server
    
  7. Run Eclipse and open workspace /home/robin/workspace
  8. 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

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

    maven-preference.png

  10. Import existing maven projects as below:

    import-maven-projects.png


    Import Workspace Projects

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

    update-project.png

  12. 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.

  2. 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 1.8 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
    
  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.launcher.bootstrap.Bootstrap"
    
Please wait...
Page is in error, reload to recover