|
139 | 139 | <groupId>org.apache.maven.plugins</groupId>
|
140 | 140 | <artifactId>maven-antrun-plugin</artifactId>
|
141 | 141 | </plugin>
|
142 |
| - <plugin> |
143 |
| - <groupId>org.apache.maven.plugins</groupId> |
144 |
| - <artifactId>maven-antrun-plugin</artifactId> |
145 |
| - <version>1.7</version> |
146 |
| - <executions> |
147 |
| - <!-- Create the config file for artifact which can be used to deploy the artifact. |
148 |
| - Sets the parents field to system:cdap-etl-batch and system:cdap-etl-realtime with whatever |
149 |
| - version range is set in the etl.versionRange property. |
150 |
| - also sets a widget and doc property for each file contained in the widgets and docs directories. --> |
151 |
| - <execution> |
152 |
| - <id>create-artifact-config</id> |
153 |
| - <phase>prepare-package</phase> |
154 |
| - <configuration> |
155 |
| - <target> |
156 |
| - <script language="javascript"> <![CDATA[ |
157 |
| -
|
158 |
| - // for some reason, project.basedir evaluates to null if we just get the property here. |
159 |
| - // so we set main.basedir to project.basedir in the pom properties, then main.basedir is used here |
160 |
| - // where it evaluates correctly for whatever reason |
161 |
| - var baseDir = project.getProperty("main.basedir"); |
162 |
| - var targetDir = project.getProperty("project.build.directory"); |
163 |
| - var artifactId = project.getProperty("project.artifactId"); |
164 |
| - var version = project.getProperty("project.version"); |
165 |
| -
|
166 |
| - var cfgFile = new java.io.File(targetDir, artifactId + "-" + version + ".json"); |
167 |
| - if (!cfgFile.exists()) { |
168 |
| - cfgFile.createNewFile(); |
169 |
| - } |
170 |
| -
|
171 |
| - var etlRange = project.getProperty("etl.versionRange"); |
172 |
| - var config = { |
173 |
| - "parents": [ |
174 |
| - "system:wrangler-transform[1.0.0-SNAPSHOT, 10.0.0-SNAPSHOT]" |
175 |
| - ], |
176 |
| - "properties": {} |
177 |
| - } |
178 |
| -
|
179 |
| - // look in widgets directory for widget config for each plugin |
180 |
| - var widgetsDir = new java.io.File(baseDir, "widgets"); |
181 |
| - if (widgetsDir.isDirectory()) { |
182 |
| - var widgetsFiles = widgetsDir.listFiles(); |
183 |
| - for (i = 0; i < widgetsFiles.length; i++) { |
184 |
| - var widgetsFile = widgetsFiles[i]; |
185 |
| - if (widgetsFile.isFile()) { |
186 |
| - var propertyName = "widgets." + widgetsFile.getName(); |
187 |
| - // if the filename ends with .json |
188 |
| - if (propertyName.indexOf(".json", propertyName.length - 5) !== -1) { |
189 |
| - // strip the .json |
190 |
| - propertyName = propertyName.slice(0, -5); |
191 |
| - var contents = new java.lang.String(java.nio.file.Files.readAllBytes(widgetsFile.toPath()), java.nio.charset.StandardCharsets.UTF_8); |
192 |
| - var contentsAsJson = JSON.parse(contents); |
193 |
| - config.properties[propertyName] = JSON.stringify(contentsAsJson); |
194 |
| - } |
195 |
| - } |
196 |
| - } |
197 |
| - } |
198 |
| -
|
199 |
| - // look in the docs directory for docs for each plugin |
200 |
| - var docsDir = new java.io.File(baseDir, "docs"); |
201 |
| - if (docsDir.isDirectory()) { |
202 |
| - var docFiles = docsDir.listFiles(); |
203 |
| - for (i = 0; i < docFiles.length; i++) { |
204 |
| - var docFile = docFiles[i]; |
205 |
| - if (docFile.isFile()) { |
206 |
| - var propertyName = "doc." + docFile.getName(); |
207 |
| - // if the filename ends with .md |
208 |
| - if (propertyName.indexOf(".md", propertyName.length - 3) !== -1) { |
209 |
| - // strip the extension |
210 |
| - propertyName = propertyName.slice(0, -3); |
211 |
| - var contents = new java.lang.String(java.nio.file.Files.readAllBytes(docFile.toPath()), java.nio.charset.StandardCharsets.UTF_8); |
212 |
| - config.properties[propertyName] = contents + ""; |
213 |
| - } |
214 |
| - } |
215 |
| - } |
216 |
| - } |
217 |
| -
|
218 |
| - var fw = new java.io.BufferedWriter(new java.io.FileWriter(cfgFile.getAbsoluteFile())); |
219 |
| - fw.write(JSON.stringify(config, null, 2)); |
220 |
| - fw.close(); |
221 |
| - ]]></script> |
222 |
| - </target> |
223 |
| - </configuration> |
224 |
| - <goals> |
225 |
| - <goal>run</goal> |
226 |
| - </goals> |
227 |
| - </execution> |
228 |
| - </executions> |
229 |
| - </plugin> |
| 142 | + <plugin> |
| 143 | + <groupId>co.cask</groupId> |
| 144 | + <artifactId>cdap-maven-plugin</artifactId> |
| 145 | + <version>1.0.0-SNAPSHOT</version> |
| 146 | + <configuration> |
| 147 | + <cdapArtifacts> |
| 148 | + <parent>system:wrangler-transform[3.0.0,10.0.0)</parent> |
| 149 | + </cdapArtifacts> |
| 150 | + </configuration> |
| 151 | + <executions> |
| 152 | + <execution> |
| 153 | + <id>create-artifact-config</id> |
| 154 | + <phase>prepare-package</phase> |
| 155 | + <goals> |
| 156 | + <goal>create-plugin-json</goal> |
| 157 | + </goals> |
| 158 | + </execution> |
| 159 | + </executions> |
| 160 | + </plugin> |
230 | 161 | </plugins>
|
231 | 162 | </build>
|
232 | 163 |
|
|
0 commit comments