ScriptsLab
WikiDownloadsSourcesSupport
ScriptsLab
DocumentationDownloadsGitHubDiscord

© 2026 ScriptsLab

Back to root
M

BUILD.md

Markdown · 418 lines · 7.3 KB

BUILD.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
# Building ScriptsLab

This guide explains how to build ScriptsLab from source.

## Prerequisites

### Required
- **Java Development Kit (JDK)**: 17 or higher
  - Download: [Adoptium](https://adoptium.net/) or [Oracle](https://www.oracle.com/java/technologies/downloads/)
- **Maven**: 3.6.0 or higher
  - Download: [Apache Maven](https://maven.apache.org/download.cgi)
- **Git**: For cloning the repository
  - Download: [Git](https://git-scm.com/downloads)

### Recommended
- **Java 21**: For best GraalVM JavaScript performance
- **IDE**: IntelliJ IDEA, Eclipse, or VS Code with Java extensions

## Quick Build

```bash
# Clone the repository
git clone https://github.com/scriptslab/scriptslab.git
cd scriptslab

# Build with Maven
mvn clean package

# The JAR will be in target/ScriptsLab-1.0.0.jar
```

## Detailed Build Steps

### 1. Clone the Repository

```bash
git clone https://github.com/scriptslab/scriptslab.git
cd scriptslab
```

### 2. Verify Java Version

```bash
java -version
```

You should see Java 17 or higher. If not, install JDK 17+ and set `JAVA_HOME`:

**Windows:**
```powershell
$env:JAVA_HOME = "C:\Path\To\JDK"
$env:PATH = "$env:JAVA_HOME\bin;$env:PATH"
```

**Linux/Mac:**
```bash
export JAVA_HOME=/path/to/jdk
export PATH=$JAVA_HOME/bin:$PATH
```

### 3. Build with Maven

**Standard build:**
```bash
mvn clean package
```

**Skip tests:**
```bash
mvn clean package -DskipTests
```

**Build with specific Java version:**
```bash
mvn clean package -Djava.version=17
```

### 4. Locate the JAR

The compiled JAR will be at:
```
target/ScriptsLab-1.0.0.jar
```

## Build Profiles

### Development Build
```bash
mvn clean package -Pdev
```
- Includes debug symbols
- Verbose logging
- No optimization

### Production Build
```bash
mvn clean package -Pprod
```
- Optimized bytecode
- Minimal logging
- Shaded dependencies

### Testing Build
```bash
mvn clean package -Ptest
```
- Runs all tests
- Generates coverage reports
- Includes test utilities

## Maven Goals

### Clean
```bash
mvn clean
```
Removes the `target/` directory.

### Compile
```bash
mvn compile
```
Compiles the source code.

### Test
```bash
mvn test
```
Runs unit tests.

### Package
```bash
mvn package
```
Creates the JAR file.

### Install
```bash
mvn install
```
Installs the JAR to your local Maven repository.

### Deploy
```bash
mvn deploy
```
Deploys the JAR to a remote repository (requires configuration).

## IDE Setup

### IntelliJ IDEA

1. **Import Project**
   - File → Open → Select `pom.xml`
   - Click "Open as Project"

2. **Set JDK**
   - File → Project Structure → Project
   - Set Project SDK to JDK 17+

3. **Build**
   - View → Tool Windows → Maven
   - Double-click `package` under Lifecycle

### Eclipse

1. **Import Project**
   - File → Import → Maven → Existing Maven Projects
   - Select the project directory

2. **Set JDK**
   - Right-click project → Properties → Java Build Path
   - Set JRE System Library to JDK 17+

3. **Build**
   - Right-click project → Run As → Maven build
   - Goals: `clean package`

### VS Code

1. **Open Project**
   - File → Open Folder → Select project directory

2. **Install Extensions**
   - Extension Pack for Java
   - Maven for Java

3. **Build**
   - Open Command Palette (Ctrl+Shift+P)
   - Run: "Maven: Execute commands"
   - Select: `clean package`

## Troubleshooting

### "Invalid target release: 17"

**Problem**: Maven is using an older Java version.

**Solution**:
```bash
# Check Maven's Java version
mvn -version

# Set JAVA_HOME to JDK 17+
export JAVA_HOME=/path/to/jdk17
```

### "Package org.graalvm.polyglot does not exist"

**Problem**: GraalVM dependencies not downloaded.

**Solution**:
```bash
# Force dependency download
mvn clean install -U
```

### "Cannot access com.scriptslab.api.module.Module"

**Problem**: Package declarations don't match file locations.

**Solution**:
```bash
# Clean and rebuild
mvn clean compile
```

### Build is Slow

**Problem**: Maven is downloading dependencies.

**Solution**:
```bash
# Use offline mode after first build
mvn clean package -o
```

### Out of Memory

**Problem**: Maven runs out of heap space.

**Solution**:
```bash
# Increase Maven memory
export MAVEN_OPTS="-Xmx2048m -XX:MaxPermSize=512m"
mvn clean package
```

## Dependencies

ScriptsLab uses the following dependencies:

### Provided (by server)
- **Paper API** 1.20.4 - Minecraft server API

### Included (shaded)
- **GraalVM Polyglot** 24.0.0 - JavaScript engine
- **GraalVM JS** 24.0.0 - JavaScript language implementation

All dependencies are automatically downloaded by Maven.

## Customizing the Build

### Change Java Version

Edit `pom.xml`:
```xml
<properties>
    <maven.compiler.source>17</maven.compiler.source>
    <maven.compiler.target>17</maven.compiler.target>
</properties>
```

### Change Paper Version

Edit `pom.xml`:
```xml
<dependency>
    <groupId>io.papermc.paper</groupId>
    <artifactId>paper-api</artifactId>
    <version>1.20.4-R0.1-SNAPSHOT</version>
    <scope>provided</scope>
</dependency>
```

### Add Dependencies

Edit `pom.xml`:
```xml
<dependencies>
    <!-- Your dependency here -->
    <dependency>
        <groupId>com.example</groupId>
        <artifactId>example-lib</artifactId>
        <version>1.0.0</version>
    </dependency>
</dependencies>
```

## Continuous Integration

### GitHub Actions

Create `.github/workflows/build.yml`:
```yaml
name: Build

on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Set up JDK 17
        uses: actions/setup-java@v3
        with:
          java-version: '17'
          distribution: 'temurin'
      - name: Build with Maven
        run: mvn clean package
      - name: Upload artifact
        uses: actions/upload-artifact@v3
        with:
          name: ScriptsLab
          path: target/ScriptsLab-*.jar
```

### Jenkins

Create `Jenkinsfile`:
```groovy
pipeline {
    agent any
    tools {
        maven 'Maven 3.8'
        jdk 'JDK 17'
    }
    stages {
        stage('Build') {
            steps {
                sh 'mvn clean package'
            }
        }
        stage('Archive') {
            steps {
                archiveArtifacts artifacts: 'target/*.jar'
            }
        }
    }
}
```

## Release Process

1. **Update Version**
   ```bash
   mvn versions:set -DnewVersion=1.1.0
   ```

2. **Build Release**
   ```bash
   mvn clean package -Pprod
   ```

3. **Create Tag**
   ```bash
   git tag -a v1.1.0 -m "Release 1.1.0"
   git push origin v1.1.0
   ```

4. **Upload to GitHub**
   - Go to Releases
   - Create new release
   - Upload `target/ScriptsLab-1.1.0.jar`

## Development Tips

### Fast Rebuild
```bash
# Only compile changed files
mvn compile
```

### Watch Mode
```bash
# Auto-rebuild on file changes (requires plugin)
mvn fizzed-watcher:run
```

### Debug Build
```bash
# Build with debug info
mvn clean package -Dmaven.compiler.debug=true
```

### Dependency Tree
```bash
# View all dependencies
mvn dependency:tree
```

### Update Dependencies
```bash
# Check for updates
mvn versions:display-dependency-updates
```

## Getting Help

- **Maven Issues**: [Maven Documentation](https://maven.apache.org/guides/)
- **Java Issues**: [Java Documentation](https://docs.oracle.com/en/java/)
- **Build Issues**: [GitHub Issues](https://github.com/scriptslab/scriptslab/issues)

---

**Happy Building! 🔨**