Repository navigation
Expand file tree
/
Copy pathjustfile
More file actions
471 lines (386 loc) · 19.4 KB
/
Copy pathjustfile
File metadata and controls
471 lines (386 loc) · 19.4 KB
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
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
import? 'justfile.local'
set positional-arguments := true
home_dir := env_var('HOME')
# Introduction and Setup
# If homebrew is not installed, run the following command:
# /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)";
# If git is not installed run:
# brew install git
# clone this repository with
# git clone https://github.com/dotcms/core.git
# cd core
# just a tool for running commands defined in this file and provides useful aliases for common tasks
# you can also just use the commands listed below directly in your terminal
# To install "just", use "brew install just". Optionally, install the IntelliJ Plugin from https://plugins.jetbrains.com/plugin/18658-just. A cheatsheet is available at https://cheatography.com/linux-china/cheat-sheets/justfile/.
# You can then check the remaining dependencies with "just install-all-mac-deps"
# For all tests to run you need a license key. You can drop the license.dat file into ~/.dotcms/license/license.dat
# Test everything builds and reset your environment with "just build"
###########################################################
# Core Commands
###########################################################
# Lists all available commands in this justfile
default:
@just --list --unsorted --justfile {{ justfile() }}
# Builds the project without running tests, useful for quick iterations
build:
./mvnw -DskipTests clean install
# Builds the project without tests and disables Maven build cache
build-no-cache:
rm -rf ./core-web/.nx/
rm -rf ./core-web/.angular/
rm -rf ./core-web/node_modules/
rm -rf ./installs/node
./mvnw -DskipTests clean install -Dmaven.build.cache.enabled=false
# Builds the project without running tests, skip using docker or creating image
build-no-docker:
./mvnw -DskipTests clean install -Ddocker.skip
# Builds the project and runs the default test suite
build-test:
./mvnw clean install
# Performs a quick build, installing all modules to the local repository without running tests
build-quick:
./mvnw -DskipTests install
build-quicker:
./mvnw -pl :dotcms-core -DskipTests install
# Builds the project for production, skipping tests
build-prod:
./mvnw -DskipTests clean install -Pprod
# Builds core-web module
build-core-web:
./mvnw clean install -pl :dotcms-core-web -am -DskipTests
# Builds core-web module with Nx cache reset
build-core-web-reset-nx:
./mvnw clean install -pl :dotcms-core-web -am -DskipTests -Dnx.reset
# Builds core-web module with Nx cache reset
build-test-core-web:
./mvnw clean install -pl :dotcms-core-web -am
# Runs a comprehensive test suite including core integration and postman tests, suitable for final validation
build-test-full:
./mvnw clean install -Dcoreit.test.skip=false -Dpostman.test.skip=false
# Builds a specified module without its dependencies, defaulting to the core server (dotcms-core)
build-select-module module="dotcms-core":
./mvnw install -pl :{{ module }} -DskipTests=true
# Builds a specified module along with its required dependencies
build-select-module-deps module=":dotcms-core":
./mvnw install -pl {{ module }} --am -DskipTests=true
# Development Commands
dev-run:
./mvnw -pl :dotcms-core -Pdocker-start -Ddocker.glowroot.enabled=true
# Starts the dotCMS application in a Docker container on a dynamic port, running in the foreground
dev-run-debug:
./mvnw -pl :dotcms-core -Pdocker-start,debug
# Maps paths in the docker container to local paths, useful for development
dev-run-map-dev-paths:
./mvnw -pl :dotcms-core -Pdocker-start -Pmap-dev-paths
# Starts the dotCMS application in debug mode with suspension, useful for troubleshooting
dev-run-debug-suspend port="8082":
./mvnw -pl :dotcms-core -Pdocker-start,debug-suspend -Dtomcat.port={{ port }}
# Starts the dotCMS Docker container in the background
dev-start-on-port port="8082":
./mvnw -pl :dotcms-core -Pdocker-start -Dtomcat.port={{ port }}
# Starts the backend with fixed ports (8080 HTTP, 8443 HTTPS, 8090 management) for agentic/CI use
dev-run-fixed:
./mvnw -pl :dotcms-core -Pdocker-start \
-Dtomcat.port=8080 \
-Dtomcat.ssl.port=8443 \
-Dmanagement.port=8090
# Same as dev-run-fixed, plus OAUTH_ALLOW_INSECURE_URLS (for localhost callback URLs)
# and SecurityLogger at DEBUG so id_token validation failures are visible in the
# container logs.
dev-run-headless:
./mvnw -pl :dotcms-core -Pdocker-start \
-Dtomcat.port=8080 \
-Dtomcat.ssl.port=8443 \
-Dmanagement.port=8090 \
-Dext.default.context.name=dev \
-Dext.docker.dotcms-core.dev.dotcms.env.DOT_OAUTH_ALLOW_INSECURE_URLS=true \
-Dext.docker.dotcms-core.dev.dotcms.env.DOT_LOGGER_CATEGORY_LEVEL_SECURITYLOGGER=DEBUG
# Polls /dotmgt/readyz until dotCMS is ready or 20 retries (100s) expire
dev-wait-ready:
curl --retry 20 --retry-delay 5 --retry-connrefused \
-f http://localhost:8090/dotmgt/readyz
# Starts the Angular dev server on port 4200 in the background; logs to /tmp/angular-dev.log
serve-frontend:
cd core-web && yarn nx serve dotcms-ui --port 4200 > /tmp/angular-dev.log 2>&1 & echo $! > /tmp/angular-dev-server.pid
# Stops the Angular dev server started by serve-frontend
stop-frontend:
kill $(cat /tmp/angular-dev-server.pid) && rm /tmp/angular-dev-server.pid
# Stops the development Docker container
dev-stop:
./mvnw -pl :dotcms-core -Pdocker-stop
# Cleans up Docker volumes associated with the development environment
dev-clean-volumes:
./mvnw -pl :dotcms-core -Pdocker-clean-volumes
# Stops the headless-context containers started by dev-run-headless. Needed because
# those containers are named with context.name=dev, which the default dev-stop doesn't
# match, so plain dev-stop silently finds nothing.
dev-stop-headless:
./mvnw -pl :dotcms-core -Pdocker-stop \
-Dext.default.context.name=dev
# Cleans up the headless-context Docker volumes. Required before a fresh
# dev-run-headless if you want a new starter.zip to actually import — dotCMS only
# loads the starter on a fresh DB.
dev-clean-volumes-headless:
./mvnw -pl :dotcms-core -Pdocker-clean-volumes \
-Dext.default.context.name=dev
# Build frontend + backend delta, then replace just the dotCMS app container.
# DB + ES containers stay running so startup is fast and data is preserved.
reload-headless:
./mvnw install -pl :dotcms-core-web,:dotcms-core -am -DskipTests
docker stop dotbuild_dotcms-core_dev_dotcms && docker rm dotbuild_dotcms-core_dev_dotcms
./mvnw -pl :dotcms-core -Pdocker-start \
-Dtomcat.port=8080 \
-Dtomcat.ssl.port=8443 \
-Dmanagement.port=8090 \
-Dext.default.context.name=dev \
-Dext.docker.dotcms-core.dev.dotcms.env.DOT_OAUTH_ALLOW_INSECURE_URLS=true \
-Dext.docker.dotcms-core.dev.dotcms.env.DOT_LOGGER_CATEGORY_LEVEL_SECURITYLOGGER=DEBUG
# Nuke all caches and rebuild everything from scratch, then replace the dotCMS container.
# DB + ES stay running. Use when incremental builds can't be trusted.
full-reload-headless: build-no-cache
docker stop dotbuild_dotcms-core_dev_dotcms && docker rm dotbuild_dotcms-core_dev_dotcms
./mvnw -pl :dotcms-core -Pdocker-start \
-Dtomcat.port=8080 \
-Dtomcat.ssl.port=8443 \
-Dmanagement.port=8090 \
-Dext.default.context.name=dev \
-Dext.docker.dotcms-core.dev.dotcms.env.DOT_OAUTH_ALLOW_INSECURE_URLS=true \
-Dext.docker.dotcms-core.dev.dotcms.env.DOT_LOGGER_CATEGORY_LEVEL_SECURITYLOGGER=DEBUG
# Full reset for the headless stack: stop containers, wipe volumes, start fresh with
# whatever starter.zip is currently staged in dotCMS/target/starter/.
dev-reset-headless: dev-stop-headless dev-clean-volumes-headless dev-run-headless
# Starts the dotCMS application in a Tomcat container on port 8087, running in the foreground
dev-tomcat-run port="8087":
./mvnw -pl :dotcms-core -Ptomcat-run -Pdebug -Dservlet.port={{ port }}
dev-tomcat-stop:
./mvnw -pl :dotcms-core -Ptomcat-stop -Dcontext.name=local-tomcat
# Starts dotCMS with JMX monitoring enabled for connecting from localhost
dev-run-jmx:
./mvnw -pl :dotcms-core -Pdocker-start -Djmx.enable=true
# Starts dotCMS with JMX monitoring on custom ports
dev-run-jmx-ports jmx_port="9999" rmi_port="9998":
./mvnw -pl :dotcms-core -Pdocker-start -Djmx.enable=true -Djmx.port={{ jmx_port }} -Djmx.rmi.port={{ rmi_port }}
# Starts dotCMS with both JMX monitoring and debug enabled
dev-run-jmx-debug:
./mvnw -pl :dotcms-core -Pdocker-start,jmx-debug -Djmx.debug.enable=true
# Starts dotCMS with JMX, debug, and Glowroot profiler enabled
dev-run-jmx-debug-glowroot:
./mvnw -pl :dotcms-core -Pdocker-start,jmx-debug,glowroot -Djmx.debug.enable=true -Ddocker.glowroot.enabled=true
# Testing Commands
# Executes a specified set of Postman tests
test-postman collections='ai':
./mvnw -pl :dotcms-postman verify -Dpostman.test.skip=false -Pdebug -Dpostman.collections={{ collections }}
# Stops Postman-related Docker containers
postman-stop:
./mvnw -pl :dotcms-postman -Pdocker-stop -Dpostman.test.skip=false
# Median CI runtime of each MainSuite* across the most recent successful PR Check runs.
# New integration-test coverage goes in the suite this names, never in a remembered one.
# Usage: just suite-timings [SAMPLES] (default: 3, the documented minimum)
suite-timings samples='3':
.github/scripts/suite-timings/suite-timings.sh {{samples}}
# Runs all integration tests
test-integration:
./mvnw -pl :dotcms-integration verify -Dcoreit.test.skip=false
# Registers an integration test in a CI suite at its name-derived position (never append by hand)
# Usage: just add-it-test <TestClass> <Suite> e.g. `just add-it-test FooIntegrationTest MainSuite2a`
add-it-test test_class suite='':
python3 scripts/it-suites.py add {{ test_class }} {{ suite }}
# Runs only the open-search integration tests
test-integration-open-search:
./mvnw verify -pl :dotcms-integration -Dcoreit.test.skip=false -Dopensearch.upgrade.test=true
# Runs integration tests under an ES->OS migration phase (two separate clusters: ES + OS 3.x).
# With no TEST, runs the FULL MainSuite/Junit5 battery in a single JVM (one docker bring-up).
# Usage: just test-integration-phase [PHASE] [TEST] e.g. `just test-integration-phase 3 ContentletIndexAPIImplTest`
test-integration-phase phase='3' test='':
./mvnw verify -pl :dotcms-integration -Dcoreit.test.skip=false -Dopensearch.phase={{phase}} {{ if test == '' { '' } else { '-Dit.test=' + test } }}
# Runs the full integration battery under an ES->OS migration phase ONE SUITE AT A TIME
# (forkCount=1), so each suite yields an attributable pass/fail — mirrors the CI per-suite split
# and is the recommended way to triage what fails under a given phase. Each suite is a separate
# Maven run, so docker containers are restarted per suite; the loop continues past failures and
# prints a summary at the end (non-zero exit if any suite failed).
# Usage: just test-integration-phase-per-suite [PHASE] e.g. `just test-integration-phase-per-suite 1`
test-integration-phase-per-suite phase='3':
#!/usr/bin/env bash
set -uo pipefail
suites="MainSuite1a MainSuite1b MainSuite2a MainSuite2b MainSuite3a Junit5Suite1"
declare -a failed=()
for suite in $suites; do
echo "==================================================================="
echo ">>> Integration suite ${suite} under OpenSearch phase {{phase}}"
echo "==================================================================="
if ./mvnw verify -pl :dotcms-integration -Dcoreit.test.skip=false \
-Dopensearch.phase={{phase}} -Dit.test="${suite}" -Dit.test.forkcount=1; then
echo ">>> ${suite}: PASS"
else
echo ">>> ${suite}: FAIL"
failed+=("${suite}")
fi
done
echo "==================================================================="
echo ">>> Phase {{phase}} summary"
if [ ${#failed[@]} -eq 0 ]; then
echo ">>> ALL SUITES PASSED under phase {{phase}}"
else
echo ">>> FAILED SUITES under phase {{phase}}: ${failed[*]}"
exit 1
fi
# Suspends execution for debugging integration tests
test-integration-debug-suspend:
./mvnw -pl :dotcms-integration verify -Dcoreit.test.skip=false -Pdebug-suspend
# Just rebuild core and its deps without docker, e.g. pickup changes for it tests
build-core-with-deps:
./mvnw install -pl :dotcms-core --am -DskipTests -Ddocker.skip=true
# Just rebuild core without docker, e.g. pickup changes for it tests
build-core-only:
./mvnw install -pl :dotcms-core -DskipTests -Ddocker.skip=true
# Prepares the environment for running integration tests in an IDE
test-integration-ide:
./mvnw -pl :dotcms-integration pre-integration-test -Dcoreit.test.skip=false -Dopensearch.upgrade.test=true -Dtomcat.port=8080 -Dmaven.build.cache.enabled=false
# Stops integration test services
test-integration-stop:
./mvnw -pl :dotcms-integration -Pdocker-stop -Dcoreit.test.skip=false
test-postman-ide:
./mvnw -pl :dotcms-test-postman pre-integration-test -Dpostman.test.skip=false -Dtomcat.port=8080
# Executes Playwright E2E tests
# Removes any leftover container from compose or a previous run so Maven can create it
test-e2e:
./mvnw -pl :dotcms-ui-e2e verify -De2e.test.skip=false -De2e.test.env=ci -Dmaven.build.cache.skipCache=true
# Docker Commands
# Runs a published dotCMS Docker image on a dynamic port
docker-ext-run tag='latest':
./mvnw -pl :dotcms-core -Pdocker-start -Dcontext.name=ext-{{ tag }} -Ddotcms.image.name=dotcms/dotcms:{{ tag }}
# Runs a Docker image from a specific build for testing
docker-test-ext-run tag='main':
./mvnw -pl :dotcms-core -Pdocker-start -Dcontext.name=test-ext-{{ tag }} -Ddotcms.image.name=ghcr.io/dotcms/dotcms_test:{{ tag }}
# Stops a running Docker container based on the specified tag
docker-ext-stop tag='latest':
./mvnw -pl :dotcms-core -Pdocker-stop -Dcontext.name=ext-{{ tag }}
# Generate a cli uber-jar
cli-build-uber-jar:
./mvnw -pl :dotcms-cli package -DskipTests=true
cli-build-native: check-native-deps
#!/usr/bin/env bash
set -eo pipefail # Exit on error
source ${HOME}/.sdkman/bin/sdkman-init.sh # Load SDKMAN normally in you .bashrc or .zshrc
# The above is not required when running from your shell if you have SDKMAN in your .bashrc or .zshrc
sdk env install # ensure right version of java is downloaded and used for the branch
sdk install java 21.0.2-graalce # Does nothing if already installed
export GRAALVM_HOME=$(sdk home java 21.0.2-graalce) # Could be added to your .bashrc or .zshrc
./mvnw -pl :dotcms-cli -DskipTests -Pnative package
cli-build-test-native: check-native-deps
#!/usr/bin/env bash
set -eo pipefail
source ${HOME}/.sdkman/bin/sdkman-init.sh
# The above is not required when running from your shell if you have SDKMAN in your .bashrc or .zshrc
sdk env install # ensure right version of java is downloaded and used for the branch
sdk install java 21.0.2-graalce # Does nothing if already installed
export GRAALVM_HOME=$(sdk home java 21.0.2-graalce) # Env var Could be added to your .bashrc or .zshrc
./mvnw -pl :dotcms-cli -Pnative verify
run-built-cli *ARGS:
java -jar tools/dotcms-cli/cli/target/dotcms-cli-1.0.0-SNAPSHOT-runner.jar {{ARGS}}
run-java-cli-native *ARGS:
tools/dotcms-cli/cli/target/dotcms-cli-1.0.0-SNAPSHOT-runner {{ARGS}}
run-jmeter-tests:
./mvnw verify -Djmeter.test.skip=false -pl :dotcms-test-jmeter
###########################################################
# Useful Maven Helper Commands
###########################################################
# Generates a dependency tree for the compile scope and saves it to a file
maven-dependencies:
./mvnw dependency:tree -Dscope=compile > dependencies.txt
# Displays updates for project dependencies in a text file
maven-updates:
./mvnw versions:display-dependency-updates > updates.txt
# Checks for updates to project dependencies and prints to console
maven-check-updates:
./mvnw versions:display-dependency-updates
# Checks for updates to Maven plugins used in the project
maven-check-plugin-updates:
./mvnw versions:display-plugin-updates
# Checks for updates to properties defined in the pom.xml that control dependency versions
maven-property-updates:
./mvnw versions:display-property-updates
# Check if xcode is installed if on a mac. Only required for native builds
check-native-deps:
#!/usr/bin/env bash
set -eo pipefail
# Determine the operating system
OS=$(uname)
# Install dependencies based on the package manager
if [ "$OS" = "Linux" ]; then
if command -v apt-get >/dev/null; then
sudo apt-get update
sudo apt-get install -y build-essential libz-dev zlib1g-dev
elif command -v dnf >/dev/null; then
sudo dnf install -y gcc glibc-devel zlib-devel libstdc++-static
else
echo "Unsupported package manager. Please install the required packages manually. See https://quarkus.io/guides/building-native-image"
exit 1
fi
elif [ "$OS" = "Darwin" ]; then
if ! command -v xcode-select >/dev/null; then
echo "Xcode is not installed. Installing Xcode...";
xcode-select --install;
else
echo "Xcode is already installed.";
fi
else
echo "Unsupported operating system. Please install the required packages manually."
exit 1
fi
###########################################################
# Dependency Commands
###########################################################
# Installs all dependencies for the current project
install-all-mac-deps: install-jdk-mac check-docker-mac check-git-mac
# Installs SDKMAN for managing Java JDK versions
install-sdkman-mac:
@if [ -d "${HOME}/.sdkman/bin" ]; then \
echo "SDKMAN is already installed."; \
else \
echo "SDKMAN is not installed, installing now..."; \
curl -s "https://get.sdkman.io" | bash; \
source "${HOME}/.sdkman/bin/sdkman-init.sh"; \
fi
# Installs the latest version of Java JDK using SDKMAN
install-jdk-mac: install-sdkman-mac
#!/usr/bin/env bash
set -eo pipefail
source ~/.sdkman/bin/sdkman-init.sh
sdk env install java
# Checks if Docker is installed and running
check-docker-mac:
@if ! command -v docker >/dev/null; then \
echo "Docker is not installed."; \
echo "Install docker with : brew install docker --cask"; \
echo " or download from : https://docs.docker.com/get-docker/"; \
exit 1; \
else \
echo "Docker is installed."; \
if ! docker info >/dev/null 2>&1; then \
echo "Docker is not running ..."; \
exit 1; \
else \
echo "Docker is running."; \
fi; \
fi
check-git-mac:
@if ! command -v git >/dev/null; then \
echo "Git is not installed. Installing Git..."; \
brew install git; \
else \
git --version; \
echo "Git is already installed."; \
fi
###########################################################
# Skill Governance (see .claude/skills/CONTRIBUTING.md)
###########################################################
# Scaffold a new dot-<domain>-<action> skill (interactive; prompts + duplicate check)
new-skill *args:
@node .claude/tools/new-skill.mjs {{args}}
# Regenerate .claude/skills/CATALOG.md from skill frontmatter
skills-catalog:
@node .claude/tools/gen-skills-catalog.mjs
# Validate first-party skills (naming, frontmatter, catalog freshness) — same check CI runs
skills-lint:
@node .claude/tools/skill-lint.mjs