Skip to content

Commit a157481

Browse files
docs: add Windows/WSL2 setup guide for local development (#206)
* docs: add Windows/WSL2 setup guide for local development * docs: address review feedback — add explanations, verification steps and Maven version variable * docs: add Windows/WSL2 setup guide link to root README.md --------- Co-authored-by: Bervianto Leo Pratama <[email protected]>
1 parent 955ea15 commit a157481

2 files changed

Lines changed: 201 additions & 0 deletions

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ For more details, see [docs/setup.md](docs/setup.md).
116116

117117
Development-related documentation can be found in the [`docs/`](docs/) directory.
118118

119+
- [Setup Guide](docs/setup.md)
120+
- [Windows/WSL2 Setup Guide](docs/windows-setup.md) — for contributors on Windows machines
121+
119122
## Contributing
120123

121124
Refer to our [contribution guidelines](https://github.com/jenkinsci/.github/blob/master/CONTRIBUTING.md)

docs/windows-setup.md

Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
# Windows/WSL2 Setup Guide for Local Development
2+
3+
This guide walks Windows users through setting up the Resources AI Chatbot Plugin
4+
for local development using WSL2 (Windows Subsystem for Linux).
5+
6+
For official WSL2 documentation, refer to:
7+
https://learn.microsoft.com/en-us/windows/wsl/install
8+
9+
## Prerequisites
10+
11+
- Windows 10 (build 19041+) or Windows 11
12+
- At least 8GB RAM recommended
13+
14+
## Step 1 — Install WSL2
15+
16+
Open PowerShell as Administrator and run:
17+
```powershell
18+
wsl --install
19+
```
20+
21+
This command installs WSL2 along with the default Ubuntu distribution.
22+
23+
**Restart your PC** after this completes.
24+
25+
After restart, Ubuntu will open automatically and ask you to create a username
26+
and password. Complete that setup before proceeding.
27+
28+
To verify WSL2 is installed correctly, open PowerShell and run:
29+
```powershell
30+
wsl --list --verbose
31+
```
32+
33+
Expected output:
34+
NAME STATE VERSION
35+
36+
Ubuntu Running 2
37+
38+
39+
Make sure VERSION shows 2. If it shows 1, run:
40+
```powershell
41+
wsl --set-version Ubuntu 2
42+
```
43+
44+
## Step 2 — Verify Ubuntu is Running
45+
46+
Before installing dependencies, confirm you are inside the Ubuntu terminal.
47+
Open the Ubuntu app from the Windows Start menu. Your prompt should look like:
48+
yourname@DESKTOP-XXXXX:~$
49+
50+
If you see `PS C:\Users\...` you are in PowerShell — close it and open Ubuntu instead.
51+
52+
## Step 3 — Install System Dependencies
53+
54+
Update the package list first:
55+
```bash
56+
sudo apt update
57+
```
58+
59+
Install the required build tools:
60+
```bash
61+
sudo apt install -y make cmake gcc g++ python3.11 python3.11-venv python3.11-dev
62+
```
63+
64+
Verify the installations:
65+
```bash
66+
# Verify cmake
67+
cmake --version
68+
69+
# Verify gcc
70+
gcc --version
71+
72+
# Verify Python 3.11
73+
python3.11 --version
74+
```
75+
76+
## Step 4 — Install Java 17
77+
78+
Install OpenJDK 17:
79+
```bash
80+
sudo apt install -y openjdk-17-jdk
81+
```
82+
83+
Verify Java is installed correctly:
84+
```bash
85+
java -version
86+
```
87+
88+
Expected output:
89+
openjdk version "17.x.x" ...
90+
91+
## Step 5 — Install Maven 3.9+
92+
93+
The default Maven from apt is too old (3.6.x). Install 3.9+ manually.
94+
95+
First, set the version as a variable so it only needs to be updated here if the
96+
version changes in the future:
97+
```bash
98+
MAVEN_VERSION=3.9.9
99+
```
100+
101+
Download Maven:
102+
```bash
103+
wget https://downloads.apache.org/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz
104+
```
105+
106+
Extract the archive:
107+
```bash
108+
tar -xzf apache-maven-${MAVEN_VERSION}-bin.tar.gz
109+
```
110+
111+
Move it to /opt:
112+
```bash
113+
sudo mv apache-maven-${MAVEN_VERSION} /opt/maven
114+
```
115+
116+
Add Maven to your PATH so it is available in every terminal session:
117+
```bash
118+
echo 'export PATH=/opt/maven/bin:$PATH' >> ~/.bashrc
119+
source ~/.bashrc
120+
```
121+
122+
Verify Maven and Java versions:
123+
```bash
124+
mvn -version
125+
```
126+
127+
Expected output:
128+
Apache Maven 3.9.x (...)
129+
Java version: 17.x.x
130+
131+
## Step 6 — Clone the Repository
132+
133+
Clone the repository inside WSL, not on the Windows filesystem:
134+
```bash
135+
cd ~
136+
git clone https://github.com/jenkinsci/resources-ai-chatbot-plugin.git
137+
cd resources-ai-chatbot-plugin
138+
```
139+
140+
> ⚠️ Do NOT clone into `/mnt/c/...` (your Windows drive). Always work inside
141+
> the WSL home directory (`~`) to avoid filesystem permission and performance issues.
142+
143+
## Step 7 — Run the Jenkins Plugin
144+
145+
Start Jenkins with the plugin loaded:
146+
```bash
147+
mvn hpi:run -Dchangelist=-SNAPSHOT -Dhost=0.0.0.0
148+
```
149+
150+
- `-Dchangelist=-SNAPSHOT` resolves the version variable in pom.xml
151+
- `-Dhost=0.0.0.0` binds Jenkins to all interfaces so it is reachable from Windows browser
152+
153+
Wait for this line before opening the browser:
154+
Jenkins is fully up and running
155+
156+
## Step 8 — Open Jenkins in Browser
157+
158+
Open a **second Ubuntu terminal** (leave the first one running Jenkins), then run:
159+
```bash
160+
explorer.exe "http://localhost:8080/jenkins"
161+
```
162+
163+
This opens your Windows browser pointing to the Jenkins instance running inside WSL.
164+
165+
## Common Errors and Fixes
166+
167+
### `Unknown packaging: hpi`
168+
[ERROR] Unknown packaging: hpi @ io.jenkins.plugins:resources-ai-chatbot:${changelist}
169+
170+
**Fix:** Pass the changelist flag explicitly:
171+
```bash
172+
mvn hpi:run -Dchangelist=-SNAPSHOT -Dhost=0.0.0.0
173+
```
174+
175+
### `version can neither be null, empty nor blank`
176+
177+
**Fix:** Do not use `-Dchangelist=` (empty value). Use `-Dchangelist=-SNAPSHOT` instead.
178+
179+
### `sudo is disabled on this machine`
180+
181+
You are in PowerShell, not WSL. Open the Ubuntu app from the Windows Start menu.
182+
183+
### `winget is not recognized`
184+
185+
Your Windows version may not have winget pre-installed. Use WSL2 instead
186+
rather than installing dependencies natively on Windows.
187+
188+
### Browser shows `ERR_EMPTY_RESPONSE` on `localhost:8080`
189+
190+
Make sure you started Jenkins with `-Dhost=0.0.0.0` and open the browser
191+
using `explorer.exe` from inside the WSL terminal, not from PowerShell.
192+
193+
## Notes
194+
195+
- Always run Maven and Git commands inside WSL, never in PowerShell
196+
- Keep the Jenkins terminal running while you work — do not press Enter
197+
accidentally as this triggers a redeploy
198+
- The repo must be cloned inside WSL (`~/`) not on the Windows filesystem (`/mnt/c/`)

0 commit comments

Comments
 (0)