teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

domaの情報を追加しました。

2021/12/20 02:12

投稿

akarin
akarin

スコア22

title CHANGED
File without changes
body CHANGED
@@ -22,6 +22,15 @@
22
22
 
23
23
  # Gradle task
24
24
  ```
25
+ dependencies {
26
+ implementation 'org.seasar.doma.boot:doma-spring-boot-starter:1.1.1'
27
+ implementation 'org.seasar.doma:doma:2.24.0'
28
+ annotationProcessor 'org.seasar.doma:doma:2.24.0'
29
+
30
+ domaGenRuntime 'org.seasar.doma:doma-gen:2.6.1'
31
+ domaGenRuntime 'mysql:mysql-connector-java'
32
+ }
33
+
25
34
  task gen {
26
35
  def rootPackageName = 'xxx.xxx.xxx'
27
36
  def daoPackagePath = 'xxx/xxx/xxx'

1

Gradle task について追加しました。

2021/12/20 02:12

投稿

akarin
akarin

スコア22

title CHANGED
File without changes
body CHANGED
@@ -18,4 +18,58 @@
18
18
  - Gradle reflesh でリビルド
19
19
 
20
20
  # 試したことなど
21
- linuxからSQLのカラムが変更済みなのは確認しました。
21
+ linuxからSQLのカラムが変更済みなのは確認しました。
22
+
23
+ # Gradle task
24
+ ```
25
+ task gen {
26
+ def rootPackageName = 'xxx.xxx.xxx'
27
+ def daoPackagePath = 'xxx/xxx/xxx'
28
+ def workDirPath = 'work'
29
+ def workDaoDirPath = "${workDirPath}/dao"
30
+
31
+ delete "${workDirPath}"
32
+ copy() {
33
+ from "${daoPackagePath}"
34
+ into "${workDaoDirPath}/org"
35
+ }
36
+
37
+ ant.taskdef(resource: 'domagentask.properties',
38
+ classpath: configurations.domaGenRuntime.asPath)
39
+ ant.gen(url: 'jdbc:mysql://xxx:0000/xxx'
40
+ , user: 'xxx'
41
+ , password: 'xxx'
42
+ ) {
43
+ entityConfig(packageName: "${rootPackageName}.entity.base", useListener: false)
44
+ daoConfig(packageName: "${rootPackageName}.dao.base")
45
+ sqlConfig()
46
+ }
47
+
48
+ copy() {
49
+ from "${daoPackagePath}"
50
+ into "${workDaoDirPath}/replace"
51
+ filter {
52
+ line -> line.replaceAll('import org.seasar.doma.Dao;', 'import org.seasar.doma.boot.ConfigAutowireable;\nimport org.seasar.doma.Dao;')
53
+ .replaceAll('@Dao', '@Dao\n@ConfigAutowireable')
54
+ }
55
+ }
56
+ copy() {
57
+ from "${workDaoDirPath}/replace"
58
+ into "${daoPackagePath}"
59
+ }
60
+ copy() {
61
+ from "${workDaoDirPath}/org"
62
+ into "${daoPackagePath}"
63
+ }
64
+ delete "${workDirPath}"
65
+ }
66
+
67
+ task copyDomaResources(type: Sync) {
68
+ from sourceSets.main.resources.srcDirs
69
+ into compileJava.destinationDir
70
+
71
+ include 'doma.compile.config'
72
+ include 'xxx/**/*.sql'
73
+ }
74
+
75
+ ```