Showing posts with label Apache Maven. Show all posts
Showing posts with label Apache Maven. Show all posts

Monday, September 3, 2012

Useful Maven Commands

  • mvn --version - displays the Maven version in use
  • mvn dependency:tree - displays the dependency tree for this project
  • mvn eclipse:eclipse - creates/updates Java eclipse project settings (.project, .classpath, .setting/org.eclipse.jdt.core.prefs, & other config files)
  • mvn eclipse:clean - cleans/removes Java eclipse project settings (.project, .classpath, .setting/org.eclipse.jdt.core.prefs, & other config files)

Wednesday, July 27, 2011

Maven POM


Source: http://maven.apache.org/guides/introduction/introduction-to-the-pom.html

Friday, July 22, 2011

Installing your own jar into Local Repository

  • Update your maven setting to point the localRepository to where you want to install the jar
    1. Go to <MAVEN_HOME>\conf directory
    2. Open settings.xml and change <localRepositorygt; tag to the path where you want to install the jar file
  • In command prompt, type:
    mvn install:install-file -Dfile=your-artifact-1.0.jar \
                             [-DpomFile=your-pom.xml] \
                             [-Dsources=src.jar] \
                             [-Djavadoc=apidocs.jar] \
                             [-DgroupId=org.some.group] \
                             [-DartifactId=your-artifact] \
                             [-Dversion=1.0] \
                             [-Dpackaging=jar] \
                             [-Dclassifier=sources] \
                             [-DgeneratePom=true] \
                             [-DcreateChecksum=true]
    
    Where: <path-to-file>  the path to the file to load
       <group-id>      the group that the file should be registered under
       <artifact-id>   the artifact name for the file
       <version>       the version of the file
       <packaging>     the packaging of the file e.g. jar

    Sample:
    mvn install:install-file -Dfile=C:\bel\docs\lib\jxl-2.6.3.jar -DgroupId=jexcelapi -DartifactId=jxl -Dversion=2.6.3 -Dpackaging=jar -DgeneratePom -DcreateChecksum=true

  • In your repository, you will find the new jar installed
  • To use the jar, add it in your pom.xml like:
    <dependency>
     <groupId>jexcelapi</groupId>
     <artifactId>jxl</artifactId>
     <version>2.6.3</version>
    </dependency>

Sunday, March 6, 2011

Deployment

  1. Create the package for full release
    1. Check out the Project in Eclipse
      1. Open SVN Repositories. Click Window->Open Perspective->SVN Repository Browser
      2. Assuming that you already have Repository Location set up, find the project in the trunk or branches
      3. Right click project then click Show History to ensure that it has the latest change/fix needed
      4. Tag or make a branch out of the project. Right click project then click New->Tag or Branch
      5. Right click newly created tag/branch then click Show History to ensure that the it has the latest change/fix needed
      6. Check out the newly created tag or branch. Right click project the click Check Out

    2. Build the package
      1. In the console, go to emea-pom of the checked out project
      2. Type
        mvn clean package –DemeaVersion=${currentversion}
      3. After a successful build, go to the emea-release project and copy the whole target folder in a different directory.

  2. Generate the config files/folders of the package
    1. Create a config folder inside the target folder or where the jar is located
    2. Create folders dev, sit, uat and prod inside config folder
    3. Open you FTP Client (e.g. FileZilla) and copy the config files to the newly created folders
      • DEV
      • SIT
      • UAT
      • PROD
    4. Update the ini file with the changes from project and change the VERSION property

  3. Deploy DEV using the exploded jar
    1. In FileZilla, upload/add target/classes/versions to /ams/domains/ACCTSVCS102/versions
    2. In FileZilla, copy target/config/dev to/ams/domains/ACCTSVCS102/versions/config
    3. On DEV WEBLOGIC, stop and delete previously deployed ear
    4. Open Putty and login to DEV (ehdeapp10v.uk.jpmorgan.com)
    5. Point latest to latest deployed version

      1. Go to /ams/domains/ACCTSVCS102/versions/biz-rules
      2. Type rm latest
      3. Type ln -s {newversionFolder} latest
      4. Do step 1-3 to config & emea folders as well

    6. On DEV WEBLOGIC, deploy new ear and start
    7. Delete temporary files

      1. Go to /ams/domains/ACCTSVCS102/scripts and type stop_all.sh
      2. Go to /ams/domains/ACCTSVCS102/servers/admACCTSVCS
      3. Delete tmp folder. Type rm -rf {folderName}
      4. Go to /ams/domains/ACCTSVCS102/servers/mngACCTSVCS
      5. Delete tmp & stage folder
      6. Go to /ams/domains/ACCTSVCS102/scripts and type start_all.sh

    8. Check server: DEV

  4. Copy package(jar) and config files to SIT (ehdeapp10v.uk.jpmorgan.com), /home/eis_dev/a_pfdv01/AMSNA

  5. Create JIRA

  6. Finish!

Sunday, January 16, 2011

Getting started with 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.

Download and extract bin from http://maven.apache.org/download.html

Basics:
http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html

To install a package into your local repository:
1) Open <MAVEN_HOME>/conf/settings.xml
2) Set the local repository
<localRepository>S:/bel/repo</localRepository>
3) Set profile
4) Set what profile to activate
5) Set proxy (optional?)
6) Run mvn install (if variables are needed, add -D{varname}={varValue}). To skip test add <skipTests>true</skipTests> on pom.xml (inside properties tag). To set a default/permanent variable, set it in MAVEN_OPTS environment variable

How to set MAVEN_OPTS
-> set MAVEN_OPTS=-Xmx512M -XX:MaxPermSize=128M
-> add in mvn.bat
1) edit <MAVEN_HOME>/bin/mvn.bat
2) add SET MAVEN_OPTS=-Dmaven.test.skip=true

Note:
- dependencies -> mvn install copies all libraries first from WEB-INF/lib to the snapshot lib before downloading all dependencies declared in pom into the snapshot lib. so make sure to always clean up WEB-INF/lib first before executing mvn install to remove any conflicting jars

Source: http://maven.apache.org/