@@ -6,15 +6,44 @@ Quickly run Lucee CFML applications headless (without a HTTP server) via the com
66
77Please report any issues, etc in the [ Lucee Issue Tracker] ( https://luceeserver.atlassian.net/issues/?jql=labels%20%3D%20%22script-runner%22 )
88
9+ ## Project Structure
10+
11+ - ` build.xml ` - Main build file (always use this)
12+ - ` build-run-cfml.xml ` - Internal file (do not run directly)
13+ - ` action.yml ` - GitHub Action configuration
14+ - ` sample/ ` - Example CFML files for testing
15+
916## Command line Usage
1017
18+ ### Running from Different Directories
19+
20+ The script-runner can be used from any directory by specifying the build file location:
21+
22+ ``` bash
23+ # From the script-runner directory (simple)
24+ ant -Dwebroot=" /path/to/your/project" -Dexecute=" /yourscript.cfm"
25+
26+ # From your project directory (recommended for external projects)
27+ ant -buildfile=" /path/to/script-runner/build.xml" -Dwebroot=" ." -Dexecute=" /yourscript.cfm"
28+
29+ # From any directory with absolute paths
30+ ant -buildfile=" C:\tools\script-runner\build.xml" -Dwebroot=" C:\work\myproject" -Dexecute=" /test.cfm"
31+ ```
32+
33+ ** Key Points:**
34+ - ` -buildfile ` specifies where script-runner is installed
35+ - ` -Dwebroot ` is the directory containing your CFML code (can be relative to current directory)
36+ - ` -Dexecute ` is the CFML script to run (relative to webroot)
37+
38+ ### Basic Usage
39+
1140Default ` ant ` will run the ` sample/index.cfm ` file
1241
1342![ image] ( https://user-images.githubusercontent.com/426404/122402355-b0dbf980-cf7d-11eb-8837-37dec47d0713.png )
1443
1544You can specify:
1645
17- - Lucee version ` -DluceeVersion= ` default ` 6.0.3.1 ` , (ie. 6.3.0.1 , light-6.3.0.1 , zero-6.3.0.1 )
46+ - Lucee version ` -DluceeVersion= ` default ` 6.2.2.91 ` , (ie. 6.2.2.91 , light-6.2.2.91 , zero-6.2.2.91 )
1847- Lucee version by query ` -DluceeVersionQuery="5.4/stable/light ` ( optional overrides luceeVersion, (version)/(stable/rc/snapshot)/(jar,light/zero) )
1948- Webroot ` -Dwebroot= ` (default ` tests/ ` ) on Windows, avoid a trailing \ as that is treated as an escape character causes script runner to fail
2049- CFML Script to run, ` -Dexecute= ` (default ` /index.cfm ` )
@@ -26,16 +55,129 @@ You can specify:
2655- use a java debugger ` -Ddebugger="true" ` opens a java debugging port 5000, with suspend=y
2756- preCleanup ` -DpreCleanup="true" ` purges the Lucee working dir before starting
2857- postCleanup ` -DpostCleanup="true" ` purges the Lucee working dir after finishing
58+ - uniqueWorkingDir ` -DuniqueWorkingDir= ` supports three modes:
59+ - ` "false" ` (default): Uses standard ` temp/lucee ` directory
60+ - ` "true" ` : Auto-generates unique directory ` temp-unique/lucee-{VERSION}-{TIMESTAMP}-{RANDOM} `
61+ - ` "/custom/path" ` : Uses specified custom directory path
62+
63+ ` ant -DluceeVersion="6.2.2.91" -Dwebroot="C:\work\lucee-docs" -Dexecute="import.cfm" -Dlucee.extensions="" `
64+
65+ ` ant -DluceeVersion="6.2.2.91" -DextensionDir="C:\work\lucee-extensions\extension-hibernate\dist" `
66+
67+ ### Quick Reference Examples
68+
69+ ``` bash
70+ # Testing Lucee Spreadsheet from its directory
71+ cd D:\w ork\l ucee-spreadsheet
72+ ant -buildfile=D:\w ork\s cript-runner\b uild.xml -Dwebroot=. -Dexecute=/test/index.cfm
73+
74+ # Testing with specific Lucee version
75+ ant -buildfile=D:\w ork\s cript-runner\b uild.xml -DluceeVersionQuery=6.2/stable/jar -Dwebroot=D:\w ork\l ucee-spreadsheet -Dexecute=/test/index.cfm
76+
77+ # With unique working directory for concurrent runs
78+ ant -buildfile=D:\w ork\s cript-runner\b uild.xml -DuniqueWorkingDir=true -Dwebroot=D:\w ork\l ucee-spreadsheet -Dexecute=/test/index.cfm
79+ ```
80+
81+ ### Working Directory Behavior
82+
83+ ** Default Mode** (` uniqueWorkingDir=false ` or not specified):
84+ - Uses a consistent local ` temp/lucee ` directory relative to script-runner location
85+ - Same directory is reused across runs (cleaned with ` preCleanup ` /` postCleanup ` )
86+ - ** Ideal for CI/CD** : Predictable location, faster subsequent runs due to caching
87+ - ** Single instance only** : Cannot run multiple concurrent instances
88+
89+ ** Auto-Unique Mode** (` uniqueWorkingDir=true ` ):
90+ - Creates unique directories: ` temp-unique/lucee-{VERSION}-{TIMESTAMP}-{RANDOM} `
91+ - Each run gets its own isolated working directory
92+ - ** Enables concurrent execution** : Multiple instances can run simultaneously
93+ - ** Useful for** : Parallel testing, concurrent builds, isolation requirements
94+
95+ ** Custom Path Mode** (` uniqueWorkingDir=/custom/path ` ):
96+ - Uses your specified directory as the working directory
97+ - Full control over location (e.g., RAM disk, specific drive, shared folder)
98+ - ** Race protection** : Still checks for existing directory to prevent conflicts
99+ - ** Useful for** : Custom environments, performance optimization, specific storage requirements
100+
101+ ``` bash
102+ # Examples of the three modes:
103+ ant -DuniqueWorkingDir=false # Uses: temp/lucee
104+ ant -DuniqueWorkingDir=true # Uses: temp-unique/lucee-6.2.2.91-20250908-090047-669
105+ ant -DuniqueWorkingDir=C:/fast/work # Uses: C:/fast/work
106+ ```
29107
30- ` ant -DluceeVersion="6.0.0.95-SNAPSHOT" -Dwebroot="C:\work\lucee-docs" -Dexecute="import.cfm" -Dlucee.extensions="" `
108+ ### Concurrent Execution
109+
110+ Multiple script-runner instances can be run simultaneously using unique working directories:
111+
112+ ``` bash
113+ # Run multiple instances concurrently
114+ ant -DuniqueWorkingDir=" true" -Dexecute=" /test1.cfm" &
115+ ant -DuniqueWorkingDir=" true" -Dexecute=" /test2.cfm" &
116+ ant -DuniqueWorkingDir=" true" -Dexecute=" /test3.cfm" &
117+ wait
118+ ```
119+
120+ Each instance will use a unique working directory named ` temp-unique/lucee-{VERSION}-{TIMESTAMP}-{RANDOM} ` to prevent conflicts.
121+
122+ ## Troubleshooting
123+
124+ ### Common Issues on Windows
125+
126+ ** Problem** : Build fails with path-related errors
127+ ** Solution** : Avoid trailing backslashes in webroot paths:
128+ ``` bash
129+ # ❌ Wrong - trailing backslash causes escape issues
130+ ant -Dwebroot=" C:\work\myproject\"
131+
132+ # ✅ Correct - no trailing backslash
133+ ant -Dwebroot=" C:\w ork\m yproject"
134+ ant -Dwebroot=" C:/work/myproject/" # Forward slashes work too
135+ ` ` `
136+
137+ ** Problem** : " Could not locate build file" from other directories
138+ ** Solution** : Use absolute path to build.xml:
139+ ` ` ` bash
140+ # ❌ Wrong - looking for build.xml in current directory
141+ ant -Dwebroot=" ." -Dexecute=" /test.cfm"
142+
143+ # ✅ Correct - specify script-runner location
144+ ant -buildfile=" C:\t ools\s cript-runner\b uild.xml" -Dwebroot=" ." -Dexecute=" /test.cfm"
145+ ` ` `
146+
147+ ** Problem** : " File not found" for CFML scripts
148+ ** Solution** : Check webroot and execute paths:
149+ ` ` ` bash
150+ # Verify your paths - execute is relative to webroot
151+ ant -buildfile=" /path/to/script-runner/build.xml" -Dwebroot=" /your/project" -Dexecute=" /debug.cfm"
152+ ` ` `
153+
154+ ** Problem** : " No shell found" or quote/escape errors on Windows
155+ ** Solution** : Use proper quote formatting for Windows command line:
156+ ` ` ` bash
157+ # ❌ Wrong - excessive escaping or nested quotes
158+ ant -buildfile=\" d:\work\script-runner\" -Dwebroot=\" D:\work\project\"
159+
160+ # ✅ Correct - Windows Command Prompt (no quotes needed for paths without spaces)
161+ ant -buildfile=d:\work\script-runner\build.xml -Dwebroot=D:\work\project -Dexecute=/test.cfm
162+
163+ # ✅ Correct - Windows with spaces in paths (use quotes around entire parameter)
164+ ant " -buildfile=C:\P rogram Files\s cript-runner\b uild.xml" " -Dwebroot=C:\M y Projects\t est" -Dexecute=/test.cfm
165+
166+ # ✅ Correct - PowerShell (use single quotes to avoid variable expansion)
167+ ant -buildfile='d:\work\script-runner\build.xml' -Dwebroot='D:\work\project' -Dexecute='/test.cfm'
168+ ` ` `
31169
32- ` ant -DluceeVersion="6.0.0.95-SNAPSHOT" -DextensionDir="C:\work\lucee-extensions\extension-hibernate\dist" `
170+ ** Important Windows Tips:**
171+ - When using ` -buildfile` with a directory, add ` \build.xml` explicitly
172+ - Avoid escaped quotes (` \" ` ) - they' re usually not needed
173+ - Use forward slashes (`/`) or double backslashes (`\\`) in scripts to avoid escape issues
174+ - In batch files, use `%%` instead of `%` for variables
33175
34176If no webroot is specfied, you can run the provided debug script, to see which extensions are available and all the env / sys properties
35177
36178`ant -buildfile="C:\work\script-runner" -Dexecute="/debug.cfm"`
37179
38- ` ant -buildfile="C:\work\script-runner" -Dexecute="/debug.cfm" -DluceeVersion="light-6.0.0.95-SNAPSHOT " ` (` light ` has no bundled extensions, ` zero ` has no extension or admin)
180+ `ant -buildfile="C:\work\script-runner" -Dexecute="/debug.cfm" -DluceeVersion="light-6.2.2.91 "` (`light` has no bundled extensions, `zero` has no extension or admin)
39181
40182## As a GitHub Action
41183
@@ -72,6 +214,7 @@ To use as a GitHub Action, to run the PDF tests after building the PDF Extension
72214 debugger: true (optional) runs with java debugging enabled on port 5000
73215 preCleanup: true (purges Lucee working directory before starting)
74216 postCleanup: true (purges Lucee working directory after finishing)
217+ uniqueWorkingDir: true (optional) uses unique working directory for concurrent execution
75218 env:
76219 testLabels: pdf
77220 testAdditional: ${{ github.workspace }}/tests
@@ -108,5 +251,5 @@ pipelines:
108251 - git clone https://github.com/lucee/lucee
109252 - export testLabels="PDF"
110253 - echo $testLabels
111- - ant -buildfile script-runner/build.xml -DluceeVersion="light-6.0.0.152-SNAPSHOT " -Dwebroot="$BITBUCKET_CLONE_DIR/lucee/test" -DextensionDir="$BITBUCKET_CLONE_DIR/dist" -Dexecute="/bootstrap-tests.cfm" -DtestAdditional="$BITBUCKET_CLONE_DIR/tests"
254+ - ant -buildfile script-runner/build.xml -DluceeVersion="light-6.2.2.91 " -Dwebroot="$BITBUCKET_CLONE_DIR/lucee/test" -DextensionDir="$BITBUCKET_CLONE_DIR/dist" -Dexecute="/bootstrap-tests.cfm" -DtestAdditional="$BITBUCKET_CLONE_DIR/tests"
112255```
0 commit comments