0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Maven Archetype Pluginを直接使って、Nablarchのブランクプロジェクトを作成する(PowerShell版)

0
Posted at

What's?

この記事のPowerShell版です。

基本的にやることは同じなのですが、PowerShellで実行する時の注意点をメモしておきましょう、ということで。

Nablarchのブランクプロジェクト

Nablarchのブランクプロジェクトというのは、こちらのことですね。

Windowsバッチファイルを使った手順になっているのですが、この正体はMaven Archetype Pluginを使ったMavenプロジェクトの作成です。

ちなみにNablarch 6u1/5u24まではMaven Archetype Pluginのバージョンは2.4である必要があったのですが、今回はこのあたりのバージョンは無視します。

環境

今回の環境はこちらです。

PS > java --version
openjdk 21.0.10 2026-01-20 LTS
OpenJDK Runtime Environment Temurin-21.0.10+7 (build 21.0.10+7-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.10+7 (build 21.0.10+7-LTS, mixed mode, sharing)


PS > mvn --version
Apache Maven 3.9.12 (848fbb4bf2d427b72bdb2471c22fced7ebd9a7a1)
Maven home: C:\Users\user\AppData\Local\mise\installs\maven\3.9.12\apache-maven-3.9.12
Java version: 21.0.10, vendor: Eclipse Adoptium, runtime: C:\Users\user\AppData\Local\mise\installs\java\temurin-21.0.10+7.0.LTS
Default locale: ja_JP, platform encoding: UTF-8
OS name: "windows 11", version: "10.0", arch: "amd64", family: "windows"

Nablarchのアーキタイプの一覧を表示する

Nablarchのアーキタイプの一覧は、こちらのコマンドで確認できます。

PS > mvn archetype:generate `
  "-DarchetypeGroupId=com.nablarch.archetype" `
  "-Dfilter=nablarch" | Select-String nablarch-

1: remote -> com.nablarch.archetype:nablarch-batch-archetype (Nablarch Framework.)
2: remote -> com.nablarch.archetype:nablarch-batch-dbless-archetype (Nablarch Framework.)
3: remote -> com.nablarch.archetype:nablarch-batch-ee-archetype (Nablarch Framework.)
4: remote -> com.nablarch.archetype:nablarch-container-batch-archetype (Nablarch Framework.)
5: remote -> com.nablarch.archetype:nablarch-container-batch-dbless-archetype (Nablarch Framework.)
6: remote -> com.nablarch.archetype:nablarch-container-jaxrs-archetype (Nablarch Framework.)
7: remote -> com.nablarch.archetype:nablarch-container-web-archetype (Nablarch Framework.)
8: remote -> com.nablarch.archetype:nablarch-jaxrs-archetype (Nablarch Framework.)
9: remote -> com.nablarch.archetype:nablarch-web-archetype (Nablarch Framework.)

結果はこんな感じです。コマンド入力待ちになっているので、Ctrl-cで終了してください。

どのアーキタイプがどのアプリケーション処理方式に対応するかは省略します。

詳しく見たい場合は、こちらへ。

ブランクプロジェクトを生成する

ブランクプロジェクトを生成するコマンドも載せておきましょう。

非インタラクティブに作る場合はこんな感じですね。

PS > mvn archetype:generate `
  "-DinteractiveMode=false" `
  "-DarchetypeGroupId=com.nablarch.archetype" `
  "-DarchetypeArtifactId=[使用するNablarchのブランクプロジェクト用のアーキタイプ]" `
  "-DarchetypeVersion=[使用するNablarchのバージョン]" `
  "-DgroupId=[作成するプロジェクトのグループID]" `
  "-DartifactId=[生成するプロジェクトのアーティファクトID]" `
  "-Dversion=[生成するプロジェクトのバージョン]" `
  "-Dpackage=[生成するプロジェクトのパッケージ名]"

システムプロパティはクォートする必要があります。また継続行はバッククォートですね。

ウェブアプリケーションでの具体例。

PS > mvn archetype:generate `
  "-DinteractiveMode=false" `
  "-DarchetypeGroupId=com.nablarch.archetype" `
  "-DarchetypeArtifactId=nablarch-web-archetype" `
  "-DarchetypeVersion=6u3" `
  "-DgroupId=com.example" `
  "-DartifactId=hello-nablarch-web" `
  "-Dversion=0.0.1" `
  "-Dpackage=com.example"

生成時の情報。

[INFO] --- archetype:3.4.1:generate (default-cli) @ standalone-pom ---
[INFO] Generating project in Batch mode
[INFO] Archetype repository not defined. Using the one from [com.nablarch.archetype:nablarch-web-archetype:6] found in catalog remote
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Archetype: nablarch-web-archetype:6u3
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: com.example
[INFO] Parameter: artifactId, Value: hello-nablarch-web
[INFO] Parameter: version, Value: 0.0.1
[INFO] Parameter: package, Value: com.example
[INFO] Parameter: packageInPathFormat, Value: com/example
[INFO] Parameter: package, Value: com.example
[INFO] Parameter: groupId, Value: com.example
[INFO] Parameter: artifactId, Value: hello-nablarch-web
[INFO] Parameter: version, Value: 0.0.1
[INFO] Project created from Archetype in dir: C\hello-nablarch-web
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.159 s
[INFO] Finished at: 2026-02-22T10:00:21+09:00
[INFO] ------------------------------------------------------------------------

生成されたあとは、プロジェクト内のディレクトリに移動して作業を進めていきましょう。

PS > cd .\hello-nablarch-web\
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?