<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>byteco.de &#187; Maven</title>
	<atom:link href="http://byteco.de/category/maven/feed/" rel="self" type="application/rss+xml" />
	<link>http://byteco.de</link>
	<description>In a world of 1s and 0s...are you a zero, or The One?</description>
	<lastBuildDate>Sun, 05 Feb 2012 05:44:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Maven, dbdeploy, HSQLDB without Ant</title>
		<link>http://byteco.de/2010/01/31/maven-dbdeploy-hsqldb-without-ant/</link>
		<comments>http://byteco.de/2010/01/31/maven-dbdeploy-hsqldb-without-ant/#comments</comments>
		<pubDate>Sun, 31 Jan 2010 17:29:18 +0000</pubDate>
		<dc:creator>shiv</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[dbdeploy]]></category>

		<guid isPermaLink="false">http://byteco.de/?p=880</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>Believe me, integrating Maven and dbdeploy is a pain using Ant. For some weird reasons, dbdeploy ant task was causing maven build to crash.</p>
<p>So tried to integrate dbdeploy with maven without ant on my Snow Leopard &#8211;<br />
<span id="more-880"></span></p>
<p>You will need following jars -</p>
<p>dbdeploy-cli-3.0M2.jar<br />
hsqldb-1.8.0.7.jar</p>
<p>keep above jars in dir &#8220;db&#8221; in same dir of pom.xml and keep your dbdeploy sql scripts in dir &#8220;db/scripts&#8221;. This will look like -</p>
<pre class="brush: text">
|-db
|----lib
|-------dbdeploy-cli-3.0M2.jar
|-------hsqldb-1.8.0.7.jar
|----scripts
|-------createSchemaVersionTable.sql
|-pom.xml
</pre>
<p>Next configure following Maven plugins -</p>
<pre class="brush: xml">
            &lt;plugin&gt;
                &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
                &lt;artifactId&gt;sql-maven-plugin&lt;/artifactId&gt;
                &lt;version&gt;1.1&lt;/version&gt;
                &lt;dependencies&gt;
                    &lt;dependency&gt;
                        &lt;groupId&gt;hsqldb&lt;/groupId&gt;
                        &lt;artifactId&gt;hsqldb&lt;/artifactId&gt;
                        &lt;version&gt;1.8.0.7&lt;/version&gt;
                    &lt;/dependency&gt;
                &lt;/dependencies&gt;
                &lt;configuration&gt;
                    &lt;driver&gt;${test.jdbc.driverClassName}&lt;/driver&gt;
                    &lt;url&gt;${test.jdbc.url}&lt;/url&gt;
                    &lt;username&gt;${test.jdbc.username}&lt;/username&gt;
                    &lt;password&gt;${test.jdbc.password}&lt;/password&gt;
                &lt;/configuration&gt;
                &lt;executions&gt;
                    &lt;execution&gt;
                        &lt;id&gt;create-change-log&lt;/id&gt;
                        &lt;phase&gt;process-test-sources&lt;/phase&gt;
                        &lt;goals&gt;
                            &lt;goal&gt;execute&lt;/goal&gt;
                        &lt;/goals&gt;
                        &lt;configuration&gt;
                            &lt;srcFiles&gt;
                                &lt;srcFile&gt;${basedir}/db/scripts/createSchemaVersionTable.sql&lt;/srcFile&gt;
                            &lt;/srcFiles&gt;
                        &lt;/configuration&gt;
                    &lt;/execution&gt;
                    &lt;execution&gt;
                        &lt;id&gt;apply-db-changes&lt;/id&gt;
                        &lt;phase&gt;process-test-classes&lt;/phase&gt;
                        &lt;goals&gt;
                            &lt;goal&gt;execute&lt;/goal&gt;
                        &lt;/goals&gt;
                        &lt;configuration&gt;
                            &lt;srcFiles&gt;
                                &lt;srcFile&gt;${basedir}/target/consolidated_script.sql&lt;/srcFile&gt;
                            &lt;/srcFiles&gt;
                        &lt;/configuration&gt;
                    &lt;/execution&gt;
                &lt;/executions&gt;
            &lt;/plugin&gt;
</pre>
<p>createSchemaVersionTable.sql is part of dbdeploy distribution. Copy HSQLDB version.</p>
<p>And the following </p>
<pre class="brush: xml">
            &lt;plugin&gt;
                &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
                &lt;artifactId&gt;exec-maven-plugin&lt;/artifactId&gt;
                &lt;version&gt;1.1&lt;/version&gt;
                &lt;executions&gt;
                    &lt;execution&gt;
                        &lt;id&gt;dbdeploy&lt;/id&gt;
                        &lt;phase&gt;test-compile&lt;/phase&gt;
                        &lt;goals&gt;
                            &lt;goal&gt;exec&lt;/goal&gt;
                        &lt;/goals&gt;
                        &lt;configuration&gt;
                            &lt;executable&gt;java&lt;/executable&gt;
                            &lt;workingDirectory&gt;${basedir}/db&lt;/workingDirectory&gt;
                            &lt;commandlineArgs&gt;
                                -cp ${test.hsql.jar}:lib/dbdeploy-cli-3.0M2.jar com.dbdeploy.CommandLineTarget -U ${test.jdbc.username} -D ${test.jdbc.driverClassName} -u ${test.jdbc.url.escaped} -d ${test.dbdeploy.dbms.type} -o ${basedir}/target/consolidated_script.sql -s scripts/
                            &lt;/commandlineArgs&gt;
                        &lt;/configuration&gt;
                    &lt;/execution&gt;
                &lt;/executions&gt;
            &lt;/plugin&gt;
