88 lines
3.0 KiB
Markdown
88 lines
3.0 KiB
Markdown
---
|
|
sidebar_position: 2
|
|
title: "Java and Maven"
|
|
---
|
|
|
|
# Java and Maven
|
|
|
|
---
|
|
|
|
# Step 1 — Install Java SE Development Kit (JDK) 8
|
|
|
|
1. Download **JDK 8** from:
|
|
- [Gitea release assets](http://145.239.66.197:3000/othmane/team-resources/releases/tag/jdk-8u481-windows-x64)
|
|
- [Oracle's official archive](https://www.oracle.com/asean/java/technologies/javase/javase8u211-later-archive-downloads.html) if you have an account
|
|
2. Run the installer and complete the installation. Note the installation path (e.g., `C:\Program Files\Java\jdk1.8.0_xxx`).
|
|
3. Set the `JAVA_HOME` environment variable:
|
|
- Open **Start → Search → "Edit the system environment variables"**
|
|
- Click **Environment Variables**
|
|
- Under **System variables**, click **New**:
|
|
- Variable name: `JAVA_HOME`
|
|
- Variable value: `C:\Program Files\Java\jdk1.8.0_xxx` _(your actual JDK path)_
|
|
- Find the **`Path`** variable under System variables → click **Edit → New**, and add: `%JAVA_HOME%\bin`
|
|
- Click **OK** on all dialogs.
|
|
4. Open a **new** terminal window and verify:
|
|
|
|
```bash
|
|
java -version
|
|
javac -version
|
|
```
|
|
|
|
Both must return `1.8.x`. If `javac` is not found, `JAVA_HOME` or `PATH` was not set correctly.
|
|
|
|
---
|
|
|
|
# Step 2 — Install Apache Maven
|
|
|
|
1. Download Maven from: _(Download the **binary zip archive**)_
|
|
- [Gitea release assets](http://145.239.66.197:3000/othmane/team-resources/releases/tag/apache-maven-3.9.15-bin)
|
|
- [Apache](https://maven.apache.org/download.cgi)
|
|
2. Extract it to a stable path with no spaces (e.g., `C:\dev\maven`).
|
|
3. Set environment variables:
|
|
- Create a new system variable:
|
|
- Variable name: `MAVEN_HOME`
|
|
- Variable value: `C:\dev\maven` _(your extraction path)_
|
|
- Add `%MAVEN_HOME%\bin` to the **`Path`** system variable (same way as Step 1).
|
|
4. Open a **new** terminal and verify:
|
|
|
|
```bash
|
|
mvn -version
|
|
```
|
|
|
|
It should display the Maven version and confirm it is using your JDK 8.
|
|
|
|
---
|
|
|
|
# Step 3 — Configure Maven for the Private Gitea Registry
|
|
|
|
The TrizStock project has several legacy dependencies that are not available on Maven Central. They are hosted on the team's private Maven registry in Gitea. Without this configuration, your build will fail to resolve those dependencies.
|
|
|
|
1. Navigate to the Maven user settings file. If it does not exist, create it:
|
|
|
|
```text
|
|
C:\Users\YOUR_WINDOWS_USERNAME\.m2\settings.xml
|
|
```
|
|
|
|
2. Download the `settings.xml.template` from the team [resources repository](http://145.239.66.197:3000/othmane/team-resources/src/branch/main/_global/maven/settings.xml.template).
|
|
3. Copy the template content into your `settings.xml` and replace the placeholders with your actual Gitea credentials:
|
|
|
|
```xml
|
|
<settings>
|
|
<servers>
|
|
<server>
|
|
<id>gitea</id>
|
|
<username>othmane</username>
|
|
<password>54465f0ce0fec1a357eb7d9f7055e3df873db114</password>
|
|
</server>
|
|
</servers>
|
|
</settings>
|
|
```
|
|
|
|
Verify the registry is accessible by running the following in a terminal (once you have the project cloned — see Step 7):
|
|
|
|
```bash
|
|
mvn dependency:resolve
|
|
```
|
|
|
|
All dependencies, including the legacy ones, should resolve without errors.
|