forked from data-integrations/sftp-actions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pom.xml
208 lines (201 loc) · 8.52 KB
/
pom.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright © 2020 Cask Data, Inc.
~
~ Licensed under the Apache License, Version 2.0 (the "License"); you may not
~ use this file except in compliance with the License. You may obtain a copy of
~ the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
~ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
~ License for the specific language governing permissions and limitations under
~ the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.cdap.plugin</groupId>
<artifactId>sftp-actions</artifactId>
<packaging>jar</packaging>
<version>1.6.0-SNAPSHOT</version>
<name>SFTP Actions</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<cdap.version>6.2.0</cdap.version>
<hydrator.version>2.4.0</hydrator.version>
<jsch.version>0.1.53</jsch.version>
<hadoop.version>2.3.0</hadoop.version>
<guava.version>19.0</guava.version>
<!-- properties for script build step that creates the config files for the artifacts -->
<widgets.dir>widgets</widgets.dir>
<docs.dir>docs</docs.dir>
<!-- This is the version range for the app.parents that this plugin is valid for. Usually this will correspond with
the CDAP version, but not always. -->
<etl.versionRange>[6.0.0-SNAPSHOT,7.0.0-SNAPSHOT)</etl.versionRange>
<!-- These are the application template artifacts that this plugin will be available for. -->
<app.parents>
system:cdap-data-pipeline,
system:cdap-data-streams
</app.parents>
<!-- this is here because project.basedir evaluates to null in the script build step -->
<main.basedir>${project.basedir}</main.basedir>
</properties>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>io.cdap.cdap</groupId>
<artifactId>cdap-etl-api</artifactId>
<version>${cdap.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.cdap.plugin</groupId>
<artifactId>hydrator-common</artifactId>
<version>${hydrator.version}</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>${jsch.version}</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
<version>${hadoop.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>create-artifact-config</id>
<phase>prepare-package</phase>
<configuration>
<target>
<script language="javascript"><![CDATA[
// for some reason, project.basedir evaluates to null if we just get the property here.
// so we set main.basedir to project.basedir in the pom properties, then main.basedir is used here
// where it evaluates correctly for whatever reason
var baseDir = project.getProperty("main.basedir");
var targetDir = project.getProperty("project.build.directory");
var artifactId = project.getProperty("project.artifactId");
var version = project.getProperty("project.version");
var cfgFile = new java.io.File(targetDir, artifactId + "-" + version + ".json");
if (!cfgFile.exists()) {
cfgFile.createNewFile();
}
var parents = project.getProperty("app.parents").split(",");
var parentVersions = project.getProperty("etl.versionRange");
var config = {
"parents": [ ],
"properties": {}
}
for (i = 0; i < parents.length; i++) {
config.parents.push(parents[i].trim() + parentVersions);
}
// look in widgets directory for widget config for each plugin
var widgetsDir = new java.io.File(baseDir, project.getProperty("widgets.dir"));
if (widgetsDir.isDirectory()) {
var widgetsFiles = widgetsDir.listFiles();
for (i = 0; i < widgetsFiles.length; i++) {
var widgetsFile = widgetsFiles[i];
if (widgetsFile.isFile()) {
var propertyName = "widgets." + widgetsFile.getName();
// if the filename ends with .json
if (propertyName.indexOf(".json", propertyName.length - 5) !== -1) {
// strip the .json
propertyName = propertyName.slice(0, -5);
var contents = new java.lang.String(java.nio.file.Files.readAllBytes(widgetsFile.toPath()), java.nio.charset.StandardCharsets.UTF_8);
var contentsAsJson = JSON.parse(contents);
config.properties[propertyName] = JSON.stringify(contentsAsJson);
}
}
}
}
// look in the docs directory for docs for each plugin
var docsDir = new java.io.File(baseDir, project.getProperty("docs.dir"));
if (docsDir.isDirectory()) {
var docFiles = docsDir.listFiles();
for (i = 0; i < docFiles.length; i++) {
var docFile = docFiles[i];
if (docFile.isFile()) {
var propertyName = "doc." + docFile.getName();
// if the filename ends with .md
if (propertyName.indexOf(".md", propertyName.length - 3) !== -1) {
// strip the extension
propertyName = propertyName.slice(0, -3);
var contents = new java.lang.String(java.nio.file.Files.readAllBytes(docFile.toPath()), java.nio.charset.StandardCharsets.UTF_8);
config.properties[propertyName] = contents + "";
}
}
}
}
var fw = new java.io.BufferedWriter(new java.io.FileWriter(cfgFile.getAbsoluteFile()));
fw.write(JSON.stringify(config, null, 2));
fw.close();
]]></script>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.5.4</version>
<extensions>true</extensions>
<configuration>
<instructions>
<_exportcontents>
io.cdap.*;
com.google.common.*;
com.jcraft.jsch.*
</_exportcontents>
<Embed-Dependency>*;inline=false;scope=compile</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
<Embed-Directory>lib</Embed-Directory>
</instructions>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>bundle</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>