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?

【MyBatis Generator】GradleでサードパーティPluginやAntタスクを使わず実行

0
Posted at
  • Gradleタスクとしてjarを実行する方法
build.gradle.kts
// ~必要なものだけ抜粋~

configurations {
	// MyBatis Generatorの依存関係グループを定義
	create("mybatisGenerator")
}

dependencies {
	// mybatis-generator-coreを追加
	add("mybatisGenerator", "org.mybatis.generator:mybatis-generator-core:1.4.2")
    // ドライバも必要 (今回はPostgresQL)
	add("mybatisGenerator", "org.postgresql:postgresql")
}

// タスク定義
tasks.register<JavaExec>("mbGenerator") {
	classpath(configurations.getByName("mybatisGenerator"))
	mainClass.set("org.mybatis.generator.api.ShellRunner")
	args(
        "-configfile", "src/main/resources/mybatis/generatorConfig.xml",
        "-overwrite",
        "-verbose"
    )
}
  • ./gradlew mbGenerator を実行すればOK
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?