Add zip dist
This commit is contained in:
25
dataflow-website/recipes/file-ingest/file-to-jdbc/README.md
Normal file
25
dataflow-website/recipes/file-ingest/file-to-jdbc/README.md
Normal file
@@ -0,0 +1,25 @@
|
||||
File to JDBC Ingest Spring Batch Sample
|
||||
---
|
||||
|
||||
This project implements a Spring Batch job that reads from a CSV text file with lines formatted as `first_name,last_name` and writes each entry to a database table using a [JdbcBatchItemWriter](https://docs.spring.io/spring-batch/trunk/apidocs/org/springframework/batch/item/database/JdbcBatchItemWriter.html)] that executes `INSERT INTO people (first_name, last_name) VALUES (:firstName, :lastName)` for each line.
|
||||
|
||||
|
||||
## Build
|
||||
|
||||
### To run locally with an H2 database or with Cloud Foundry Java Buildpack to bind to a JDBC service:
|
||||
|
||||
```bash
|
||||
$ ./mvnw clean package
|
||||
```
|
||||
|
||||
### To run in Kubernetes (and add a Mariadb driver)
|
||||
|
||||
```bash
|
||||
$ ./mvnw clean package docker:build -Pkubernetes
|
||||
```
|
||||
|
||||
### To zip the source code and test data:
|
||||
|
||||
```bash
|
||||
$ ./mvnw clean package -Pdist
|
||||
```
|
||||
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
<?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">
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>io.spring.cloud.dataflow.ingest</groupId>
|
||||
<artifactId>ingest</artifactId>
|
||||
@@ -49,21 +49,63 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>kubernetes</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mariadb.jdbc</groupId>
|
||||
<artifactId>mariadb-java-client</artifactId>
|
||||
<version>2.3.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>kubernetes</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mariadb.jdbc</groupId>
|
||||
<artifactId>mariadb-java-client</artifactId>
|
||||
<version>2.3.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>dist</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<configuration>
|
||||
<tasks>
|
||||
<copy file="target/${project.artifactId}-${project.version}.zip"
|
||||
tofile="file-to-jdbc.zip" overwrite="true"/>
|
||||
</tasks>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>prepare-package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/assembly.xml</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
<build>
|
||||
<plugins>
|
||||
@@ -84,33 +126,33 @@
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>io.fabric8</groupId>
|
||||
<artifactId>docker-maven-plugin</artifactId>
|
||||
<version>0.14.2</version>
|
||||
<configuration>
|
||||
<images>
|
||||
<image>
|
||||
<name>${docker.org}/${project.artifactId}</name>
|
||||
<build>
|
||||
<from>springcloud/openjdk</from>
|
||||
<volumes>
|
||||
<volume>/tmp</volume>
|
||||
</volumes>
|
||||
<entryPoint>
|
||||
<exec>
|
||||
<arg>java</arg>
|
||||
<arg>-jar</arg>
|
||||
<arg>/maven/ingest.jar</arg>
|
||||
</exec>
|
||||
</entryPoint>
|
||||
<assembly>
|
||||
<descriptor>assembly.xml</descriptor>
|
||||
</assembly>
|
||||
</build>
|
||||
</image>
|
||||
</images>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<groupId>io.fabric8</groupId>
|
||||
<artifactId>docker-maven-plugin</artifactId>
|
||||
<version>0.14.2</version>
|
||||
<configuration>
|
||||
<images>
|
||||
<image>
|
||||
<name>${docker.org}/${project.artifactId}</name>
|
||||
<build>
|
||||
<from>springcloud/openjdk</from>
|
||||
<volumes>
|
||||
<volume>/tmp</volume>
|
||||
</volumes>
|
||||
<entryPoint>
|
||||
<exec>
|
||||
<arg>java</arg>
|
||||
<arg>-jar</arg>
|
||||
<arg>/maven/ingest.jar</arg>
|
||||
</exec>
|
||||
</entryPoint>
|
||||
<assembly>
|
||||
<descriptor>assembly.xml</descriptor>
|
||||
</assembly>
|
||||
</build>
|
||||
</image>
|
||||
</images>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
@@ -151,5 +193,5 @@
|
||||
<version>${checkstyle.plugin.version}</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</reporting>
|
||||
</reporting>
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
|
||||
<id>zip</id>
|
||||
<includeBaseDirectory>true</includeBaseDirectory>
|
||||
|
||||
<formats>
|
||||
<format>zip</format>
|
||||
</formats>
|
||||
<baseDirectory>file-to-jdbc</baseDirectory>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>${project.basedir}</directory>
|
||||
<excludes>
|
||||
<exclude>**/target/**</exclude>
|
||||
<exclude>*.zip</exclude>
|
||||
</excludes>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>${project.basedir}/../data</directory>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</assembly>
|
||||
Reference in New Issue
Block a user