Friday, March 22, 2013

Useful Maven Plugins


  1. Apache Maven - Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information. http://maven.apache.org/plugins/index.html
  2. Mojo - The Mojo project is a collection of plugins for Apache Maven 2 & 3 http://mojo.codehaus.org/plugins.html
  3. http://www.packtpub.com/article/useful-maven-plugins-part1
  4. http://nayidisha.com/techblog/useful-maven-plugins
  5. http://www.ibm.com/developerworks/java/library/j-5things13/index.html
  6. http://repository.ow2.org/nexus/content/sites/ow2-utilities/mergeproperties-maven-plugin/plugin-management.html
  7. http://evgeny-goldin.com/blog/maven-plugins-released/
Other Plugins
  • maven-replacer-plugin - https://code.google.com/p/maven-replacer-plugin
  • properties-maven-plugin

Thursday, March 21, 2013

Integrate VersionOne with the Eclipse IDE

I have explained how to  Track your modified files with Eclipse MyLin in previous blog. This Blog will explain how to connect to the VersionOne through eclipse. If you have already followed the Track your modified files with Eclipse MyLin then it is easy to Integrate with the VersionOne.

Lets see how we can configure VersionOne through the MyLin very easily.

  • Click the New Task Down Arrow key and select "Add Repository"

  • Click "Install More Connectors"


  • Select VersionOne

  • Once the plug-in is installed select the VersionOne from the "New Task" Drop Down Menu and  Enter the Version one lo-gin details. Once the credentials are entered click "Validate Settings" to ensure the success connection to the VersionOne System

  • If you have logged in to the system successfully then you can see all the tasks in the "Task List"


  • Open the assigned task and start working on it. Select Activate Task and then it will track all the modified files and assigned to the relevant task.
  • Add Comments in to the Task
  • Change the Actions, Attache Context and Submit to theVersionOne


  • Attach Screenshots and modified file list

  • Track the working hours , Schedule time, estimate dates



  • View Modified Files


  • Check the Modified tasks in the VersionOne Web tool. 











Friday, March 8, 2013

How to upload Artifact to the repository server

If you need to upload the artifact while you install to the local repository, follow the below steps.

1. Add the following setting in the setting.xml file which is in the local repository

    
      archiva.internal
      [UN]
      [PW]
    
  


2. In the POM file add the following settings

  
   archiva.internal
   Internal Release Repository
   [URL For the internal repository path]
  
 
Note : ID of the both files should be same

3. Run the following goal mv deploy

Please ensure upload rights is given in the relevant repository server

For exmple, if your using Apache Archiva then deployment user needs the Role 'Repository Manager' for each repository that you want to deploy.

Thursday, March 7, 2013

MySQL 5.5 - How to change MySQL default character-set to UTF8


  1. First Connect to the mysql usting "mysql" command.
  2. Run the below script to check the current installed character set.                                                    
      
    show variables like “collation_database”;
     
    +--------------------+-------------------+
    | Variable_name      | Value             |
    +--------------------+-------------------+
    | collation_database | latin1_swedish_ci |
    +--------------------+-------------------+
    
    show variables like "%character%"; show variables like "%collation%";
    
    +--------------------------+----------------------------+
    | Variable_name            | Value                      |
    +--------------------------+----------------------------+
    | character_set_client     | utf8                       |
    | character_set_connection | utf8                       |
    | character_set_database   | latin1                     |
    | character_set_filesystem | binary                     |
    | character_set_results    | utf8                       |
    | character_set_server     | latin1                     |
    | character_set_system     | utf8                       |
    | character_sets_dir       | /usr/share/mysql/charsets/ |
    +--------------------------+----------------------------+
    8 rows in set (0.12 sec)
    
    +----------------------+-------------------+
    | Variable_name        | Value             |
    +----------------------+-------------------+
    | collation_connection | utf8_general_ci   |
    | collation_database   | latin1_swedish_ci |
    | collation_server     | latin1_swedish_ci |
    +----------------------+-------------------+
    3 rows in set (0.00 sec)
    
    
  3.  Add below variables in my.cnf which is in the /etc/mysql directory
  4. [mysqld]
    init_connect='SET collation_connection = utf8_unicode_ci'
    init_connect='SET NAMES utf8'
    character-set-server=utf8
    collation-server=utf8_unicode_ci
    skip-character-set-client-handshake
  5. Restart the MySQL
    sudo /etc/init.d/mysql stop
    sudo /etc/init.d/mysql start
  6. Re-run the above SQL statements which is define in the step 2. You will see the char set have been changed to utf8 as below
    +--------------------+-----------------+
    | Variable_name      | Value           |
    +--------------------+-----------------+
    | collation_database | utf8_unicode_ci |
    +--------------------+-----------------+
    1 row in set (0.00 sec)
    
    +--------------------------+----------------------------+
    | Variable_name            | Value                      |
    +--------------------------+----------------------------+
    | character_set_client     | utf8                       |
    | character_set_connection | utf8                       |
    | character_set_database   | utf8                       |
    | character_set_filesystem | binary                     |
    | character_set_results    | utf8                       |
    | character_set_server     | utf8                       |
    | character_set_system     | utf8                       |
    | character_sets_dir       | /usr/share/mysql/charsets/ |
    +--------------------------+----------------------------+
    8 rows in set (0.00 sec)
    
    +----------------------+-----------------+
    | Variable_name        | Value           |
    +----------------------+-----------------+
    | collation_connection | utf8_general_ci |
    | collation_database   | utf8_unicode_ci |
    | collation_server     | utf8_unicode_ci |
    +----------------------+-----------------+
    3 rows in set (0.00 sec)
    
    

How to create a mysql procedure


DROP PROCEDURE IF EXISTS mydatabase.datespopulate;

DELIMITER |
CREATE PROCEDURE mydatabase.datespopulate(dateStart DATE, dateEnd DATE)
BEGIN
  WHILE dateStart <= dateEnd DO
     INSERT INTO mydatabase.datetable (d) VALUES (dateStart);
    SET dateStart = date_add(dateStart, INTERVAL 1 DAY);
  END WHILE;
END;

DELIMITER ;
CALL mydatabase.datespopulate('2013-02-01','2015-06-30');

delete from mydatabase.datetable;

Default Maven plugins (Core Plugins)


A Plugin for executing external programs
mvn exec:exec

A plugin for compile and execute selected program with argumants
compile exec:java -Dexec.mainClass=camelinaction.FilePrinter -Dexec.args="100"


Delete the target folder and compile java classes
mvn clean compile


Deploys an arbitrary artifact to the JBoss application server
mvn jboss-as:deploy


First run the clean, build the project and install the artifact to the local repository
mvn clean install 


Executes the supplied java class in the current VM with the enclosing project's dependencies as classpath
mvn exec:java
   
    org.codehaus.mojo
    exec-maven-plugin
    1.1
    
     MyClass
    
   


Displays the dependency tree for the current project
mvn dependency:tree




Monday, March 4, 2013

Jboss AS 7 & Maven 3



  1. How to deploy the .war , .ear or .jar to the jboss AS7 while you package your project in eclipse 

  • In the eclipse Juno add the following parameter in the configuration option. Parameter Name  jboss-as.home and Value [Your jboss AS7 home path]
  • Add the following plug-in to the .pom file
  • Option 1
     
      
        org.jboss.as.plugins
        jboss-as-maven-plugin
        7.3.Final
        
         
          package
          
           deploy
          
         
        
       
    
  • Option 2
       
        org.jboss.as.plugins
        jboss-as-maven-plugin
        7.3.Final
       
      
In the clipse goals add the following 
jboss-as:deploy