iartiukhov commented on code in PR #7122:
URL: https://github.com/apache/ignite-3/pull/7122#discussion_r2601428380


##########
examples/java/src/main/java/org/apache/ignite/example/serialization/AutoSerializableArg.java:
##########
@@ -1,5 +1,5 @@
 /*
- * Licensed to the Apache Software Foundation (ASF) under one or more
+ *Licensed to the Apache Software Foundation (ASF) under one or more

Review Comment:
   This line should not be changed



##########
examples/java/src/main/java/org/apache/ignite/example/code/deployment/AbstractDeploymentUnitExample.java:
##########
@@ -0,0 +1,57 @@
+package org.apache.ignite.example.code.deployment;

Review Comment:
   Please add the ASF license header as in other files. 



##########
examples/java/src/main/java/org/apache/ignite/example/util/DeployComputeUnit.java:
##########
@@ -0,0 +1,223 @@
+package org.apache.ignite.example.util;

Review Comment:
   Please add the ASF license header as in other files. 



##########
examples/java/src/main/java/org/apache/ignite/example/code/deployment/AbstractDeploymentUnitExample.java:
##########
@@ -0,0 +1,57 @@
+package org.apache.ignite.example.code.deployment;
+
+import java.io.IOException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Map;
+import org.apache.ignite.example.util.DeployComputeUnit;
+
+public class AbstractDeploymentUnitExample {
+
+    // Root path of ignite-examples/
+    protected static final Path projectRoot =
+            Paths.get("").toAbsolutePath();
+
+    // Compiled class output when running from IDE/CLI
+    protected static final Path DEFAULT_CLASSES_DIR =
+            projectRoot.resolve("examples/java/build/classes/java/main");
+
+    // Default JAR output
+    protected static final Path DEFAULT_JAR_PATH =
+            Path.of("build/libs/deploymentunit-example-1.0.0.jar");
+
+    protected static volatile String jarPathAsString = "";
+    protected static volatile Path jarPath = DEFAULT_JAR_PATH;
+    protected static volatile boolean runFromIDE = true;
+    // ---------------------------------------------------
+
+    /**
+     * Processes the deployment unit.
+     *
+     * @param args Arguments passed to the deployment process.
+     * @throws IOException if any error occurs.
+     */
+    protected static synchronized void processDeploymentUnit(String[] args)

Review Comment:
   What's the reason behind using the `synchronized` keyword? W do not execute 
several examples in parallel using more than one thread.



##########
examples/java/src/main/java/org/apache/ignite/example/code/deployment/CodeDeploymentExample.java:
##########
@@ -17,32 +17,105 @@
 
 package org.apache.ignite.example.code.deployment;
 
+import static org.apache.ignite.example.util.DeployComputeUnit.deployUnit;
+import static 
org.apache.ignite.example.util.DeployComputeUnit.deploymentExists;
+import static org.apache.ignite.example.util.DeployComputeUnit.undeployUnit;
+
 import org.apache.ignite.client.IgniteClient;
+import org.apache.ignite.compute.BroadcastJobTarget;
+import org.apache.ignite.compute.IgniteCompute;
 import org.apache.ignite.compute.JobDescriptor;
 import org.apache.ignite.compute.JobTarget;
 import org.apache.ignite.deployment.DeploymentUnit;
 
