<?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>Blog.Project13.pl &#187; opensource</title>
	<atom:link href="http://www.blog.project13.pl/index.php/tag/opensource/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.blog.project13.pl</link>
	<description>The Blog of a Coder</description>
	<lastBuildDate>Sun, 05 Feb 2012 02:28:52 +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>[release] maven-git-commit-id-plugin</title>
		<link>http://www.blog.project13.pl/index.php/fun/1174/release-maven-git-commit-id-plugin/</link>
		<comments>http://www.blog.project13.pl/index.php/fun/1174/release-maven-git-commit-id-plugin/#comments</comments>
		<pubDate>Sun, 13 Feb 2011 15:25:18 +0000</pubDate>
		<dc:creator>Ktoso</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[freedom]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[#maven]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[free software]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[release]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tricks]]></category>

		<guid isPermaLink="false">http://www.blog.project13.pl/?p=1174</guid>
		<description><![CDATA[Yup, today I&#8217;m releasing yet another piece of cool free software! It solves a problem we&#8217;ve had at our company, the tester tometimes tested stuff that wasn&#8217;t deployed yet, and the developers thought it was deployed and this caused some weird situations sometimes. Using the plugin I&#8217;ve written, we&#8217;re able to expose &#8220;which version is [...]]]></description>
			<content:encoded><![CDATA[<p>Yup, today I&#8217;m releasing yet another piece of cool free software! It solves a problem we&#8217;ve had at our company, the tester tometimes tested stuff that wasn&#8217;t deployed yet, and the developers thought it was deployed and this caused some weird situations sometimes. Using the plugin I&#8217;ve written, we&#8217;re able to expose &#8220;which version is this?&#8221; using repository information from<strong> git </strong>in our webapps. Yes there are maven plugins that do this, but none of them supported git &#8211; so I wrote my own and hope you guys will find it as useful as we do!</p>
<p><strong>UPDATE</strong><br />
The plugin is now available from <strong>Sonatype Nexus</strong>!</p>
<pre>
    <repository>
        <id>sonatype-releases</id>
        <name>Sonatype Releases</name>
        <url>https://oss.sonatype.org/content/repositories/releases/</url>
    </repository>
</pre>
<p><strong>END OF UPDATE</strong></p>
<p>Now I&#8217;ll be a bit lazy and just paste the README I&#8217;ve prepared for <strong><a href="https://github.com/ktoso/maven-git-commit-id-plugin/" target="_blank" onclick="urchinTracker('/outgoing/github.com/ktoso/maven-git-commit-id-plugin/?referer=');">maven-git-commit-id-plugin on github</a></strong>.</p>
<div id="readme">
<div>
<h2>Maven plugin: git-commit-id-plugin</h2>
<p><strong>git-commit-id-plugin</strong> is a plugin quite similar to <a href="https://fisheye.codehaus.org/browse/mojo/tags/buildnumber-maven-plugin-1.0-beta-4" target="_blank" onclick="urchinTracker('/outgoing/fisheye.codehaus.org/browse/mojo/tags/buildnumber-maven-plugin-1.0-beta-4?referer=');">build-number maven plugin</a> for example but as buildnumber only supports svn (which is very sad) and  cvs (which is even more sad, and makes bunnies cry) I had to quickly  develop an git version of such a plugin. For those who don&#8217;t know the  previous plugins, let me explain what this plugin does:</p>
<h3>Sample scenario why this plugin is useful</h3>
<p>If you develop your maven project inside an git repository (which you  hopefully already are docing) you may want to know exactly what changeset is currently deployed online. Why is this useful? Well,  the tester won&#8217;t come to you screaming &#8220;heeey that bug ain&#8217;t fixed&#8221; of  course you&#8217;d reply &#8220;but I fixed it this morning!&#8221; and after some  searching you notice &#8220;oh&#8230; it&#8217;ll be online after the next deployment,  sorry tester&#8230; :-(&#8220;.</p>
<p>This scenario keeps repeating sometimes, thus you can state which  commit fixes/closes the bug, note this in JIRA etc and then the tester  will know if it&#8217;s already online (by the commit date for example).</p>
<h2>Usage</h2>
<h3>Getting the plugin</h3>
<p>I&#8217;ll be trying to get this plugin out to sonatype for others to use if more simply, for now it&#8217;s quickest to just:</p>
<pre><code>  git clone git://github.com/ktoso/maven-git-commit-id-plugin.git maven-git-commit-id-plugin
  cd maven-git-commit-id-plugin
  mvn install
</code></pre>
<p>and you&#8217;re ready to use it ;-) I&#8217;m also thinking about making this  github repo a maven repository, which would make the above step not  needed &#8211; but first let&#8217;s wait if sonatype let me in with this project,  k? ;-)</p>
<h3>Using the plugin</h3>
<p>It&#8217;s really simple to setup this plugin, here&#8217;s a sample pom that you may base your <strong>pom.xml</strong> on:</p>
<pre><code>   &lt;?xml version="1.0" encoding="UTF-8"?&gt;
   &lt;project xmlns="http://maven.apache.org/POM/4.0.0"
            xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
       &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;

       &lt;groupId&gt;pl.project13.maven&lt;/groupId&gt;
       &lt;artifactId&gt;my-git-plugin-sample-app&lt;/artifactId&gt;
       &lt;packaging&gt;war&lt;/packaging&gt;
       &lt;version&gt;0.1&lt;/version&gt;
       &lt;name&gt;my-git-plugin-sample-app&lt;/name&gt;
       &lt;url&gt;http://www.blog.project13.pl&lt;/url&gt;

       &lt;parent/&gt;

       &lt;dependencies /&gt;

       &lt;build&gt;
           &lt;!-- GIT COMMIT ID PLUGIN CONFIGURATION --&gt;
           &lt;resources&gt;
               &lt;resource&gt;
                   &lt;directory&gt;src/main/resources&lt;/directory&gt;
                   &lt;filtering&gt;true&lt;/filtering&gt;
                   &lt;includes&gt;
                       &lt;include&gt;**/*.properties&lt;/include&gt;
                       &lt;include&gt;**/*.xml&lt;/include&gt;
                   &lt;/includes&gt;
               &lt;/resource&gt;
           &lt;/resources&gt;

           &lt;plugins&gt;
               &lt;plugin&gt;
                   &lt;groupId&gt;pl.project13.maven&lt;/groupId&gt;
                   &lt;artifactId&gt;git-commit-id-plugin&lt;/artifactId&gt;
                   &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
                   &lt;executions&gt;
                       &lt;execution&gt;
                           &lt;goals&gt;
                               &lt;goal&gt;revision&lt;/goal&gt;
                           &lt;/goals&gt;
                       &lt;/execution&gt;
                   &lt;/executions&gt;
                   &lt;configuration&gt;
                       &lt;prefix&gt;git&lt;/prefix&gt; &lt;!-- that's the default value --&gt;
                       &lt;dateFormat&gt;dd.MM.yyyy '@' HH:mm:ss z&lt;/dateFormat&gt; &lt;!-- that's the default value --&gt;
                       &lt;verbose&gt;true&lt;/verbose&gt; &lt;!-- false is default for this --&gt;
                       &lt;dotGitDirectory&gt;${project.basedir}/../.git&lt;/dotGitDirectory&gt; &lt;!-- required, you have to specify this path --&gt;
                   &lt;/configuration&gt;
               &lt;/plugin&gt;
               &lt;!-- END OF GIT COMMIT ID PLUGIN CONFIGURATION --&gt;

               &lt;!-- other plugins --&gt;
           &lt;/plugins&gt;
       &lt;/build&gt;
   &lt;/project&gt;
</code></pre>
<p>Based on the above part of a working POM you should be able to figure out the rest, I mean you are a maven user after all&#8230; ;-) Note that the resources filtering is important for this plugin to work, don&#8217;t omit it!</p>
<p>Now you just have to include such a properties file in your project under <code>/src/main/resources</code> (and call it <strong>git.properties</strong> for example) and maven will put the appropriate properties in the placeholders:</p>
<pre><code> git.branch=${git.branch}

 git.build.user.name=${git.build.user.name}
 git.build.user.email=${git.build.user.email}
 git.build.time=${git.build.time}

 git.commit.id=${git.commit.id}
 git.commit.user.name=${git.commit.user.name}
 git.commit.user.email=${git.commit.user.email}
 git.commit.message.full=${git.commit.message.full}
 git.commit.message.short=${git.commit.message.short}
 git.commit.time=${git.commit.time}
</code></pre>
<p>The <code>git</code> prefix may be configured in the plugin declaration above.</p>
<h3>Maven resource filtering + Spring = GitRepositoryState Bean</h3>
<p>You&#8217;ll most probably want to wire these plugins somehow to get easy  access to them during runtime. We&#8217;ll use spring as an example of doing  this. Start out with with adding the above steps to your project, next paste  this <strong>git-bean.xml</strong> into the <code>/src/main/resources/</code> directory (or any other, just adjust the paths later on):</p>
<pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
&lt;beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"&gt;

    &lt;bean name="gitRepositoryInformation"&gt;
        &lt;property name="branch" value="${git.branch}"/&gt;
        &lt;property name="commitId" value="${git.commit.id}"/&gt;
        &lt;property name="commitTime" value="${git.commit.time}"/&gt;
        &lt;property name="buildUserName" value="${git.build.user.name}"/&gt;
        &lt;property name="buildUserEmail" value="${git.build.user.email}"/&gt;
        &lt;property name="commitMessageFull" value="${git.commit.message.full}"/&gt;
        &lt;property name="commitMessageShort" value="${git.commit.message.short}"/&gt;
        &lt;property name="commitUserName" value="${git.commit.user.name}"/&gt;
        &lt;property name="commitUserEmail" value="${git.commit.user.email}"/&gt;
    &lt;/bean&gt;

&lt;/beans&gt;
</code></pre>
<p>And here&#8217;s the source of the bean we&#8217;re binding here:</p>
<pre><code>package pl.project13.maven.example.git;

import org.codehaus.jackson.annotate.JsonWriteNullProperties;

/**
 * A spring controlled bean that will be injected
 * with properties about the repository state at build time.
 * This information is supplied by my plugin - &lt;b&gt;pl.project13.maven.git-commit-id-plugin&lt;/b&gt;
 *
 * @author Konrad Malawski
 */
@JsonWriteNullProperties(true)
public class GitRepositoryState {
  String branch;                  // =${git.branch}
  String commitId;                // =${git.commit.id}
  String buildUserName;           // =${git.build.user.name}
  String buildUserEmail;          // =${git.build.user.email}
  String buildTime;               // =${git.build.time}
  String commitUserName;          // =${git.commit.user.name}
  String commitUserEmail;         // =${git.commit.user.email}
  String commitMessageFull;       // =${git.commit.message.full}
  String commitMessageShort;      // =${git.commit.message.short}
  String commitTime;              // =${git.commit.time}

  public GitRepositoryState() {
  }

  /* Generate setters and getters here */
}
</code></pre>
<p>The source for it is also on the repo of this plugin. Of course, <em>feel free to drop out the jackson annotation</em> if you won&#8217;t be using it.</p>
<p>The last configuration related thing we need to do is to load up this bean in your appContext, so open up your <strong>applicationContext.xml</strong> or whatever you call it in your project and add these lines in the  section:</p>
<pre><code>&lt;context:property-placeholder location="classpath:*.properties" /&gt;
&lt;import resource="classpath:/git-bean.xml"/&gt;
</code></pre>
<p>Of course, you may adjust the paths and file locations as you please, no problems here&#8230; :-) <em>Now you&#8217;re ready to use your GitRepositoryState Bean!</em> Let&#8217;s create an sample <strong>Spring MVC Controller</strong> to test it out:</p>
<pre><code> @Controller
 @RequestMapping("/git")
 public class GitService extends BaseWebService {

     @Autowired
     GitRepositoryState gitRepoState;

     @RequestMapping("/status")
     public ModelAndView checkGitRevision() throws WebServiceAuthenticationException {
       ServerResponse&lt;GitRepositoryState&gt; response = new ServerResponse&lt;GitRepositoryState&gt;(gitRepoState);
       return createMAV(response);
     }
 }
</code></pre>
<p>Don&#8217;t mind the createMAV and responses stuff, it&#8217;s just example code.  And feel free to use constructor injection, it&#8217;s actually a better idea  ;-)</p>
<p>In the end <em>this is what this service would return</em>:</p>
<pre><code> {
     "branch" : "testing-maven-git-plugin",
     "commitTime" : "06.01.1970 @ 16:16:26 CET",
     "commitId" : "787e39f61f99110e74deed68ab9093088d64b969",
     "commitUserName" : "Konrad Malawski",
     "commitUserEmail" : "konrad.malawski@java.pl",
     "commitMessageFull" : "releasing my fun plugin :-)
                            + fixed some typos
                            + cleaned up directory structure
                            + added license etc",
     "commitMessageShort" : "releasing my fun plugin :-)",
     "buildTime" : "06.01.1970 @ 16:17:53 CET",
     "buildUserName" : "Konrad Malawski",
     "buildUserEmail" : "konrad.malawski@java.pl"
 }
</code></pre>
<p>That&#8217;s all folks! <strong>Happy hacking!</strong></p>
<h2>Configuration details</h2>
<p>Just a short recap of the available parameters&#8230;</p>
<p>Required parameters:</p>
<ul>
<li> <strong>dotGitDirectory</strong> &#8211; (required) the location of your .git  folder. Try to use ${project.basedir} as root for this, and navigate  using ../ to higher up folder to easily use this plugin in multi module  enviroments etc. An example would be: <code>${project.basedir}/../.git</code></li>
</ul>
<p>Optional parameters:</p>
<ul>
<li> <strong>prefix</strong> &#8211; (default: git) is the &#8220;namespace&#8221; for all exposed properties</li>
<li> <strong>dateFormat</strong> &#8211; (default: dd.MM.yyyy &#8216;@&#8217; HH:mm:ss z) is a  normal SimpleDateFormat String and will be used to represent  git.build.time and git.commit.time</li>
<li> <strong>verbose</strong> &#8211; (default: false) if true the plugin will print a summary of all collected properties when it&#8217;s done</li>
</ul>
<h2>License</h2>
<p>I&#8217;m releasing this plugin under the <strong>GNU Lesser General Public License 3.0</strong>. You&#8217;re free to use it as you wish, the license text is attached in the LICENSE file. You may contact me if you want this to be released on a different license, just send me an email konrad.malawski@java.pl :-)</p>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.project13.pl/index.php/fun/1174/release-maven-git-commit-id-plugin/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>YES! Native Zen coding in Intellij IDEA EAP 9.0.2</title>
		<link>http://www.blog.project13.pl/index.php/fun/465/yes-native-zen-coding-in-intellij-eap-9-0-2/</link>
		<comments>http://www.blog.project13.pl/index.php/fun/465/yes-native-zen-coding-in-intellij-eap-9-0-2/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 21:30:52 +0000</pubDate>
		<dc:creator>Ktoso</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[free software]]></category>
		<category><![CDATA[ide]]></category>
		<category><![CDATA[IDEA]]></category>
		<category><![CDATA[intellij]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[tip]]></category>
		<category><![CDATA[webdeveloper]]></category>
		<category><![CDATA[zen]]></category>

		<guid isPermaLink="false">http://www.blog.project13.pl/?p=465</guid>
		<description><![CDATA[Zen points directly to the human heart, see into your nature and become Buddha. - Hakuin Ekaku (1685–1768) For those who don&#8217;t know about zen coding (where have you been guys?) here&#8217;s a little sample: Instead of writing: &#60;form class="form-comment" id="comment"&#62; &#60;fieldset&#62; &#60;input id="myid" name="name" type="" /&#62; &#60;input onclick="hideMe()" type="" /&#62; &#60;/fieldset&#62; &#60;/form&#62; You write [...]]]></description>
			<content:encoded><![CDATA[<blockquote>
<p style="text-align: right;"><em><strong>Zen points directly to the human heart,<br />
see into your nature and become Buddha.</strong><br />
</em>- Hakuin Ekaku (1685–1768)</p>
</blockquote>
<p>For those who don&#8217;t know about zen coding (where have you been guys?) here&#8217;s a little sample:</p>
<p>Instead of writing:<br />
<code>&lt;form class="form-comment" id="comment"&gt;<br />
&lt;fieldset&gt;<br />
&lt;input id="myid" name="name" type="" /&gt;<br />
&lt;input onclick="hideMe()"</code><code> type=""</code><code> /&gt;<br />
&lt;/fieldset&gt;<br />
&lt;/form&gt;</code></p>
<p>You write<br />
<code><br />
form.form-comment#comment&gt;fieldset&gt;input#myid[name=name]&gt;input[onclick=hideMe()]</code></p>
<p>and hit [TAB].</p>
<p><em><strong>To understand zen, you must understand yourself. </strong></em>(yet I also strongly suggest watching <a href="http://vimeo.com/7405114" onclick="urchinTracker('/outgoing/vimeo.com/7405114?referer=');">this video</a>)<em><strong><br />
</strong></em></p>
<p>Links:<a href="http://confluence.jetbrains.net/display/IDEADEV/Maia+EAP" onclick="urchinTracker('/outgoing/confluence.jetbrains.net/display/IDEADEV/Maia+EAP?referer=');"></a><br />
<a href="http://confluence.jetbrains.net/display/IDEADEV/Maia+EAP" onclick="urchinTracker('/outgoing/confluence.jetbrains.net/display/IDEADEV/Maia+EAP?referer=');">http://confluence.jetbrains.net/display/IDEADEV/Maia+EAP</a> &#8211; IntelliJ IDEA Early Access Program<br />
<a href="http://code.google.com/p/zen-coding/" onclick="urchinTracker('/outgoing/code.google.com/p/zen-coding/?referer=');">http://code.google.com/p/zen-coding/</a> &#8211; zen coding website</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.project13.pl/index.php/fun/465/yes-native-zen-coding-in-intellij-eap-9-0-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Interesting talk with Sun Microsystems’ Director of Web Technologies Tim Bray</title>
		<link>http://www.blog.project13.pl/index.php/coding/438/interesting-talk-with-sun-microsystems%e2%80%99-director-of-web-technologies-tim-bray/</link>
		<comments>http://www.blog.project13.pl/index.php/coding/438/interesting-talk-with-sun-microsystems%e2%80%99-director-of-web-technologies-tim-bray/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 18:17:10 +0000</pubDate>
		<dc:creator>Ktoso</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[podcast]]></category>
		<category><![CDATA[sun]]></category>
		<category><![CDATA[webdeveloper]]></category>

		<guid isPermaLink="false">http://www.blog.project13.pl/?p=438</guid>
		<description><![CDATA[I just stumbbled uppon an very interesting talk with Sun Microsystems’ Director of Web Technologies Tim Bra, abour the future of the Java Platform. They also mention stuff about REST/SOAP, SOA, Grails/Grails/Django etc. Is&#8217;s interesting to see how &#8220;bigshots&#8221; view these technologies. Tkat said, if you have 30min to spare, or just want to play [...]]]></description>
			<content:encoded><![CDATA[<p>I just stumbbled uppon an very interesting talk with Sun Microsystems’ Director of Web Technologies Tim Bra, abour the future of the Java Platform. They also mention stuff about REST/SOAP, SOA, Grails/Grails/Django etc. Is&#8217;s interesting to see how &#8220;bigshots&#8221; view these technologies.</p>
<p>Tkat said, if you have 30min to spare, or just want to play it in the background while working as I did: <a href="http://itspice.net/cms/it-news/podcast/what-next-in-java-web-development-tim-bray-podcast" onclick="urchinTracker('/outgoing/itspice.net/cms/it-news/podcast/what-next-in-java-web-development-tim-bray-podcast?referer=');">http://itspice.net/cms/it-news/podcast/what-next-in-java-web-development-tim-bray-podcast</a></p>
<ul>
<li>The recodring is from 2009 &#8211; back ind the days with Sun still existent ;-)</li>
<li>Weird that they didn&#8217;t know about Symfony &#8211; the very awesome and scalable PHP Framework.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.project13.pl/index.php/coding/438/interesting-talk-with-sun-microsystems%e2%80%99-director-of-web-technologies-tim-bray/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

