wrangler-transform
Used in:
components
- OverviewOverview
- VersionsVersions
- DependentsDependents
- DependenciesDependencies
<dependency> <groupId>co.cask.wrangler</groupId> <artifactId>wrangler-transform</artifactId> <version>3.0.2</version> </dependency>
<?xml version="1.0" encoding="UTF-8"?> <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/xsd/maven-4.0.0.xsd"> <parent> <artifactId>wrangler</artifactId> <groupId>co.cask.wrangler</groupId> <version>3.0.2</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>wrangler-transform</artifactId> <name>Wrangler Transform</name> <properties> <!-- properties for script budirectivestep that creates the config files for the artifacts --> <widgets.dir>widgets</widgets.dir> <docs.dir>docs</docs.dir> <app.parents>system:cdap-data-pipeline[4.2.0-SNAPSHOT,6.0.0-SNAPSHOT),system:cdap-data-streams[4.2.0-SNAPSHOT,6.0.0-SNAPSHOT)</app.parents> <!-- this is here because project.basedir evaluates to null in the script budirectivestep --> <main.basedir>${project.basedir}</main.basedir> </properties> <dependencies> <dependency> <groupId>co.cask.wrangler</groupId> <artifactId>wrangler-core</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>co.cask.cdap</groupId> <artifactId>cdap-api</artifactId> <version>${cdap.version}</version> <scope>provided</scope> </dependency> <dependency> <groupId>co.cask.cdap</groupId> <artifactId>cdap-etl-api</artifactId> <version>${cdap.version}</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>${guava.version}</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>${slf4j.version}</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>jcl-over-slf4j</artifactId> <version>${slf4j.version}</version> </dependency> <dependency> <groupId>co.cask.cdap</groupId> <artifactId>hydrator-test</artifactId> <version>${cdap.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>co.cask.cdap</groupId> <artifactId>cdap-unit-test</artifactId> <version>${cdap.version}</version> <scope>test</scope> <exclusions> <exclusion> <groupId>org.apache.hive</groupId> <artifactId>hive-exec</artifactId> </exclusion> <exclusion> <groupId>co.cask.cdap</groupId> <artifactId>cdap-explore-jdbc</artifactId> </exclusion> </exclusions> </dependency> </dependencies> <build> <pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <source>1.7</source> <target>1.7</target> </configuration> </plugin> <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> <version>2.3.7</version> <extensions>true</extensions> <configuration> <instructions> <Embed-Dependency>*;inline=false;scope=compile</Embed-Dependency> <Embed-Transitive>true</Embed-Transitive> <Embed-Directory>lib</Embed-Directory> <!--Only @Plugin classes in the export packages will be included as plugin--> <_exportcontents>co.cask.wrangler.*</_exportcontents> </instructions> </configuration> <executions> <execution> <phase>package</phase> <goals> <goal>bundle</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <version>1.7</version> <executions> <!-- Create the config file for artifact which can be used to deploy the artifact. Sets the parents field to system:cdap-etl-batch and system:cdap-etl-realtime with whatever version range is set in the etl.versionRange property. also sets a widget and doc property for each file contained in the widgets and docs directories. --> <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 config = { "parents": [ ], "properties": {} } for (i = 0; i < parents.length; i+=2) { // because name1[lo,hi],name2[lo,hi] gets split into "name1[lo", "hi]", "name2[lo", "hi]" // so we have to combine them again config.parents.push(parents[i] + "," + parents[i+1]); } // 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> </plugins> </pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.14.1</version> </plugin> <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> </plugin> </plugins> </build> <!-- Profile for release. Includes signing of jars. --> <profiles> <profile> <id>release</id> <build> <plugins> <!-- Source JAR --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <version>2.2.1</version> <configuration> <excludeResources>true</excludeResources> </configuration> <executions> <execution> <id>attach-sources</id> <phase>package</phase> <goals> <goal>jar-no-fork</goal> </goals> </execution> </executions> </plugin> <!-- Javadoc jar --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>2.9.1</version> <configuration> <links> <link>http://download.oracle.com/javase/${jee.version}/docs/api/</link> </links> <doctitle>${project.name} ${project.version}</doctitle> <bottom> <![CDATA[Copyright © {currentYear} <a href="http://cask.co" target="_blank">Cask Data, Inc.</a> Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License, Version 2.0</a>.]]> </bottom> </configuration> <executions> <execution> <id>attach-javadoc</id> <phase>package</phase> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> <plugin> <artifactId>maven-scm-plugin</artifactId> <version>1.9.5</version> <configuration> <tag>${project.artifactId}-${project.version}</tag> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-gpg-plugin</artifactId> <version>1.5</version> <configuration> <passphrase>${gpg.passphrase}</passphrase> <useAgent>${gpg.useagent}</useAgent> </configuration> <executions> <execution> <goals> <goal>sign</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </profile> </profiles> </project>