From 7e9907189390749fd13f92ede44bad2b5a5a7878 Mon Sep 17 00:00:00 2001
From: Shinsuke Sugaya <shinsuke@yahoo.co.jp>
Date: Thu, 9 Jun 2016 12:32:24 +0900
Subject: [PATCH] fix #532 : download mydbflute from lastaflute

---
 README.md                 |  2 +-
 dbflute.xml               | 26 ++++++++++++++++++++++++++
 dbflute_fess/_project.bat |  2 +-
 dbflute_fess/_project.sh  |  2 +-
 pom.xml                   |  1 +
 5 files changed, 30 insertions(+), 3 deletions(-)
 create mode 100644 dbflute.xml

diff --git a/README.md b/README.md
index a0315555f..cbfdbe76f 100644
--- a/README.md
+++ b/README.md
@@ -73,7 +73,7 @@ Run package goal and then the release file is created in target/releases.
 
 ### Generate Source Code
 
-    $ mvn dbflute:download # (one time command)
+    $ mvn antrun:run # (one time command)
     $ mvn dbflute:freegen
     $ mvn license:format
 
diff --git a/dbflute.xml b/dbflute.xml
new file mode 100644
index 000000000..8b9ff4e33
--- /dev/null
+++ b/dbflute.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="dbflute" basedir=".">
+	<property name="mydbflute.dir" value="${basedir}/mydbflute" />
+	<property name="target.dir" value="${basedir}/target" />
+	<property name="mydbflute.url" value="https://github.com/lastaflute/lastaflute-example-waterfront/archive/master.zip" />
+
+	<target name="mydbflute.check">
+		<condition property="mydbflute.exists">
+			<available file="${mydbflute.dir}" type="dir" />
+		</condition>
+	</target>
+
+	<target name="download.dbflute" depends="mydbflute.check" unless="mydbflute.exists">
+		<mkdir dir="${mydbflute.dir}" />
+		<get dest="${target.dir}/mydbflute.zip">
+			<url url="${mydbflute.url}" />
+		</get>
+		<unzip dest="${mydbflute.dir}" src="${target.dir}/mydbflute.zip">
+			<patternset>
+				<include name="lastaflute-example-waterfront-master/mydbflute/dbflute-1.x/**" />
+			</patternset>
+			<cutdirsmapper dirs="2" />
+		</unzip>
+	</target>
+
+</project>
diff --git a/dbflute_fess/_project.bat b/dbflute_fess/_project.bat
index e1448f36e..ee6fbf769 100644
--- a/dbflute_fess/_project.bat
+++ b/dbflute_fess/_project.bat
@@ -2,7 +2,7 @@
 
 set ANT_OPTS=-Xmx512m
 
-set DBFLUTE_HOME=..\mydbflute\dbflute-1.1.1
+set DBFLUTE_HOME=..\mydbflute\dbflute-1.x
 
 set MY_PROPERTIES_PATH=build.properties
 
diff --git a/dbflute_fess/_project.sh b/dbflute_fess/_project.sh
index 579352aa4..3be66fa81 100644
--- a/dbflute_fess/_project.sh
+++ b/dbflute_fess/_project.sh
@@ -2,6 +2,6 @@
 
 export ANT_OPTS=-Xmx512m
 
-export DBFLUTE_HOME=../mydbflute/dbflute-1.1.1
+export DBFLUTE_HOME=../mydbflute/dbflute-1.x
 
 export MY_PROPERTIES_PATH=build.properties
diff --git a/pom.xml b/pom.xml
index 054f77ab2..d6e160c9c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -250,6 +250,7 @@
 				</dependencies>
 				<configuration>
 					<tasks>
+						<ant antfile="${basedir}/dbflute.xml" target="download.dbflute" />
 						<ant antfile="${basedir}/plugin.xml" target="install.plugins">
 							<property name="with.fess" value="true" />
 						</ant>
-- 
GitLab