Development Environment Setup
Eclipse based setup
Procedure
-
Make sure you have JDK 11 installed
-
Make sure you have Git version 2.11.1 or higher installed
-
Install Eclipse Oxygen or higher for Java development
-
Create a new directory as Eclipse workspace. Let's assume it to be /home/robin/workspace
-
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
-
Run Eclipse and open workspace /home/robin/workspace
-
Specify JDK instead of JRE as default. Otherwise, Eclipse will not be able to access Java sources to get help
-
Edit Maven preferences to check the option Hide folders of physically nested modules:
-
Import existing maven projects as below:
-
Wait patiently for Eclipse to download necessary dependencies and build. In case there are compilation errors, update the projects as below:
-
After build succeeds, you may run OneDev as below:
Trouble Shooting
- 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.
-
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:
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:
-
Make sure you have JDK 11 installed
-
Make sure you have Maven version 3.6.3 or higher installed
-
Make sure you have Git version 2.11.1 or higher installed
-
Clone OneDev source code
git clone https://code.onedev.io/onedev/server onedev-server
-
Run maven install from
./onedev-server
cd onedev-server mvn install
-
Run the Boostrap class from
./server-product
cd server-product mvn exec:java -Dexec.mainClass="io.onedev.commons.bootstrap.Bootstrap"