Tuesday, 22 September 2015

A free file finding and text searching tool

BareGrep from baremetalsoft.com is excelt tool for file finding and text searching

Monday, 7 September 2015

Creating multiple jars from single pom file

In ant we can create any number of jars using <jar> tag, but when we are moving to maven from ant it we may face challenge. Old code may not be modular imposing use of single pom file. In this case maven-jar-plugin come to rescue.

maven-jar-plugin

I guess xml is self explanatory, if question put it in comments
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>first-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<finalName>first-jar</finalName>
<includes>
<include>**/njoshi/**/first/**/*.class</include>
</includes>
<archive>
<index>false</index>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.njoshi.research.multiplejars.first.FirstJarSampleClass</mainClass>
</manifest>
<manifestEntries>
<url>${project.url}</url>
<Implementation-Title>com.njoshi.research.multiplejars</Implementation-Title>
<Implementation-Vendor>Nikhil Joshi</Implementation-Vendor>
<version>${project.version}</version>
<Implementation-Version>
<configuration>
<format>{0,date,yyyyMMddHHmmss}</format>
<items>
<item>timestamp</item>
</items>
</configuration>
</Implementation-Version>
</manifestEntries>
</archive>
</configuration>
</execution>
<execution>
<id>second-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<finalName>second-jar</finalName>
<includes>
<include>**/njoshi/**/second/**/*.class</include>
</includes>
<archive>
<index>false</index>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.njoshi.research.multiplejars.second.SecondJarSampleClass</mainClass>
</manifest>
<manifestEntries>
<url>${project.url}</url>
<Implementation-Title>com.njoshi.research.multiplejars</Implementation-Title>
<Implementation-Vendor>Nikhil Joshi</Implementation-Vendor>
<version>${project.version}</version>
<Implementation-Version>
<configuration>
<format>{0,date,yyyyMMddHHmmss}</format>
<items>
<item>timestamp</item>
</items>
</configuration>
</Implementation-Version>
</manifestEntries>
</archive>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Full working source code