Dropwizard官方示例

作者: 麻辣阁 分类: Java 发布时间: 2019-01-22 22:45

参考: https://www.dropwizard.io/1.3.8/docs/getting-started.html

D:\>mkdir helloworldDWProject

D:\>cd helloworldDWProject

D:\helloworldDWProject>mvn archetype:generate -DarchetypeGroupId=io.dropwizard.archetypes -DarchetypeArtifactId=java-simple -DarchetypeVersion=1.3.8

Define value for property 'groupId': xyz.mylog.dropwizard
Define value for property 'artifactId': helloword
Define value for property 'version' 1.0-SNAPSHOT: :
Define value for property 'package' xyz.mylog.dropwizard: : hellworld
[INFO] Using property: description = null
Define value for property 'name': HelloWorld
[INFO] Using property: shaded = true
Confirm properties configuration:
groupId: xyz.mylog.dropwizard
artifactId: helloword
version: 1.0-SNAPSHOT
package: hellworld
description: null
name: HelloWorld
shaded: true
 Y: :
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Archetype: java-simple:1.3.8
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: xyz.mylog.dropwizard
[INFO] Parameter: artifactId, Value: helloword
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: hellworld
[INFO] Parameter: packageInPathFormat, Value: hellworld
[INFO] Parameter: shaded, Value: true
[INFO] Parameter: package, Value: hellworld
[INFO] Parameter: groupId, Value: xyz.mylog.dropwizard
[INFO] Parameter: name, Value: HelloWorld
[INFO] Parameter: description, Value: null
[INFO] Parameter: artifactId, Value: helloword
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Project created from Archetype in dir: D:\helloworldDWProject\helloword
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  05:23 min
[INFO] Finished at: 2019-01-22T21:27:33+08:00
[INFO] ------------------------------------------------------------------------

这样就生成了项目框架, 在项目根目录有 pom.xml 的地方运行命令行, 执行 mvn clean install 下载依赖包.

用 IDEA 以项目形式打开顶层 pom.xml, 编辑各文件.

mvn clean install
java -jar target\helloword-1.0-SNAPSHOT.jar server config.yml

发表评论

电子邮件地址不会被公开。 必填项已用*标注