-public class CodeDeploymentExample {
+/**
+ * This example demonstrates the usage of the {@link 
IgniteCompute#execute(BroadcastJobTarget, JobDescriptor, Object)} API.
+ *
+ * <p>Find instructions on how to run the example in the {@code README.md}
+ * file located in the {@code examples} directory root.</p>
+ *
+ * <h2>Execution Modes</h2>
+ *
+ * <p>There are two modes of execution:</p>
+ *
+ * <h3>1. Automated : The JAR Deployment for  deployment unit is automated 
</h3>
+ *
+ * <h4>1.1 With IDE</h4>
+ * <ul>
+ *   <li>
+ *     <b>Run from an IDE</b><br>
+ *     Launch the example directly from the IDE. If the required deployment
+ *     unit is not present, the example automatically builds and deploys the
+ *     necessary JAR.
+ *   </li>
+ * </ul>
+ *
+ * <h3>1.2 Without IDE</h3>
+ * <ul>
+ *   <li>
+ *     <b>Run from the command line</b><br>
+ *     Start the example using a Java command where the classpath includes
+ *     all required dependencies:
+ *
+ *     <pre>{@code
+ * java -cp 
"{user.home}\\.m2\\repository\\org\\apache\\ignite\\ignite-core\\3.1.0-SNAPSHOT\\
+ * ignite-core-3.1.0-SNAPSHOT.jar{other required jars}"
+ * <example-main-class> runFromIDE=false jarPath="{path-to-examples-jar}"
+ *     }</pre>
+ *
+ *     In this mode, {@code runFromIDE=false} indicates command-line execution,
+ *     and {@code jarPath} must reference the examples JAR used as the
+ *     deployment unit.
+ *   </li>
+ * </ul>
+ *
+ * <h2>2. Manual (with IDE): The JAR deployment for the deployment unit is 
manual</h2>
+ *
+ * <p>Before running this example, complete the following steps related to
+ * code deployment:</p>
+ *
+ * <ol>
+ *   <li>
+ *     Build the {@code ignite-examples-x.y.z.jar} file:<br>
+ *     {@code ./gradlew :ignite-examples:jar}
+ *   </li>
+ *   <li>
+ *     Deploy the generated JAR as a deployment unit using the CLI:<br>
+ *     <pre>{@code
+ * cluster unit deploy computeExampleUnit \
+ *     --version 1.0.0 \
+ *     --path=$IGNITE_HOME/examples/build/libs/ignite-examples-x.y.z.jar
+ *     }</pre>
+ *   </li>
+ * </ol>
+ */
+
+
+public class CodeDeploymentExample extends AbstractDeploymentUnitExample {
 
     /** Deployment unit name. */
     private static final String DEPLOYMENT_UNIT_NAME = 
"codeDeploymentExampleUnit";
 
     /** Deployment unit version. */
     private static final String DEPLOYMENT_UNIT_VERSION = "1.0.0";
 
-    /**
-     * Main method of the example.
-     *
-     * @param args The command line arguments.
-     */
-    public static void main(String[] args) {
 
+    public static void main(String[] args) throws Exception {
+        processDeploymentUnit(args);
         System.out.println("\nConnecting to server...");
 
         try (IgniteClient client = 
IgniteClient.builder().addresses("127.0.0.1:10800").build()) {
 
             System.out.println("\nConfiguring compute job...");
 
+            if (deploymentExists(DEPLOYMENT_UNIT_NAME, 
DEPLOYMENT_UNIT_VERSION)) {

Review Comment:
   Here and everywhere: let's extract this code block to an utility method to 
avoid massive code duplication.



##########
examples/java/src/main/java/org/apache/ignite/example/compute/ComputeCancellationExample.java:
##########
@@ -29,42 +34,86 @@
 import org.apache.ignite.compute.JobExecutionContext;
 import org.apache.ignite.compute.JobTarget;
 import org.apache.ignite.deployment.DeploymentUnit;
+import org.apache.ignite.example.code.deployment.AbstractDeploymentUnitExample;
 import org.apache.ignite.lang.CancelHandle;
 import org.apache.ignite.lang.CancellationToken;
 
 /**
- * This example demonstrates the usage of the
- * {@link IgniteCompute#executeAsync(JobTarget, JobDescriptor, Object, 
CancellationToken)} API.
+ * This example demonstrates the usage of the {@link 
IgniteCompute#executeAsync(JobTarget, JobDescriptor, Object, 
CancellationToken)} API.
  *
- * <p>Find instructions on how to run the example in the README.md file 
located in the "examples" directory root.
+ * <p>Find instructions on how to run the example in the <code>README.md</code>
+ * file located in the "examples" directory root.</p>
+ *
+ * <h2>Execution Modes</h2>
+ *
+ * <p>There are two modes of execution:</p>
+ *
+ * <h3>1. Automated : The JAR Deployment for  deployment unit is automated 
</h3>
+ *
+ * <h4>1.1 With IDE</h4>
+ * <ul>
+ *     <li>
+ *         <b>Run from an IDE</b><br>
+ *         Launch the example directly from the IDE. If the required deployment
+ *         unit is not present, the example automatically builds and deploys 
the
+ *         necessary JAR.
+ *     </li>
+ * </ul>
+ *
+ * <h4>1.2 Without IDE</h4>
+ * <ul>
+ *     <li>
+ *         <b>Run from the command line</b><br>
+ *         Start the example using a Java command where the classpath includes 
all required
+ *         dependencies:<br>
+ *         {@code
+ *         java -cp 
"{user.home}\.m2\repository\org\apache\ignite\ignite-core\3.1.0-SNAPSHOT\
+ *         ignite-core-3.1.0-SNAPSHOT.jar{other required jars}"
+ *         <example-main-class> runFromIDE=false 
jarPath="{path-to-examples-jar}"}
+ *         <br>
+ *         In this mode, {@code runFromIDE=false} indicates command-line 
execution, and
+ *         {@code jarPath} must reference the examples JAR used as the 
deployment unit.
+ *     </li>
+ * </ul>
+ *
+ * <h3>2. Manual (with IDE) :  The JAR Deployment for  deployment unit is 
manual</h3>
+ *
+ * <p>Before running this example, complete the following steps related to
+ * code deployment:</p>
  *
- * <p>The following steps related to code deployment should be additionally 
executed before running the current example:
  * <ol>
  *     <li>
- *         Build "ignite-examples-x.y.z.jar" using the next command:<br>
+ *         Build the <code>ignite-examples-x.y.z.jar</code> file:<br>
  *         {@code ./gradlew :ignite-examples:jar}
  *     </li>
  *     <li>
- *         Create a new deployment unit using the CLI tool:<br>
- *         {@code cluster unit deploy computeExampleUnit \
- *          --version 1.0.0 \
- *          --path=$IGNITE_HOME/examples/build/libs/ignite-examples-x.y.z.jar}
+ *         Deploy the generated JAR as a deployment unit using the CLI:<br>
+ *         {@code
+ *         cluster unit deploy computeExampleUnit \
+ *         --version 1.0.0 \
+ *         --path=$IGNITE_HOME/examples/build/libs/ignite-examples-x.y.z.jar}
  *     </li>
  * </ol>
  */
-public class ComputeCancellationExample {
+
+public class ComputeCancellationExample  extends AbstractDeploymentUnitExample 
{
     /** Deployment unit name. */
     private static final String DEPLOYMENT_UNIT_NAME = "computeExampleUnit";
 
     /** Deployment unit version. */
     private static final String DEPLOYMENT_UNIT_VERSION = "1.0.0";
+    private static final Path JAR_PATH = 
Path.of("build/libs/codeDeploymentExampleUnit-1.0.0.jar"); // Output jar
 
     /**
      * Main method of the example.
      *
      * @param args The command line arguments.
+     * @throws Exception if any error occurs.
      */
-    public static void main(String[] args) {
+    public static void main(String[] args) throws Exception {
+
+        processDeploymentUnit(args);

Review Comment:
   Here and in all other examples where the specific JAR_PATH is used. The 
example does not work because this method builds a deployment JAR to the 
default path instead of the  `JAR_PATH` specified in the example.



##########
examples/java/src/main/java/org/apache/ignite/example/serialization/SerializationExample.java:
##########
@@ -17,19 +17,145 @@
 
 package org.apache.ignite.example.serialization;
 
+import static org.apache.ignite.example.util.DeployComputeUnit.deployUnit;
+import static 
org.apache.ignite.example.util.DeployComputeUnit.deploymentExists;
+import static org.apache.ignite.example.util.DeployComputeUnit.undeployUnit;
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import org.apache.ignite.client.IgniteClient;
+import org.apache.ignite.example.code.deployment.AbstractDeploymentUnitExample;
+import org.apache.ignite.example.util.DeployComputeUnit;
 
-public class SerializationExample {
+/**
+ * This example demonstrates the usage of the { @link 
IgniteCompute#executeAsync(JobTarget, JobDescriptor, Object)} API.
+ *
+ * <p>Find instructions on how to run the example in the {@code README.md}
+ * file located in the {@code examples} directory root.</p>
+ *
+ * <h2>Execution Modes</h2>
+ *
+ * <p>There are two modes of execution:</p>
+ *
+ * <h3>1. Automated : The JAR Deployment for  deployment unit is automated 
</h3>
+ *
+ * <h4>1.1 With IDE</h4>
+ * <ul>
+ *   <li>
+ *     <b>Run from an IDE</b><br>
+ *     Launch the example directly from the IDE. If the required deployment
+ *     unit is not present, the example automatically builds and deploys the
+ *     necessary JAR.
+ *   </li>
+ * </ul>
+ *
+ * <h3>1.2 Without IDE</h3>
+ * <ul>
+ *   <li>
+ *     <b>Run from the command line</b><br>
+ *     Start the example using a Java command where the classpath includes
+ *     all required dependencies:
+ *
+ *     <pre>{@code
+ * java -cp 
"{user.home}\\.m2\\repository\\org\\apache\\ignite\\ignite-core\\3.1.0-SNAPSHOT\\
+ * ignite-core-3.1.0-SNAPSHOT.jar{other required jars}"
+ * <example-main-class> runFromIDE=false jarPath="{path-to-examples-jar}"
+ *     }</pre>
+ *
+ *     In this mode, {@code runFromIDE=false} indicates command-line execution,
+ *     and {@code jarPath} must reference the examples JAR used as the
+ *     deployment unit.
+ *   </li>
+ * </ul>
+ *
+ * <h2>2. Manual (with IDE): The JAR deployment for the deployment unit is 
manual</h2>
+ *
+ * <p>Before running this example, complete the following steps related to
+ * code deployment:</p>
+ *
+ * <ol>
+ *   <li>
+ *     Build the {@code ignite-examples-x.y.z.jar} file:<br>
+ *     {@code ./gradlew :ignite-examples:jar}
+ *   </li>
+ *   <li>
+ *     Deploy the generated JAR as a deployment unit using the CLI:<br>
+ *     <pre>{@code
+ * cluster unit deploy computeExampleUnit \
+ *     --version 1.0.0 \
+ *     --path=$IGNITE_HOME/examples/build/libs/ignite-examples-x.y.z.jar
+ *     }</pre>
+ *   </li>
+ * </ol>
+ */
+
+public class SerializationExample extends AbstractDeploymentUnitExample {
+
+    private static final String DEPLOYMENT_UNIT_NATIVE = 
"nativeSerializationExampleUnit";
+    private static final String DEPLOYMENT_UNIT_CUSTOM = 
"customPojoSerializationExampleUnit";
+    private static final String DEPLOYMENT_UNIT_AUTO = 
"pojoAutoSerializationExampleUnit";
+    private static final String DEPLOYMENT_UNIT_TUPLE = 
"tupleSerializationExampleUnit";
+    private static final String VERSION = "1.0.0";
+    private static final Path JAR_PATH = 
Path.of("build/libs/serialization-example-1.0.0.jar"); // Output jar
 
     public static void main(String[] args) throws Exception {
         try (IgniteClient client = IgniteClient.builder()
                 .addresses("127.0.0.1:10800")
                 .build()) {
 
+            processDeploymentUnit(args);

Review Comment:
   This example does not work because the `processDeploymentUnit()` builds a 
JAR to the default path (`build/libs/deploymentunit-example-1.0.0.jar`), not to 
the path used by the example (`build/libs/serialization-example-1.0.0.jar`).



##########
examples/java/src/main/java/org/apache/ignite/example/serialization/AutoSerializableArg.java:
##########
@@ -13,21 +13,34 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *

Review Comment:
   This line should not be added.



##########
examples/java/src/main/java/org/apache/ignite/example/code/deployment/AbstractDeploymentUnitExample.java:
##########
@@ -0,0 +1,57 @@
+package org.apache.ignite.example.code.deployment;
+
+import java.io.IOException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Map;
+import org.apache.ignite.example.util.DeployComputeUnit;
+
+public class AbstractDeploymentUnitExample {
+
+    // Root path of ignite-examples/
+    protected static final Path projectRoot =
+            Paths.get("").toAbsolutePath();
+
+    // Compiled class output when running from IDE/CLI
+    protected static final Path DEFAULT_CLASSES_DIR =
+            projectRoot.resolve("examples/java/build/classes/java/main");
+
+    // Default JAR output
+    protected static final Path DEFAULT_JAR_PATH =
+            Path.of("build/libs/deploymentunit-example-1.0.0.jar");
+
+    protected static volatile String jarPathAsString = "";

Review Comment:
   The `volatile` keyword is not needed because we do not execute examples in 
parallel using more than one thread.



##########
examples/java/src/main/java/org/apache/ignite/example/compute/ComputeBroadcastExample.java:
##########
@@ -28,43 +36,89 @@
 import org.apache.ignite.compute.JobDescriptor;
 import org.apache.ignite.compute.JobExecutionContext;
 import org.apache.ignite.deployment.DeploymentUnit;
+import org.apache.ignite.example.code.deployment.AbstractDeploymentUnitExample;
 import org.apache.ignite.table.QualifiedName;
 
 /**
- * This example demonstrates the usage of the
- * {@link IgniteCompute#execute(BroadcastJobTarget, JobDescriptor, Object)} 
API.
+ * This example demonstrates the usage of the {@link 
IgniteCompute#execute(BroadcastJobTarget, JobDescriptor, Object)} API.
+ *
+ *
+ * <p>Find instructions on how to run the example in the {@code README.md}
+ * file located in the {@code examples} directory root.</p>
+ *
+ * <h2>Execution Modes</h2>
+ *
+ * <p>There are two modes of execution:</p>
+ *
+ * <h3>1. Automated : The JAR Deployment for  deployment unit is automated 
</h3>
  *
- * <p>Find instructions on how to run the example in the README.md file 
located in the "examples" directory root.
+ * <h4>1.1 With IDE</h4>
+ * <ul>
+ *   <li>
+ *     <b>Run from an IDE</b><br>
+ *     Launch the example directly from the IDE. If the required deployment
+ *     unit is not present, the example automatically builds and deploys the
+ *     necessary JAR.
+ *   </li>
+ * </ul>
  *
- * <p>This example is intended to be run on a cluster with more than one node 
to show that the job is broadcast to each node.
+ * <h3>1.2 Without IDE</h3>
+ * <ul>
+ *   <li>
+ *     <b>Run from the command line</b><br>
+ *     Start the example using a Java command where the classpath includes
+ *     all required dependencies:
+ *
+ *     <pre>{@code
+ * java -cp 
"{user.home}\\.m2\\repository\\org\\apache\\ignite\\ignite-core\\3.1.0-SNAPSHOT\\
+ * ignite-core-3.1.0-SNAPSHOT.jar{other required jars}"
+ * <example-main-class> runFromIDE=false jarPath="{path-to-examples-jar}"
+ *     }</pre>
+ *
+ *     In this mode, {@code runFromIDE=false} indicates command-line execution,
+ *     and {@code jarPath} must reference the examples JAR used as the
+ *     deployment unit.
+ *   </li>
+ * </ul>
+ *
+ * <h2>2. Manual (with IDE): The JAR deployment for the deployment unit is 
manual</h2>
+ *
+ * <p>Before running this example, complete the following steps related to
+ * code deployment:</p>
  *
- * <p>The following steps related to code deployment should be additionally 
executed before running the current example:
  * <ol>
- *     <li>
- *         Build "ignite-examples-x.y.z.jar" using the next command:<br>
- *         {@code ./gradlew :ignite-examples:jar}
- *     </li>
- *     <li>
- *         Create a new deployment unit using the CLI tool:<br>
- *         {@code cluster unit deploy computeExampleUnit \
- *          --version 1.0.0 \
- *          --path=$IGNITE_HOME/examples/build/libs/ignite-examples-x.y.z.jar}
- *     </li>
+ *   <li>
+ *     Build the {@code ignite-examples-x.y.z.jar} file:<br>
+ *     {@code ./gradlew :ignite-examples:jar}
+ *   </li>
+ *   <li>
+ *     Deploy the generated JAR as a deployment unit using the CLI:<br>
+ *     <pre>{@code
+ * cluster unit deploy computeExampleUnit \
+ *     --version 1.0.0 \
+ *     --path=$IGNITE_HOME/examples/build/libs/ignite-examples-x.y.z.jar
+ *     }</pre>
+ *   </li>
  * </ol>
  */
-public class ComputeBroadcastExample {
+public class ComputeBroadcastExample extends AbstractDeploymentUnitExample {
     /** Deployment unit name. */
     private static final String DEPLOYMENT_UNIT_NAME = "computeExampleUnit";
 
     /** Deployment unit version. */
     private static final String DEPLOYMENT_UNIT_VERSION = "1.0.0";
+    private static final Path JAR_PATH = 
Path.of("build/libs/codeDeploymentExampleUnit-1.0.0.jar"); // Output jar
 
     /**
      * Main method of the example.
      *
      * @param args The command line arguments.
+     * @throws Exception if any error occurs.
      */
-    public static void main(String[] args) {
+    public static void main(String[] args) throws Exception {
+
+        processDeploymentUnit(args);

Review Comment:
   The example does not work because this method builds a deployment JAR to the 
default path instead of the  `JAR_PATH` specified in the example.
   
   ```
   Caused by: java.nio.file.NoSuchFileException: 
build/libs/codeDeploymentExampleUnit-1.0.0.jar
   ```



##########
examples/java/src/main/java/org/apache/ignite/example/code/deployment/MyJob.java:
##########
@@ -68,4 +67,4 @@ public CompletableFuture<String> 
executeAsync(JobExecutionContext ctx, String ar
             throw new RuntimeException("Failed to run script", e);
         }
     }
-}
+}

Review Comment:
   Let's revert the file completely.



##########
examples/java/src/main/java/org/apache/ignite/example/compute/ComputeAsyncExample.java:
##########
@@ -32,40 +37,89 @@
 import org.apache.ignite.compute.JobExecutionContext;
 import org.apache.ignite.compute.JobTarget;
 import org.apache.ignite.deployment.DeploymentUnit;
+import org.apache.ignite.example.code.deployment.AbstractDeploymentUnitExample;
 
 /**
- * This example demonstrates the usage of the
- * {@link IgniteCompute#executeAsync(JobTarget, JobDescriptor, Object)} API.
+ * This example demonstrates the usage of the {@link 
IgniteCompute#executeAsync(JobTarget, JobDescriptor, Object)} API.
  *
- * <p>Find instructions on how to run the example in the README.md file 
located in the "examples" directory root.
  *
- * <p>The following steps related to code deployment should be additionally 
executed before running the current example:
+ * <p>Find instructions on how to run the example in the {@code README.md}
+ * file located in the {@code examples} directory root.</p>
+ *
+ * <h2>Execution Modes</h2>
+ *
+ * <p>There are two modes of execution:</p>
+ *
+ * <h3>1. Automated : The JAR Deployment for  deployment unit is automated 
</h3>
+ *
+ * <h4>1.1 With IDE</h4>
+ * <ul>
+ *   <li>
+ *     <b>Run from an IDE</b><br>
+ *     Launch the example directly from the IDE. If the required deployment
+ *     unit is not present, the example automatically builds and deploys the
+ *     necessary JAR.
+ *   </li>
+ * </ul>
+ *
+ * <h3>1.2 Without IDE</h3>
+ * <ul>
+ *   <li>
+ *     <b>Run from the command line</b><br>
+ *     Start the example using a Java command where the classpath includes
+ *     all required dependencies:
+ *
+ *     <pre>{@code
+ * java -cp 
"{user.home}\\.m2\\repository\\org\\apache\\ignite\\ignite-core\\3.1.0-SNAPSHOT\\
+ * ignite-core-3.1.0-SNAPSHOT.jar{other required jars}"
+ * <example-main-class> runFromIDE=false jarPath="{path-to-examples-jar}"
+ *     }</pre>
+ *
+ *     In this mode, {@code runFromIDE=false} indicates command-line execution,
+ *     and {@code jarPath} must reference the examples JAR used as the
+ *     deployment unit.
+ *   </li>
+ * </ul>
+ *
+ * <h2>2. Manual (with IDE): The JAR deployment for the deployment unit is 
manual</h2>
+ *
+ * <p>Before running this example, complete the following steps related to
+ * code deployment:</p>
+ *
  * <ol>
- *     <li>
- *         Build "ignite-examples-x.y.z.jar" using the next command:<br>
- *         {@code ./gradlew :ignite-examples:jar}
- *     </li>
- *     <li>
- *         Create a new deployment unit using the CLI tool:<br>
- *         {@code cluster unit deploy computeExampleUnit \
- *          --version 1.0.0 \
- *          --path=$IGNITE_HOME/examples/build/libs/ignite-examples-x.y.z.jar}
- *     </li>
+ *   <li>
+ *     Build the {@code ignite-examples-x.y.z.jar} file:<br>
+ *     {@code ./gradlew :ignite-examples:jar}
+ *   </li>
+ *   <li>
+ *     Deploy the generated JAR as a deployment unit using the CLI:<br>
+ *     <pre>{@code
+ * cluster unit deploy computeExampleUnit \
+ *     --version 1.0.0 \
+ *     --path=$IGNITE_HOME/examples/build/libs/ignite-examples-x.y.z.jar
+ *     }</pre>
+ *   </li>
  * </ol>
  */
-public class ComputeAsyncExample {
+
+public class ComputeAsyncExample extends AbstractDeploymentUnitExample {
     /** Deployment unit name. */
     private static final String DEPLOYMENT_UNIT_NAME = "computeExampleUnit";
 
     /** Deployment unit version. */
     private static final String DEPLOYMENT_UNIT_VERSION = "1.0.0";
+    private static final Path JAR_PATH = 
Path.of("build/libs/computeExampleUnit-1.0.0.jar"); // Output jar
 
     /**
      * Main method of the example.
      *
      * @param args The command line arguments.
+     * @throws Exception if any error occurs.
      */
-    public static void main(String[] args) throws ExecutionException, 
InterruptedException {
+    public static void main(String[] args) throws Exception {
+
+        processDeploymentUnit(args);

Review Comment:
   The example does not work because this method builds a deployment JAR to the 
default path instead of the  `JAR_PATH` specified in the example. Hence the 
following error arises:
   
   ```
   Caused by: java.nio.file.NoSuchFileException: 
build/libs/computeExampleUnit-1.0.0.jar
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to