Skip to content

Commit 1bb64fd

Browse files
committed
use javax or jakarta jars based on version
1 parent a25b652 commit 1bb64fd

File tree

9 files changed

+530
-46
lines changed

9 files changed

+530
-46
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ bin
44
logs
55
/temp-unique
66
/agent-tests
7+
/.claude
8+
/test-output

CHANGELOG.md

Lines changed: 67 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased]
99

1010
### Added
11+
1112
- **Local JAR Support**: Added `luceeJar` parameter to test locally built Lucee JARs without publishing
1213
- Accepts full path to a local JAR file
1314
- Overrides both `luceeVersion` and `luceeVersionQuery`
@@ -18,45 +19,106 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1819
- Custom path: Uses specified directory path
1920
- **Concurrent Execution Support**: Multiple script-runner instances can now run simultaneously without conflicts
2021
- **Race Condition Detection**: Automatic detection and prevention of directory conflicts
21-
- **Improved JFR Logging**:
22+
- **Improved JFR Logging**:
2223
- JFR files now output to organized `logs/` directory
2324
- Descriptive filenames: `timestamp-lucee-version-webroot-script-javaversion.jfr`
2425
- Added `logs/` to `.gitignore`
25-
- **Enhanced Error Messages**:
26+
- **Enhanced Error Messages**:
2627
- Git Bash path conversion detection with specific solutions
2728
- Execute script validation with exact file path shown
2829
- Windows trailing backslash validation
2930
- **Cross-Platform Path Handling**: Robust path concatenation logic for Windows and Unix systems
31+
- **Version Detection & Servlet API Handling**:
32+
- Automatic detection of Lucee 5/6 vs 7+ to select correct servlet dependencies
33+
- New `detect-version-type` target inspects version strings and JAR filenames
34+
- Split Maven pom files: `pom-javax.xml` (Lucee 5/6) and `pom-jakarta.xml` (Lucee 7+)
35+
- Seamless handling of javax to jakarta servlet API transition
36+
- Build target reordering so version detection happens before dependency resolution
37+
- **Java Agent Support**:
38+
- `-DjavaAgent=` - Path to Java agent JAR (profilers, debuggers like luceedebug)
39+
- `-DjavaAgentArgs=` - Arguments passed to the agent
40+
- `-Djdwp=` - Enable JDWP debugging agent with suspend=n (default: false)
41+
- `-DjdwpPort=` - JDWP port configuration (default: 9999)
42+
- Automatic `--add-opens=java.base/java.lang=ALL-UNNAMED` when using agents
43+
- **Advanced JVM Options**:
44+
- `-DjvmArgs=` - Raw JVM arguments string for custom configurations
45+
- `-DFlightRecordingSettings=` - JFR settings profile (default/profile/custom.jfc)
46+
- `-DPrintInlining=` - JVM compilation diagnostics (PrintInlining, PrintCompilation, UnlockDiagnosticVMOptions)
47+
- `-DPrintGCDetails=` - Detailed garbage collection logging
48+
- `-DUseEpsilonGC=` - Epsilon no-op garbage collector with AlwaysPreTouch for testing
49+
- **Version Query Format Enhancement**:
50+
- `luceeVersion` now accepts version query format (e.g., `7.0/stable/light`)
51+
- Maintains backward compatibility with `luceeVersionQuery` parameter
52+
- Unified version handling logic across both parameters
3053

3154
### Changed
32-
- **Updated Lucee Version**: Standardized all references to version 6.2.2.91 across codebase
55+
56+
- **Updated Lucee Version**: Standardized all references to version 7.0.1.100 across codebase
3357
- **JFR Filename Format**: Changed from `lucee-version.jar-javaversion.jfr` to descriptive format with timestamp and context
3458
- **Documentation**: Updated README.md with comprehensive working directory behavior explanations
59+
- **Build Process**:
60+
- Uncommented `include template` execution path in build-run-cfml.xml
61+
- Build target dependencies reordered: `detect-version-type` now runs before `setEnv`
62+
- Enhanced conditional property checking for javaAgent, jvmProperties, jvmArgs
63+
- Echo statements now show which servlet type is selected (javax vs jakarta)
64+
- **Error Handling**:
65+
- `_internalRequest` now captures and validates HTTP status codes
66+
- Non-200 status codes throw descriptive errors with LDEV-6086 reference
67+
- Better debugging information for script execution failures
3568

3669
### Fixed
70+
3771
- **File Path Validation Bug**: Fixed concatenation logic for execute script validation
3872
- **Git Bash Path Conversion Issues**: Added detection and helpful error messages for MSYS path conversion problems
3973
- **Build Script Path Resolution**: Fixed relative path issues when using unique working directories
74+
- **Request Timeout Detection**: Internal requests now properly detect and report non-200 status codes (LDEV-6086)
4075

