質問編集履歴

2

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

2021/12/20 02:12

投稿

akarin
akarin

スコア22

test CHANGED
File without changes
test CHANGED
@@ -45,6 +45,24 @@
45
45
  # Gradle task
46
46
 
47
47
  ```
48
+
49
+ dependencies {
50
+
51
+ implementation 'org.seasar.doma.boot:doma-spring-boot-starter:1.1.1'
52
+
53
+ implementation 'org.seasar.doma:doma:2.24.0'
54
+
55
+ annotationProcessor 'org.seasar.doma:doma:2.24.0'
56
+
57
+
58
+
59
+ domaGenRuntime 'org.seasar.doma:doma-gen:2.6.1'
60
+
61
+ domaGenRuntime 'mysql:mysql-connector-java'
62
+
63
+ }
64
+
65
+
48
66
 
49
67
  task gen {
50
68
 

1

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

2021/12/20 02:12

投稿

akarin
akarin

スコア22

test CHANGED
File without changes
test CHANGED
@@ -39,3 +39,111 @@
39
39
  # 試したことなど
40
40
 
41
41
  linuxからSQLのカラムが変更済みなのは確認しました。
42
+
43
+
44
+
45
+ # Gradle task
46
+
47
+ ```
48
+
49
+ task gen {
50
+
51
+ def rootPackageName = 'xxx.xxx.xxx'
52
+
53
+ def daoPackagePath = 'xxx/xxx/xxx'
54
+
55
+ def workDirPath = 'work'
56
+
57
+ def workDaoDirPath = "${workDirPath}/dao"
58
+
59
+
60
+
61
+ delete "${workDirPath}"
62
+
63
+ copy() {
64
+
65
+ from "${daoPackagePath}"
66
+
67
+ into "${workDaoDirPath}/org"
68
+
69
+ }
70
+
71
+
72
+
73
+ ant.taskdef(resource: 'domagentask.properties',
74
+
75
+ classpath: configurations.domaGenRuntime.asPath)
76
+
77
+ ant.gen(url: 'jdbc:mysql://xxx:0000/xxx'
78
+
79
+ , user: 'xxx'
80
+
81
+ , password: 'xxx'
82
+
83
+ ) {
84
+
85
+ entityConfig(packageName: "${rootPackageName}.entity.base", useListener: false)
86
+
87
+ daoConfig(packageName: "${rootPackageName}.dao.base")
88
+
89
+ sqlConfig()
90
+
91
+ }
92
+
93
+
94
+
95
+ copy() {
96
+
97
+ from "${daoPackagePath}"
98
+
99
+ into "${workDaoDirPath}/replace"
100
+
101
+ filter {
102
+
103
+ line -> line.replaceAll('import org.seasar.doma.Dao;', 'import org.seasar.doma.boot.ConfigAutowireable;\nimport org.seasar.doma.Dao;')
104
+
105
+ .replaceAll('@Dao', '@Dao\n@ConfigAutowireable')
106
+
107
+ }
108
+
109
+ }
110
+
111
+ copy() {
112
+
113
+ from "${workDaoDirPath}/replace"
114
+
115
+ into "${daoPackagePath}"
116
+
117
+ }
118
+
119
+ copy() {
120
+
121
+ from "${workDaoDirPath}/org"
122
+
123
+ into "${daoPackagePath}"
124
+
125
+ }
126
+
127
+ delete "${workDirPath}"
128
+
129
+ }
130
+
131
+
132
+
133
+ task copyDomaResources(type: Sync) {
134
+
135
+ from sourceSets.main.resources.srcDirs
136
+
137
+ into compileJava.destinationDir
138
+
139
+
140
+
141
+ include 'doma.compile.config'
142
+
143
+ include 'xxx/**/*.sql'
144
+
145
+ }
146
+
147
+
148
+
149
+ ```