Initial Setup of the Nablarch Batch Project without DB connection¶
The following is procedures of initial setup of the Nablarch batch project without DB connection:
- Generate the Nablarch batch project without DB connection
- Confirm communications of the Nablarch batch project without DB connection
Overview of the generated project¶
The overview of the project generated by this procedure is as follows.
Item | Description |
---|---|
Project type | Maven project |
Project composition | Single project composition |
What is included in the generated project? | The following is included in the generated project:
|
For relationship with other projects and directories, see Maven Archetype Configuration.
Create blank project¶
Generate a blank project using the archetypes provided by Nablarch.
Execute the mvn command¶
Use Maven Archetype Plugin(external site) to generate a blank project.
Change the current directory to the directory where the blank project (can be any directory) is to be created.
Execute the following command.
mvn archetype:generate -DarchetypeGroupId=com.nablarch.archetype -DarchetypeArtifactId=nablarch-batch-dbless-archetype -DarchetypeVersion=6u2
The version of Nablarch used in the above command is 6u2. If you want to change the version, change the following parameters.
Set value | Description |
---|---|
archetypeVersion | Specify the version of the archetype you wish to use. (Nablarch 6u2 or later must be specified) |
Enter project information¶
When the above command is executed, you will be asked to enter the following information about the blank project to be generated.
Input item | Description | Configuration example |
---|---|---|
groupId | Group ID (normally, enter the package name) | com.example |
artifactId | Artifact ID | myapp-batch-dbless |
version | Version number | 0.1.0 |
package | Package (normally the same as group ID) | com.example |
Important
Item groupId and package are mapped to the Java package name. Use lowercase letters, numbers, and dots for these input values, and do not use hyphens.
When you have finished entering project information, Y: : will appear.
- Enter 「Y」 if you want to generate a template based on the information you have entered.
- Enter 「N」 if you wish to redo the project information entry.
If the command ends normally, a blank project is created under the current directory.
Communication confirmation (on-demand batch)¶
Automated test (on-demand batch)¶
The following unit tests are included in the project generated from the archetype.
Unit test classes | Test content |
---|---|
SampleBatchActionRequestTest | Use the Nablarch testing framework to check if the batch can be launched. |
Execute the unit test and confirm that the blank project was successfully generated.
Execute the following command.
cd myapp-batch-dbless
mvn test
If the execution is successful, the log given below will be output to the console.
(omitted)
[INFO] -------------------< com.example:myapp-batch-dbless >-------------------
[INFO] Building myapp-batch-dbless 0.1.0
[INFO] --------------------------------[ jar ]---------------------------------
(omitted)
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
(rest is omitted)
Launch test (on-demand batch)¶
The on-demand batch is included in the generated project.
Batch class | Details |
---|---|
SampleAction | Confirm communications of the Nablarch functions commonly used when implementing batch applications. |
Confirm that the blank project has been successfully generated by launching on-demand batch.
Build a batch application¶
If the current directory is not yet moved to the generated project, move the directory.
cd myapp-batch-dbless
Execute the following command to build the batch application.
mvn package
Launching the on-demand batch application¶
Execute the following command.
mvn exec:java -Dexec.mainClass=nablarch.fw.launcher.Main ^
-Dexec.args="'-diConfig' 'classpath:batch-boot.xml' '-requestPath' 'SampleBatch' '-userId' 'batch_user'"
If the launch is successful, the log given below will be output to the console.
2020-04-28 08:56:23.353 -INFO- com.example.SampleBatch [202004280856233530002] boot_proc = [] proc_sys = [batch] req_id = [SampleBatch] usr_id = [batch_user] 疎通確認を開始します。
2020-04-28 08:56:23.383 -INFO- com.example.SampleBatch [202004280856233530002] boot_proc = [] proc_sys = [batch] req_id = [SampleBatch] usr_id = [batch_user] 疎通確認が完了しました。
2020-04-28 08:56:23.396 -INFO- nablarch.fw.handler.MultiThreadExecutionHandler [202004280856233470001] boot_proc = [] proc_sys = [batch] req_id = [SampleBatch] usr_id = [batch_user]
Thread Status: normal end.
Thread Result:[200 Success] The request has succeeded.
2020-04-28 08:56:23.413 -INFO- nablarch.fw.launcher.Main [null] boot_proc = [] proc_sys = [batch] req_id = [null] usr_id = [null] @@@@ END @@@@ exit code = [0] execute time(ms) = [559]
Supplementary notes¶
For information on the method of confirming the data of H2 and tools included in the blank project, see Initial Setup Procedure Supplementary Information.