4176
### Technical Details
4277

4378
#### New Ant Properties
79+
4480
- `uniqueWorkingDir`: Controls working directory behavior
4581
- `webroot.name`: Extracted basename of webroot for JFR filenames
4682
- `execute.clean`: Cleaned execute path (removes leading slashes) for JFR filenames
4783
- `execute.fullpath`: Properly concatenated full path for file validation
84+
- `javaAgent`: Path to Java agent JAR file
85+
- `javaAgentArgs`: Arguments passed to Java agent
86+
- `jdwp`: Enable JDWP debugging agent (suspend=n)
87+
- `jdwpPort`: JDWP port configuration (default: 9999)
88+
- `jvmArgs`: Raw JVM arguments string
89+
- `FlightRecordingSettings`: JFR settings profile configuration
90+
- `PrintInlining`: JVM compilation diagnostics flag
91+
- `PrintGCDetails`: Garbage collection logging flag
92+
- `UseEpsilonGC`: Epsilon no-op GC flag
93+
- `pom.file`: Dynamically selected pom file (pom-javax.xml or pom-jakarta.xml)
94+
- `version.major.extracted`: Extracted major version number for servlet API detection
95+
- `usesJavax`: Boolean flag indicating if javax servlet API is used (vs jakarta)
96+
- `servlet.type`: Servlet API type in use (javax or jakarta)
4897

4998
#### Build Process Improvements
99+
50100
- Added `set-unique-working-dir` target with timestamp generation and race condition checks
51101
- Enhanced `run-cfml` target with improved validation and path handling
52102
- Updated GitHub Actions workflow with concurrent execution tests
103+
- New `detect-version-type` target for automatic servlet API detection:
104+
- Parses version strings from `luceeVersion`, `luceeVersionQuery`, or `luceeJar` filename
105+
- Extracts major version number using regex
106+
- Selects appropriate pom file before dependency resolution
107+
- Supports various version formats: `7.0.0.1`, `lucee-7.0.jar`, `7/snapshot/zero`, file paths
108+
- Internal request result validation with status code checking
53109

54110
#### Error Handling
111+
55112
- Early validation of execute script existence under webroot
56113
- Specific error messages for common Git Bash issues
57114
- Clear guidance on workarounds and solutions
115+
- HTTP status code validation for internal requests (detects timeouts and failures)
58116

59117
### Migration Notes
60-
- Existing usage remains unchanged (backward compatible)
118+
119+
- Existing usage remains unchanged (fully backward compatible)
61120
- New JFR files will appear in `logs/` directory instead of project root
62-
- Git users should add `logs/` to their `.gitignore` if not already present
121+
- Git users should add `logs/` to their `.gitignore` if not already present
122+
- Lucee 5/6 and 7+ now use different servlet dependencies automatically (javax vs jakarta)
123+
- Version query format can now be used with `luceeVersion` parameter directly
124+
- All new parameters are optional and have sensible defaults

EXAMPLES.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ ant -DpreCleanup=false -DpostCleanup=false -Dwebroot=. -Dexecute=test.cfm
208208
```bash
209209
# Install extension from dist/ directory and run tests
210210
ant -buildfile=script-runner/build.xml \
211-
-DluceeVersion="6.2.2.91" \
211+
-DluceeVersion="7.0.1.100" \
212212
-Dwebroot="$BITBUCKET_CLONE_DIR/lucee/test" \
213213
-DextensionDir="$BITBUCKET_CLONE_DIR/dist" \
214214
-Dexecute="bootstrap-tests.cfm" \
@@ -300,5 +300,5 @@ pipelines:
300300
- git clone https://github.com/lucee/lucee
301301
- export testLabels="PDF"
302302
- echo $testLabels
303-
- 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"
303+
- ant -buildfile script-runner/build.xml -DluceeVersion="light-7.0.1.100" -Dwebroot="$BITBUCKET_CLONE_DIR/lucee/test" -DextensionDir="$BITBUCKET_CLONE_DIR/dist" -Dexecute="bootstrap-tests.cfm" -DtestAdditional="$BITBUCKET_CLONE_DIR/tests"
304304
```

README.md

Lines changed: 73 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ ant -buildfile "C:\tools\script-runner\build.xml" -Dwebroot="C:\work\myproject"
3737

3838
- `-buildfile` specifies where script-runner is installed
3939
- `-Dwebroot` is the directory containing your CFML code (can be relative to current directory)
40-
- `-Dexecute` is the CFML script to run (relative to webroot)
40+
- `-Dexecute` is the CFML script to run (relative to webroot, no leading slash required)
4141
- **Note:** The script-runner always normalizes the webroot to an absolute path internally, regardless of whether you pass a relative or absolute path. All output and script execution will use this normalized absolute path.
4242

