[ 
https://issues.apache.org/jira/browse/IGNITE-28073?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ashish Mishra updated IGNITE-28073:
-----------------------------------
    Description: 
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.

Background / Motivation:
The ai3tests framework imports the ignite-examples JAR and drives each example 
class as an automated test, invoking them via a shared runExample(...) utility:
java@Test
@DisplayName("Run ComputeRustJobExample")
public void testCompute*Example() {
    runExample(Compute*Example.class);
}
This pattern allows individual examples to be validated in a repeatable, 
CI-friendly way and forms the foundation for cyclic stability testing as well. 
For this to work reliably, examples must be executable directly via Gradle 
without requiring a manual build step beforehand — making this fix a 
prerequisite for stable automated test execution.

  *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.

  was:
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.

Background / Motivation:
The ai3tests framework imports the ignite-examples JAR and drives each example 
class as an automated test, invoking them via a shared runExample(...) utility:
java@Test
@DisplayName("Run ComputeRustJobExample")
@KnownIssue(Ign29553.class)
public void testComputeRustJobExample() {
    runExample(ComputeRustJobExample.class);
}
This pattern allows individual examples to be validated in a repeatable, 
CI-friendly way and forms the foundation for cyclic stability testing as well. 
For this to work reliably, examples must be executable directly via Gradle 
without requiring a manual build step beforehand — making this fix a 
prerequisite for stable automated test execution.

  *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.


> 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
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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.
> Background / Motivation:
> The ai3tests framework imports the ignite-examples JAR and drives each 
> example class as an automated test, invoking them via a shared 
> runExample(...) utility:
> java@Test
> @DisplayName("Run ComputeRustJobExample")
> public void testCompute*Example() {
>     runExample(Compute*Example.class);
> }
> This pattern allows individual examples to be validated in a repeatable, 
> CI-friendly way and forms the foundation for cyclic stability testing as 
> well. For this to work reliably, examples must be executable directly via 
> Gradle without requiring a manual build step beforehand — making this fix a 
> prerequisite for stable automated test execution.
>   *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)

Reply via email to