Tuesday, 12 June 2012

Integration of Maven and ANT

The idea behind this post is to build through maven so we don't have dirty lib folders in our repository or don't have to worry about class paths either. 

Also some time you want to deploy locally as you are deploying in real production environment. 

Following is a sample build script:

pom.xml:



 4.0.0
 com.zohaib.research
 researchPrj
 war
 1.0-SNAPSHOT
 Maven Webapp
 http://maven.apache.org

 

  
   Maven central
   http://central.maven.org/maven2
  

  
   maven2
   http://repo2.maven.org/maven2
  

  
   maven.springframework
   http://maven.springframework.org/release
  


  
   spring-milestones
   http://repo.spring.io/milestone
   
    true
   
  


 


 
  
  true
  4.0.3.RELEASE
  1.5.2.RELEASE
  3.2.3.RELEASE
  4.3.5.Final
  2.3.2
  5.1.30

 

 


  
   javax.servlet
   jstl
   1.2
  

  
   javax.servlet
   javax.servlet-api
   3.0.1
   provided
  


  
   org.springframework
   spring-webmvc
   ${org.springframework-version}
  


  
   org.springframework.data
   spring-data-jpa
   ${org.springData-version}
  

  
   org.springframework
   spring-tx
   ${org.springframework-version}
  

  
   org.aspectj
   aspectjrt
   1.6.5
  

  
   org.aspectj
   aspectjweaver
   1.8.0.RELEASE
  


  
  
   org.springframework.security
   spring-security-web
   ${spring.security.version}
  

  
   org.springframework.security
   spring-security-config
   ${spring.security.version}
  

  
  
   org.springframework.security
   spring-security-taglibs
   ${spring.security.version}
  


  
   org.hibernate
   hibernate-core
   ${hibernate.version}
  
  
   org.hibernate
   hibernate-entitymanager
   ${hibernate.version}
  


  
   mysql
   mysql-connector-java
   ${mysql.connector.version}
  

  
   opensymphony
   sitemesh
   2.4.2
  

  
   cglib
   cglib-nodep
   2.2
  

  
   commons-collections
   commons-collections
   3.1
  

  
   commons-dbcp
   commons-dbcp
   1.3
  


  
   commons-beanutils
   commons-beanutils
   1.8.3
  

  
   org.apache.httpcomponents
   httpclient
   4.1.1
  

  
   commons-fileupload
   commons-fileupload
   1.2.2
  

  
   commons-io
   commons-io
   1.4
  

  
   commons-lang
   commons-lang
   2.5
  

  
   commons-pool
   commons-pool
   1.5.4
  

  
   org.codehaus.jackson
   jackson-mapper-asl
   1.9.3
  


  
   junit
   junit
   3.8.1
   test
  

 

 
  ROOT
  
   
    org.apache.maven.plugins
    maven-compiler-plugin
    2.3.2
    
     1.6
     1.6
    
   
   
    org.apache.maven.plugins
    maven-war-plugin
    2.1.1
    
     false
    
   

   
    org.codehaus.mojo
    aspectj-maven-plugin
    1.5
    
    
     1.6
     1.6
     1.6
    
    
     
      
       compile
       test-compile
      
     
    
   

   
    org.apache.maven.plugins
    maven-site-plugin
    3.0
    
     
      
      
       org.codehaus.mojo
       cobertura-maven-plugin
       2.5.1
      
     
    
   
  
 



build.properties:


deployment.dir=C:/SOFTWARE_INSTALL/TESTING_TOMCAT/apache-tomcat-7.0.53/webapps
tomcat.home=C:/SOFTWARE_INSTALL/TESTING_TOMCAT/apache-tomcat-7.0.53
build.dir=../target
war.file.name=ROOT.war
maven.home=C:/MAVEN/apache-maven-3.0.4
catalina.fileName=catalina.bat
maven.fileName=mvn.bat

build.xml:



 
  ANT SCRIPT
 

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 


 
 

 


 
  
   
  
 

 
  
   
  
 

 
  
   
  
 

 
  
   
  
 



 

 
  
  
 

 

  
  

  
  

   
   

  
  
   
  

 

 
  
  

  

  
   
  
  
  

  
   
   
   
  

  
   
  

  
   
   
   
  


 

 


 

 


 


 
  
  
  
  
 


 
  
   
  

  
  

   
   
  

 

 
  
  
   
   
  
 

 
  
  
  
 

 

 
  
  
    
   
   
   
      
   
   
  
 

 
  
  
   
   
  
 

 
  
   
   
  
 



 
  
  
  
       
  
 



 
  
  
  
  
  
  
   
    
   
  
 

 
  
  
  
  
  
  
 

 
  
  
  
  
  
  
  
  
 

 
  
  
 


 
  
  
  
 

 
  
  
  
  
  
  
  
  

 


No comments:

Post a Comment

Zohaib: