Ashish Mishra created IGNITE-28073:
--------------------------------------
Summary: Examples fail with IllegalStateException when run
directly — deploymentUnitJar not built
Key: IGNITE-28073
URL: https://issues.apache.org/jira/browse/IGNITE-28073
Project: Ignite
Issue Type: Bug
Components: examples ai3
Reporter: Ashish Mishra
Assignee: Ashish Mishra
Running any example that requires a deployment unit directly via Gradle fails
with:
{color:#FF0000} *java.lang.IllegalStateException: Deployment unit JAR not
found at: .../examples/java/build/libs/deploymentunit-example-1.0.0.jar*{color}
Please build the project first: ./gradlew :ignite-examples:build
*Affected examples :*
- code/deployment/CodeDeploymentExample
- compute/ComputeAsyncExample
- compute/ComputeBroadcastExample
- compute/ComputeCancellationExample
- compute/ComputeColocatedExample
- compute/ComputeExample
- compute/ComputeJobPriorityExample
- compute/ComputeJobStateExample
- compute/ComputeMapReduceExample
- compute/ComputeWithCustomResultMarshallerExample
- compute/ComputeWithResultExample
- serialization/SerializationExample
- streaming/DistributedComputeWithReceiverExample
- streaming/MultiTableDataStreamerExample
*Root cause:* deploymentUnitJar was only wired into the build lifecycle.
Direct class execution via Gradle uses a JavaExec task that only depends on
classes, bypassing deploymentUnitJar.
*Steps to reproduce:*
*1.* Clone the repo without any prior build artifacts
*2.* Start a local 3-node Ignite cluster (just setup_cluster)
*3.* Run any affected example directly, e.g.:
_./gradlew :ignite-examples:ComputeJobPriorityExample.main()_
*4.* Observe IllegalStateException: Deployment unit JAR not found
+_Note:_+ The issue does not reproduce if ./gradlew :ignite-examples:build is
run first, as that triggers deploymentUnitJar explicitly.
*Fix:* Added to examples/java/build.gradle:
tasks.withType(JavaExec).configureEach {
dependsOn deploymentUnitJar
}
This ensures the deployment unit JAR is always built before any example class
is executed via Gradle, regardless of whether build was run first.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)