#34 H2使用改进,不再强制要求单独启动H2 TCP server,而是使用嵌入式,但可持久化的模式。
This commit is contained in:
@@ -364,13 +364,6 @@
|
||||
|
||||
<taskdef name="dbunit" classname="org.dbunit.ant.DbUnitTask" classpathref="maven.test.classpath" />
|
||||
|
||||
<echo>Waiting for the h2 server start...</echo>
|
||||
<waitfor maxwait="500" maxwaitunit="second">
|
||||
<and>
|
||||
<socket server="localhost" port="9092" />
|
||||
</and>
|
||||
</waitfor>
|
||||
<echo>The h2 server started.</echo>
|
||||
<sql driver="${jdbc.driver}" url="${jdbc.url}" userid="${jdbc.username}" password="${jdbc.password}"
|
||||
src="src/main/resources/sql/${sql.type}/schema.sql" onerror="continue">
|
||||
<classpath refid="maven.test.classpath" />
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#h2 standalone database settings
|
||||
#h2 embedded database settings
|
||||
jdbc.driver=org.h2.Driver
|
||||
jdbc.url=jdbc:h2:tcp://localhost/~/mini-service4
|
||||
jdbc.url=jdbc:h2:file:/~/mini-service4;AUTO_SERVER=TRUE
|
||||
jdbc.username=sa
|
||||
jdbc.password=
|
||||
|
||||
#log4jdbc driver
|
||||
#jdbc.driver=net.sf.log4jdbc.DriverSpy
|
||||
#jdbc.url=jdbc:log4jdbc:h2:tcp://localhost/~/mini-service4
|
||||
#jdbc.url=jdbc:log4jdbc:h2:file:~/mini-service4;AUTO_SERVER=TRUE
|
||||
|
||||
#dbcp settings
|
||||
dbcp.maxIdle=20
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<hibernate-configuration>
|
||||
<session-factory>
|
||||
<property name="hibernate.connection.driver_class">org.h2.Driver</property>
|
||||
<property name="hibernate.connection.url">jdbc:h2:tcp://localhost/~/mini-web4</property>
|
||||
<property name="hibernate.connection.url">jdbc:h2:file:~/mini-web4;AUTO_SERVER=TRUE</property>
|
||||
<property name="hibernate.connection.username">sa</property>
|
||||
<property name="hibernate.dialect">org.hibernate.dialect.H2Dialect</property>
|
||||
</session-factory>
|
||||
|
||||
@@ -379,14 +379,7 @@
|
||||
<property name="dbunit.datatype" value="org.dbunit.ext.h2.H2DataTypeFactory" />
|
||||
|
||||
<taskdef name="dbunit" classname="org.dbunit.ant.DbUnitTask" classpathref="maven.test.classpath" />
|
||||
|
||||
<echo>Waiting for the h2 server start...</echo>
|
||||
<waitfor maxwait="500" maxwaitunit="second">
|
||||
<and>
|
||||
<socket server="localhost" port="9092"/>
|
||||
</and>
|
||||
</waitfor>
|
||||
<echo>The h2 server started.</echo>
|
||||
|
||||
<sql driver="${jdbc.driver}" url="${jdbc.url}" userid="${jdbc.username}" password="${jdbc.password}" src="src/main/resources/sql/${sql.type}/schema.sql" onerror="continue">
|
||||
<classpath refid="maven.test.classpath" />
|
||||
</sql>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#h2 standalone database settings
|
||||
#h2 embedded database settings
|
||||
jdbc.driver=org.h2.Driver
|
||||
jdbc.url=jdbc:h2:tcp://localhost/~/mini-web4
|
||||
jdbc.url=jdbc:h2:file:~/mini-web4;AUTO_SERVER=TRUE
|
||||
jdbc.username=sa
|
||||
jdbc.password=
|
||||
hibernate.dialect=org.hibernate.dialect.H2Dialect
|
||||
|
||||
#log4jdbc driver
|
||||
#jdbc.driver=net.sf.log4jdbc.DriverSpy
|
||||
#jdbc.url=jdbc:log4jdbc:h2:tcp://localhost/~/mini-web4
|
||||
#jdbc.url=jdbc:log4jdbc:h2:file:~/mini-web4;AUTO_SERVER=TRUE
|
||||
|
||||
#oracle database settings
|
||||
#jdbc.driver=oracle.jdbc.driver.OracleDriver
|
||||
|
||||
@@ -536,14 +536,7 @@
|
||||
<property name="dbunit.datatype" value="org.dbunit.ext.h2.H2DataTypeFactory" />
|
||||
|
||||
<taskdef name="dbunit" classname="org.dbunit.ant.DbUnitTask" classpathref="maven.test.classpath" />
|
||||
|
||||
<echo>Waiting for the h2 server start...</echo>
|
||||
<waitfor maxwait="500" maxwaitunit="second">
|
||||
<and>
|
||||
<socket server="localhost" port="9092" />
|
||||
</and>
|
||||
</waitfor>
|
||||
<echo>The h2 server started.</echo>
|
||||
|
||||
<sql driver="${jdbc.driver}" url="${jdbc.url}" userid="${jdbc.username}" password="${jdbc.password}"
|
||||
src="src/main/resources/sql/${sql.type}/schema.sql" onerror="continue">
|
||||
<classpath refid="maven.test.classpath" />
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
#h2 standalone database settings
|
||||
jdbc.driver=org.h2.Driver
|
||||
jdbc.url=jdbc:h2:tcp://localhost/~/showcase4
|
||||
jdbc.url=jdbc:h2:file:~/showcase4;AUTO_SERVER=TRUE
|
||||
jdbc.username=sa
|
||||
jdbc.password=
|
||||
hibernate.dialect=org.hibernate.dialect.H2Dialect
|
||||
#log4jdbc driver
|
||||
#jdbc.driver=net.sf.log4jdbc.DriverSpy
|
||||
#jdbc.url=jdbc:log4jdbc:h2:tcp://localhost/~/showcase4
|
||||
#jdbc.url=jdbc:log4jdbc:h2:file:~/showcase4;AUTO_SERVER=TRUE
|
||||
|
||||
quartz.jdbc.driver=org.h2.Driver
|
||||
quartz.jdbc.url=jdbc:h2:tcp://localhost/~/showcase-quartz4
|
||||
quartz.jdbc.url=jdbc:h2:file:~/showcase-quartz4;AUTO_SERVER=TRUE
|
||||
quartz.jdbc.username=sa
|
||||
quartz.jdbc.password=
|
||||
|
||||
|
||||
+2
-7
@@ -10,16 +10,11 @@ mvn clean install -Pmodules -Dmaven.test.skip=true
|
||||
|
||||
echo "[Step 2] Generate Eclipse project files for all projects"
|
||||
mvn eclipse:clean eclipse:eclipse -Pall
|
||||
|
||||
echo "[Step 3] Start H2 Standalone database."
|
||||
cd support/h2
|
||||
mvn exec:java -PwithoutBrowser &
|
||||
cd ../../
|
||||
|
||||
echo "[Step 4] Init schema and data for all example projects."
|
||||
echo "[Step 3] Init schema and data for all example projects."
|
||||
mvn antrun:run -Prefresh-db,examples
|
||||
|
||||
echo "[Step 5] Start all example projects."
|
||||
echo "[Step 4] Start all example projects."
|
||||
cd examples/mini-service
|
||||
mvn clean jetty:run -Djetty.port=8082 &
|
||||
cd ../mini-web
|
||||
|
||||
+2
-7
@@ -13,16 +13,11 @@ echo [Step 2] Generate Eclipse project files for all projects
|
||||
call %MVN% eclipse:clean eclipse:eclipse -Pall
|
||||
if errorlevel 1 goto error
|
||||
|
||||
echo [Step 3] Start H2 Standalone database.
|
||||
cd support/h2
|
||||
start "H2 Database" %MVN% exec:java -PwithoutBrowser
|
||||
cd ..\..\
|
||||
|
||||
echo [Step 4] Init schema and data for all example projects.
|
||||
echo [Step 3] Init schema and data for all example projects.
|
||||
call %MVN% antrun:run -Prefresh-db,examples
|
||||
if errorlevel 1 goto error
|
||||
|
||||
echo [Step 5] Start all example projects.
|
||||
echo [Step 4] Start all example projects.
|
||||
cd examples\mini-service
|
||||
start "Mini-Service" %MVN% clean jetty:run -Djetty.port=8082
|
||||
if errorlevel 1 goto error
|
||||
|
||||
@@ -1 +1 @@
|
||||
Command to run a standalone H2 Database server.
|
||||
Command to open a H2 web console or run a standalone H2 Database server.
|
||||
@@ -0,0 +1,3 @@
|
||||
@echo off
|
||||
call mvn exec:java -Ph2console
|
||||
pause
|
||||
@@ -1,3 +1,3 @@
|
||||
@echo off
|
||||
call mvn exec:java
|
||||
call mvn exec:java -Ph2server
|
||||
pause
|
||||
+56
-55
@@ -1,5 +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">
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springside</groupId>
|
||||
@@ -8,8 +9,8 @@
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
<groupId>org.springside</groupId>
|
||||
<artifactId>h2-starts</artifactId>
|
||||
<name>H2 start Script</name>
|
||||
<artifactId>h2-start</artifactId>
|
||||
<name>H2 Console</name>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<dependencies>
|
||||
@@ -21,59 +22,59 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>java</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<mainClass>org.h2.tools.Server</mainClass>
|
||||
<arguments>
|
||||
<argument>-tcp</argument>
|
||||
<argument>-web</argument>
|
||||
<argument>-webPort</argument>
|
||||
<argument>8090</argument>
|
||||
<argument>-browser</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>withoutBrowser</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>java</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<mainClass>org.h2.tools.Server</mainClass>
|
||||
<arguments>
|
||||
<argument>-tcp</argument>
|
||||
<arguments>-tcpAllowOthers</arguments>
|
||||
<argument>-web</argument>
|
||||
<argument>-webPort</argument>
|
||||
<argument>8090</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<id>h2server</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>java</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<mainClass>org.h2.tools.Server</mainClass>
|
||||
<arguments>
|
||||
<argument>-tcp</argument>
|
||||
<arguments>-tcpAllowOthers</arguments>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<profile>
|
||||
<id>h2console</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>java</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<mainClass>org.h2.tools.Server</mainClass>
|
||||
<arguments>
|
||||
<argument>-web</argument>
|
||||
<argument>-webPort</argument>
|
||||
<argument>8090</argument>
|
||||
<argument>-browser</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
|
||||
Reference in New Issue
Block a user