grails
配置
サーチ…
実行可能なJAR
Grails 3.xを配備する最も簡単な方法の1つは、サーブレットコンテナ(Tomcat、Undertowなど)をアプリケーションに埋め込む実行可能なjarファイルを構築することです。
build.gradle
変更する:
// Remove or comment out the war plugin:
// apply plugin:"war"
// Enable the executable jar:
springBoot {
executable = true
}
// Optional: Customize the jar properties:
// https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Jar.html
jar {
archiveName('myapp.jar')
}
./gradlew assemble
を使用して構築する
結果として得られたjarは起動可能な完全に実行可能なアプリケーションになりました:
$ head build/libs/myapp.jar
#!/bin/bash
#
# . ____ _ __ _ _
# /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
# ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
# \\/ ___)| |_)| | | | | || (_| | ) ) ) )
# ' |____| .__|_| |_|_| |_\__, | / / / /
# =========|_|==============|___/=/_/_/_/
# :: Spring Boot Startup Script ::
#
あなたは通常どんなコマンドラインアプリの場合と同じように起動することができます:
$ ./build/libs/myapp.jar Grails application running at http://localhost:8080 in environment: production
また、initサービスのように動作します。
$ ln -s /opt/myapp/myapp.jar /etc/init.d/myapp
$ service myapp [start|stop|status|restart]
詳細なドキュメントは、spring-bootのドキュメントの下にあります。http : //docs.spring.io/spring-boot/docs/current/reference/html/deployment-install.html
戦争のファイル作成
GrailsにWebアプリケーションを書くときには、アプリケーションをデプロイするために、サーブレットコンテナ(Tomcatなど)に置く必要がある「war」ファイルが必要です。
まずプロジェクトディレクトリに移動します:
cd to_project_directory
- コマンドプロンプトからの戦争ファイルの作成:
grails war
2.戦争の創造の前にあなたのアプリケーションをきれいにすることが常に推奨されます
コマンドプロンプトからのアプリケーションのクリーニング:
grails clean
上記の2つのステップを1つに組み合わせると、
grails clean && grails war
また、warファイルを作成する環境を指定することもできます。
grails [environment] war
ここで、 [environment]
はdev
、 prod
、 test
などの値を取ることができます。
他のコマンドとは異なり、warコマンドは開発環境ではなく、運用環境でデフォルトで実行されます。
Modified text is an extract of the original Stack Overflow Documentation
ライセンスを受けた CC BY-SA 3.0
所属していない Stack Overflow