4343
### Basic Usage
@@ -50,10 +50,22 @@ Default `ant` will run the `sample/index.cfm` file
5050

5151
#### Lucee Version
5252

53-
- `-DluceeVersion=` - Lucee version (default: `6.2.2.91`). Examples: `6.2.2.91`, `light-6.2.2.91`, `zero-6.2.2.91`
54-
- `-DluceeVersionQuery=` - Query-based version (optional, overrides luceeVersion). Format: `(version)/(stable/rc/snapshot)/(jar/light/zero)`. Example: `5.4/stable/light`
53+
Version Query Format: `(version)/(stable/rc/snapshot/lpha)/(jar/light/zero)`.
54+
55+
Examples:
56+
57+
- `7.0/stable/light`
58+
- `0/stable/jar`
59+
- `7.0.2/snapshot/zero`
60+
5561
- `-DluceeJar=` - Path to custom Lucee JAR (optional, overrides both luceeVersion and luceeVersionQuery). Example: `/full-path/to/lucee.jar`, but make sure you use the exact filename for the jar.
5662

63+
- `-DluceeVersion=` - Lucee version (default: `6.2.2.91`). Examples: `6.2.2.91`, `light-6.2.2.91`, `zero-6.2.2.91` or `7.0/stable/light`
64+
65+
**New** LuceeVersion now also handles Version Query format, `luceeVersionQuery` is still supported for backwards compat
66+
67+
- `-DluceeVersionQuery=` - Query-based version (optional, overrides luceeVersion).
68+
5769
#### Paths and Execution
5870