</pre>
<p>Following are the important maven properties that are to be set -</p>
<pre class="brush: xml">
        &lt;test.jdbc.driverClassName&gt;org.hsqldb.jdbcDriver&lt;/test.jdbc.driverClassName&gt;
        &lt;test.jdbc.url&gt;jdbc:hsqldb:file:${basedir}/target/testdb;shutdown=true&lt;/test.jdbc.url&gt;
        &lt;test.jdbc.url.escaped&gt;jdbc:hsqldb:file:${basedir}/target/testdb\\;shutdown=true&lt;/test.jdbc.url.escaped&gt;
        &lt;test.jdbc.username&gt;sa&lt;/test.jdbc.username&gt;
        &lt;test.jdbc.password&gt;&lt;/test.jdbc.password&gt;
        &lt;test.dbdeploy.dbms.type&gt;hsql&lt;/test.dbdeploy.dbms.type&gt;
        &lt;test.hsql.jar&gt;lib/hsqldb-1.8.0.7.jar&lt;/test.hsql.jar&gt;
</pre>
<p>How it works &#8211; </p>
<p>We are using dbdeploy command line interface to achieve integration. The HSQLDB is used in a file mode which is evident by test.jdbc.url, since maven exec task executes by using bash semi-colon used in jdbc url needs to be escaped, thats the reason for defining test.jdbc.url.escaped property.</p>
<p>The sql-maven-plugin&#8217;s execution &#8220;create-change-log&#8221; is configured to run after phase &#8220;process-test-sources&#8221;, which creates change log table which is required by dbdeploy.</p>
<p>The exec-maven-plugin&#8217;s execution &#8220;dbdeploy&#8221; is configured to run after phase &#8220;test-compile&#8221;, executes dbdeploy command line interface, creates &#8220;${basedir}/target/consolidated_script.sql&#8221; which contains sql changes to be applied.</p>
<p>The sql-maven-plugin&#8217;s execution &#8220;apply-db-changes&#8221; is configured to run after phase &#8220;process-test-classes&#8221;, which applies consolidated change log script.</p>
<p>Hope it helps somebody..</p>
]]></content:encoded>
			<wfw:commentRss>http://byteco.de/2010/01/31/maven-dbdeploy-hsqldb-without-ant/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>maven2, slf4j, hibernate error</title>
		<link>http://byteco.de/2010/01/23/maven2-slf4j-hibernate-error/</link>
		<comments>http://byteco.de/2010/01/23/maven2-slf4j-hibernate-error/#comments</comments>
		<pubDate>Sat, 23 Jan 2010 10:52:53 +0000</pubDate>
		<dc:creator>shiv</dc:creator>
				<category><![CDATA[hibernate]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[mvn]]></category>
		<category><![CDATA[slf4j]]></category>

		<guid isPermaLink="false">http://byteco.de/?p=867</guid>
		<description><![CDATA[Got following exception while executing &#8220;mvn test&#8221; java.lang.IllegalAccessError: tried to access field org.slf4j.impl.StaticLoggerBinder.SINGLETON from class org.slf4j.LoggerFactory My pom.xml had following entry wrt slf4j - &#60;dependency&#62; &#60;groupId&#62;org.slf4j&#60;/groupId&#62; &#60;artifactId&#62;slf4j-log4j12&#60;/artifactId&#62; &#60;version&#62;1.5.6&#60;/version&#62; &#60;/dependency&#62; Adding slf4j api dependency did the trick - &#60;dependency&#62; &#60;groupId&#62;org.slf4j&#60;/groupId&#62; &#60;artifactId&#62;slf4j-api&#60;/artifactId&#62; &#60;version&#62;1.5.6&#60;/version&#62; &#60;/dependency&#62;]]></description>
			<content:encoded><![CDATA[<p>Got following exception while executing &#8220;mvn test&#8221;</p>
<blockquote><p>java.lang.IllegalAccessError: tried to access field org.slf4j.impl.StaticLoggerBinder.SINGLETON from class org.slf4j.LoggerFactory</p></blockquote>
<p><span id="more-867"></span></p>
<p>My pom.xml had following entry wrt slf4j -</p>
<pre class="brush: xml">
        &lt;dependency&gt;
            &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
            &lt;artifactId&gt;slf4j-log4j12&lt;/artifactId&gt;
            &lt;version&gt;1.5.6&lt;/version&gt;
        &lt;/dependency&gt;
</pre>
<p>Adding slf4j api dependency did the trick -</p>
<pre class="brush: xml">
        &lt;dependency&gt;
            &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
            &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
            &lt;version&gt;1.5.6&lt;/version&gt;
        &lt;/dependency&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://byteco.de/2010/01/23/maven2-slf4j-hibernate-error/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

