Menu

How to set up development enviroment

2009-02-19
2013-04-08
  • Ignas Lelys

    Ignas Lelys - 2009-02-19

    How to set up development environment?

    Install java (i use JDK6)

    Download and install maven.

    Download and install Eclipse IDE for Java EE Developers from http://www.eclipse.org/downloads/

    In eclipse File -> New -> Other -> CVS -> CVS Repository location
    Host: igdo.cvs.sourceforge.net
    Repository path: /cvsroot/igdo
    User: anonymous
    Connection type: pserver

    Then checkout all projects from cvs
    File -> New -> Other -> CVS -> Projects from CVS
    (igdo-resources, igdoshop, igdoshop-admin, igdoshop-commons, igdoshop-domain, igdoshop-misc, igdoshop-services, igdoshop-services-api, igdoshop-services-ear)

    Eclipse needs to know the path to the local maven repository. Therefore the classpath variable M2_REPO has to be set. Execute the following command:
    mvn -Declipse.workspace=<path-to-eclipse-workspace> eclipse:add-maven-repo

    Go to igdoshop-misc/config and install parent pom (main.sh or main.bat)

    Go to projects igdoshop-commons, igdoshop-domain, igdoshop-services-api and run:
    mvn install

    Go to each of those projects folders and run:
    mvn eclipse:eclipse
    mvn install
    That will take some time.

    A little bit about maven, if you never used it. This is very good introduction: http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html
    So what actually happening when we are building igdo with maven? mvn eclipse:eclipse command sets up project for eclipse ide. It downloads any dependencies if needed and sets it in buildpath, so eclipse should not show any problems after you do this and refresh project. If you start using new lib, or eclipse shows any problems, but project builds fine, you might need to run mvn eclipse:eclipse again.
    Command mvn package just builds project and packages it (to war or jar...). You can find result in projects target folder. But usually i use another command: mvn install which is same as mvn package just also installs package in local repository. You must run this on igdoshop-commons igdoshop-domain igdoshop-services-api, since these projects must be in repository, because they are dependencies for other projects.

    I had some problems with igdoshop-commons unit tests. If you have problems too, delete them for now. Delete whole folder, and testng.xml file.

    Refresh projects in eclipse. If you still see errors, Project->clean might help.

    Go to "Configure build path" (right click on project -> build path -> configure build path
    In igdoshop, igdoshop-services and igdoshop-admin projects add projects:
    igdoshop-commons
    igdoshop-domain
    igdoshop-services-api

    In eclipse open ant view (window -> show view -> ant)
    Now you can go to igdoshop-commons igdoshop-domain igdoshop-services-ear and igdoshop-misc/config and drag n drop build.xml files to ant view. So you can build those projects without leaving eclipse. When building ear you can also copy it to glassfish autodeploy directory (look for example in main.sh, so if you use linux just change your path). Now igdo-config has to be build if you change anything in parent pom (for example library version).

    Download and install Glassfish application server:
    https://glassfish.dev.java.net/downloads/v2ur2-b04.html

    Install mysql.
    Create database and run scripts from igdoshop-misc/sql (recomend using mysql query browser)

    Configure glassfish datasource:
    http://www.albeesonline.com/blog/2008/08/06/creating-and-configuring-a-mysql-datasource-in-glassfish-application-server/
    Datasource jndi name is jdbc/IGDODS. I remember I also had problems with username and password before. If you run in such problems try to enter new pool properties user and password (all lowercase, by default there are User and Password) and restart domain. Also do not forget you url has
    to be with database name 

    Build igdoshop-services-ear and deploy it in glassfish (applications -> enterprise applications).

    Igdo-resources project is responsible for retrieving images for item. Images are saved on filesystem, not in db. If you ran db_data.sql you already added some sample items to db. But items has pictures, so you need to copy igdoshop-misc/sample-pictures folder to your computer. Then create folder named 'yourName' in igdo-resources/src/main/resources and in folder 'yourName' create images.properties file(same like others, just your path to images). Then change build.properties environment variable to 'yourName'. Build and deploy igdo-resources and you should have eshop with images.

    Can look at logs at application server -> view log files. It will be helpful when programing also.

    Goto igdoshop project and run mvn jetty:run
    Goto localhost:9090/shop

    At that time time system should work normally. Later i'll write how to configure eclipse. If you have any questions ask.

     
    • batek

      batek - 2009-03-26

      Note that igdoshop-domain is a prerequisite for igdoshop-commons, so igdoshop-domain should be built before (mvn install).

       
    • Ignas Lelys

      Ignas Lelys - 2009-04-07

      Also please use exactly  the same version of glassfish as from the link provided. Other version probably won't work.

       

Log in to post a comment.