5971
- `-Dwebroot=` - Directory containing CFML code (default: `tests/`). On Windows, trailing backslashes (`\`) will be rejected with an error
@@ -85,8 +97,24 @@ These options are good for inspecting after a run, or setting up the `/lucee-ser
8597
- `-Ddebugger=` - Enable Java debugger on port 5000 with suspend=y (default: false)
8698
- `-DFlightRecording=` - Enable Java Flight Recorder profiling (default: false). Saves `.jfr` files to `logs/` directory
8799
- `-DFlightRecordingFilename=` - Custom output path for JFR recording file
100+
- `-DFlightRecordingSettings=` - JFR settings profile (default: `profile`). Options: `default`, `profile`, or path to custom `.jfc` file
88101
- `-DjfrExports=` - Add JFR module exports for Lucee JFR API access (default: false)
89102

103+
#### Java Agent Support
104+
105+
- `-DjavaAgent=` - Path to a Java agent JAR file (e.g., profilers, debuggers like luceedebug)
106+
- `-DjavaAgentArgs=` - Arguments passed to the agent (the part after `=` in `-javaagent:path=args`)
107+
- `-Djdwp=` - Enable JDWP debugging agent with suspend=n (default: false). Required for agents like luceedebug
108+
- `-DjdwpPort=` - JDWP port (default: 9999)
109+
110+
#### Advanced JVM Options
111+
112+
- `-DjvmProperties=` - Path to Java properties file to load additional JVM properties
113+
- `-DjvmArgs=` - Raw JVM arguments string (e.g., `"-Xmx64m -Xms32m"`)
114+
- `-DPrintGCDetails=` - Enable detailed garbage collection logging (default: false)
115+
- `-DUseEpsilonGC=` - Enable Epsilon no-op garbage collector for testing (default: false). Also enables AlwaysPreTouch
116+
- `-DPrintInlining=` - Enable JVM compilation diagnostics (default: false). Enables PrintInlining, PrintCompilation, and UnlockDiagnosticVMOptions
117+
90118
### Java Flight Recorder (JFR) Profiling
91119

92120
Enable JFR to capture detailed performance data during script execution:
@@ -136,6 +164,35 @@ jfr print --json logs/250101-120530-j21.jfr > output.json
136164

137165
The `jfr` command-line tool is included in the JDK bin directory. For visual analysis, use JDK Mission Control (JMC) or import into profiling tools.
138166

167+
### Java Agent Example (luceedebug)
168+
169+
To run with a Java agent like [luceedebug](https://github.com/softwareCobbler/luceedebug):
170+
171+
```bash
172+
ant -buildfile "D:\work\script-runner" ^
173+
-Djdwp="true" ^
174+
-DjdwpPort="9999" ^
175+
-DjavaAgent="D:\path\to\luceedebug-2.0.15.jar" ^
176+
-DjavaAgentArgs="jdwpHost=localhost,jdwpPort=9999,debugHost=0.0.0.0,debugPort=10000,jarPath=D:\path\to\luceedebug-2.0.15.jar" ^
177+
-Dwebroot="D:\my\cfml\app" ^
178+
-Dexecute="index.cfm"
179+
```
180+
181+
**Note:** The agent's `jarPath` argument must match the `-DjavaAgent` path exactly.
182+
183+
To profile luceedebug overhead with JFR:
184+
185+
```bash
186+
ant -buildfile "D:\work\script-runner" ^
187+
-Djdwp="true" ^
188+
-DjavaAgent="D:\path\to\luceedebug.jar" ^
189+
-DjavaAgentArgs="jdwpHost=localhost,jdwpPort=9999,debugHost=0.0.0.0,debugPort=10000,jarPath=D:\path\to\luceedebug.jar" ^
190+
-DFlightRecording="true" ^
191+
-DFlightRecordingFilename="D:\output\luceedebug-profile.jfr" ^
192+
-Dwebroot="." ^
193+
-Dexecute="benchmark.cfm"
194+
```
195+
139196
### TL;DR: Quoting & Paths (Stop Overthinking It)
140197

141198
**If your path has spaces, use quotes. If not, don’t.**
@@ -342,6 +399,19 @@ To use as a GitHub Action, to run the PDF tests after building the PDF Extension
342399
preCleanup: true (purges Lucee working directory before starting)
343400
postCleanup: true (purges Lucee working directory after finishing)
344401
uniqueWorkingDir: true (optional) uses unique working directory for concurrent execution
402+
FlightRecording: true (optional) enables Java Flight Recorder profiling
403+
FlightRecordingFilename: /path/to/output.jfr (optional) custom JFR output path
404+
FlightRecordingSettings: profile (optional) JFR settings profile (default/profile/custom.jfc)
405+
jfrExports: true (optional) adds JFR module exports for Lucee JFR API access
406+
javaAgent: /path/to/agent.jar (optional) Java agent JAR path
407+
javaAgentArgs: agent=args (optional) Java agent arguments
408+
jdwp: true (optional) enables JDWP debugging agent (suspend=n)
409+
jdwpPort: 9999 (optional) JDWP port (default: 9999)
410+
jvmProperties: /path/to/jvm.properties (optional) Java properties file path
411+
jvmArgs: "-Xmx64m -Xms32m" (optional) raw JVM arguments
412+
PrintGCDetails: true (optional) enables detailed GC logging
413+
UseEpsilonGC: true (optional) enables Epsilon no-op garbage collector
414+
PrintInlining: true (optional) enables JVM compilation diagnostics
345415
env:
346416
testLabels: pdf
347417
testAdditional: ${{ github.workspace }}/tests

action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ name: 'Lucee Script Runner'
22
description: 'Run Lucee via the command line'
33
inputs:
44
luceeVersion:
5-
description: Lucee Version to run, i.e. "light-6.2.2.91", "5.4.6.9", "zero-6.2.2.91"
5+
description: Lucee Version to run, i.e. "light-7.0.1.100", "5.4.6.9", "zero-6.2.4.24" or "7.0/snapshot/jar"
66
required: true
77
luceeVersionQuery:
8-
description: Lucee Version Query to run (overrides luceeVersion, i.e. "5.4/stable/light", "6.1/snapshot/jar", "6/stable/zero" )
8+
description: Lucee Version Query to run (overrides luceeVersion, i.e. "5.4/stable/light", "7.0/snapshot/jar", "6/stable/zero" ) for backwards compat, use luceeVersion instead
99
default: ""
1010
luceeJar:
1111
description: Full path to a local Lucee JAR file (overrides both luceeVersion and luceeVersionQuery)

build-run-cfml.xml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project default="all" basedir="." name="run-cfml">
3-
3+
44
<!-- Protection: This file should only be called from build.xml -->
55
<fail message="ERROR: build-run-cfml.xml should not be run directly! Use build.xml instead.">
66
<condition>
@@ -9,7 +9,7 @@
99
</not>
1010
</condition>
1111
</fail>
12-
12+
1313
<macrodef name="echots">
1414
<attribute name="message"/>
1515
<sequential>
@@ -173,12 +173,18 @@
173173
174174
try {
175175
if ( executeScriptByInclude eq "true"){
176-
//include template="#execute#";
176+
include template="#execute#";
177177
} else {
178-
_internalRequest(
178+
result = _internalRequest(
179179
template = execute,
180180
url = passedVariables
181-
); // using internal request runs the Application.cfc, pass any simple variables in as URLs
181+
); // using internal request runs the Application.cfc, pass any simple variables in as URLs
182+
183+
if (result.status_code != 200){
184+
failedRequest = "Error: Script threw [#result.status_code#], expected [200], possible request timeout? see LDEV-6086";
185+
systemOuput( failedRequest, true, true);
186+
throw "Error: Script threw [#result.status_code#], expected [200], possible request timeout? see LDEV-6086";
187+
}
182188
}
183189
} catch (e){
184190
request.errorThrown = true;

0 commit comments

Comments
 (0)