Thursday, September 18, 2014

Maven source plugin

The best way to generate the source jar along with the classes using maven is using the below plugin.

Just keep this plugin in the build tag as shown below:

    <build>
         <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>2.1.2</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>


Have fun!

Wednesday, September 17, 2014

Building the wso2 products

I was wondering how to build the wso2 products mainly IS and AM, I found them as very easy after talking to a friend Thanuja, one of the developers of IS in wso2.

There are 3 steps to follow to build:
  1. Build and install Kernal.
  2. Build and install Orbit.
  3. Build and install Chunk-11.
Do all those in order from the given below svn repo:
https://svn.wso2.org/repos/wso2/carbon

Most important thing is you have to do this with java: 1.6 and maven: 3.0.5.release versions only.


The 3rd step builds all the products by default, if you don't want all the products, then comment the unnecessary products in given files:
  1. components/pom.xml
  2. dependencies//pom.xml 
  3. features/pom.xml 
  4. products//pom.xml

Have fun :)

What is "final" keyword in java


The "final" is reserved keyword in java, hence can't be used it as a variable name or class name or any method name.
final is used at different places in different contexts. I illustrate the usage and essential meaning of this keyword in different contexts.

 There would be 4 different contexts, they are:

  1. Applying final keyword for a class, in class definition.
  2. Applying in a method definition.
  3. Using final keyword in a variable definition.
  4. It is used to access the variable inside an anonymous class.

Advantages of final keyword:
  • The "final" keyword is used for high performance.
  • Using final for caching the values of variables and objects.
  • It is used for static class binding.
  • It is used to variables which will be involving in multi-threading, since final resources can be accessed safely without any synchronization.
  • It helps the JVM in optimizing the classes, methods and variables.