Skip to content

Development Environment Setup Windows

csaladenes edited this page Feb 7, 2015 · 46 revisions

Required Software

Install Java JDK 7

  • Download from http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html and install.
  • Determine the Java home directory path (under Windows it is usually similar to C:\Program Files\Java\jdk1.7.0_67).
  • Add JAVA_HOME to the environment variables with the value: C:\Program Files\Java\jdk1.7.0_67.
  • Update/create Path environment variable: prepend the value %JAVA_HOME%\bin to make Java available in the command line.
  • Open a new command prompt (Winkey + R then type cmd) and run java -version to verify that it is correctly installed.

Install Maven

  • Download distribution from http://maven.apache.org/download.cgi and unzip the archive (assuming C:\Program Files\Apache Software Foundation\apache-maven-3.2.3)
  • Add M2_HOME to the environment variables with the value: C:\Program Files\Apache Software Foundation\apache-maven-3.2.3.
  • Add M2 to the environment variables with the value: %M2_HOME%\bin.
  • Optional: Add MAVEN_OPTS to the environment variables with the value: -Xms256m -Xmx512m.
  • Update/create Path environment variable: prepend the value %M2% to make Maven available in the command line.
  • Open a new command prompt (Winkey + R then type cmd) and run mvn --version to verify that it is correctly installed.

Install MySQL server

  • Download from dev.mysql.com/downloads/mysql/ and install.;
  • Open a new command prompt (Winkey + R then type cmd) and run mysql -u root -p, type in the password set during installation and verify that it is correctly installed.
  • Executing the following commands in the mysql shell:
CREATE DATABASE xcolab;
CREATE USER 'liferay'@'localhost' IDENTIFIED BY 'liferay';
GRANT ALL PRIVILEGES ON xcolab.* TO 'liferay'@'localhost';
FLUSH PRIVILEGES;

In case you are getting errors talking about date Format. Go to control panel -> region & language -> change to a U.S. type format

Bundles and Source

  1. Download Liferay 6.2 bundled with Tomcat (Community Edition) from http://www.liferay.com/downloads/liferay-portal/available-releases
  • Unzip downloaded bundle, let's call the target folder XCOLAB_BUNDLES_DIR (assuming E:\dev\XCOLAB\XCOLAB_BUNDLES_DIR)
  1. Clone XCoLab GitHub repository: https://github.com/CCI-MIT/XCoLab. Let's call the directory to which the repository was downloaded XCOLAB_SRC ( assuming E:\dev\XCOLAB\XCOLAB_SRC )

  2. Add environment variables. If you have problems, try using \ instead of / for your paths!

  • Add XCOLAB_SRC to the environment variables with the value: E:/dev/XCOLAB/XCOLAB_SRC.
  • Add XCOLAB_BUNDLES_DIR to the environment variables with the value: E:/dev/XCOLAB/XCOLAB_BUNDLES_DIR.
  • Go to XCOLAB_BUNDLES_DIR, check tomcat version (assuming 7.0.42) and add TOMCAT_VERSION to the environment variables with the value: 7.0.42.
  • Add CATALINA_HOMEto the environment variables with the value: %XCOLAB_BUNDLES_DIR%/tomcat-%TOMCAT_VERSION%/bin

Setup for Development

Install and Deploy Services/Portlets

You can find a .bat file under XCOLAB_SRC/script/Install.bat. The script covers steps 5. to 10.

  1. Copy file XCOLAB_SRC/conf/deploy.properties to %USERPROFILE%\.xcolab.deploy.properties, edit that file and set liferay.auto.deploy.dir to XCOLAB_BUNDLES_DIR/deploy. With the given paths your file would look like:
    liferay.auto.deploy.dir=E:/dev/XCOLAB/XCOLAB_BUNDLES_DIR/deploy
    

**If you have problems, try using \ instead of / **

If your Windows has a non-ASCII character, the %USERPROFILE% might not be read correctly by Maven. Try to change it or use a different machine.

  1. First it's needed to put all "parent" artifacts in local maven repository, execute mvn install -N in following dirs

    XCOLAB_SRC
    XCOLAB_SRC/taglibs
    XCOLAB_SRC/themes
    XCOLAB_SRC/services
    XCOLAB_SRC/portlets
    XCOLAB_SRC/hooks
    XCOLAB_SRC/layouts
    
  2. Install plansProposalsFacade-service

    cd XCOLAB_SRC/services/plansProposalsFacade
    mvn install -N
    
    cd XCOLAB_SRC/services/plansProposalsFacade/plansProposalsFacade-portlet-service
    mvn compile package install
  3. install common taglibs/libraries

    cd XCOLAB_SRC/taglibs/colabIceFacelets
    mvn compile package install
    
    cd XCOLAB_SRC/taglibs/colabJspTags
    mvn compile package install
  4. Install plansProposalFacade-portlet

    cd XCOLAB_SRC/services/plansProposalsFacade/plansProposalsFacade-portlet
    mvn compile package liferay:deploy -DskipTests=true
  5. Install theme, layout tmpl and hooks

    cd XCOLAB_SRC/themes/climatecolab-theme
    mvn compile package liferay:deploy
    
    cd XCOLAB_SRC/layouts/climatecolab-layout
    mvn compile package liferay:deploy
    
    cd XCOLAB_SRC/hooks/climatecolab-hooks
    mvn compile package liferay:deploy
  6. Install all portlets

    cd XCOLAB_SRC/portlets

    for each PORTLET go to PORTLET directory and execute mvn compile package liferay:deploy

You can find a .bat file for that under XCOLAB_SRC/script/DeployAllPortlets.bat

cd %XCOLAB_SRC%\portlets
for /D %%I in (*) DO (
if exist %%I\nul ( 
    cd %%I
    echo %cd%
    call mvn compile package liferay:deploy || (
		echo Error: Stopping deploying process, check error message ...
		echo Press Key to exit ...
		pause > nul
		exit
		)
    cd ..
)
)

Configure Liferay and Tomcat

  1. Edit file XCOLAB_BUNDLES_DIR/tomcat-xxx/conf/context.xml

    inside add definition of jdbc/LiferayPool resource, IE:

    <Resource auth="Container" driverClassName="com.mysql.jdbc.Driver" maxActive="100" maxIdle="30" maxWait="10000" name="jdbc/LiferayPool" password="liferay" type="javax.sql.DataSource" url="jdbc:mysql://localhost:3306/xcolab?useUnicode=true&amp;characterEncoding=UTF-8&amp;useFastDateParsing=false" username="liferay"/>
  2. Copy XCOLAB_SRC/conf/portal-ext.properties to XCOLAB_BUNDLES_DIR/tomcat-xxx/webapps/ROOT/WEB-INF/classes

  3. Copy images

    mkdir XCOLAB_BUNDLES_DIR/tomcat-7.0.42/webapps/ROOT/WEB-INF/classes/images
    copy XCOLAB_SRC/conf/member_photo.png XCOLAB_BUNDLES_DIR/tomcat-xxx/webapps/ROOT/WEB-INF/classes/images/
  4. Import database dump. Request it from mailto:pdeboer@mit.edu

    mysql -u liferay -pliferay xcolab < PathToYourDump.sql;
  5. It might be needed to increase permGen and Xmx, go to XCOLAB_BUNDLES_DIR/tomcat-xxx/bin/ edit setenv.bat and change permgen to 512 and Xmx to 2048 (or higher if resources are available)

  6. Unzip simulation client lib into XCOLAB_BUNDLES_DIR/tomcat-xxx/lib/ext

    cd XCOLAB_BUNDLES_DIR/tomcat-xxx/lib/ext
    unzip XCOLAB_SRC/other/simulation-client.zip 
  7. Download document_library.zip and unpack it in XCOLAB_BUNDLES_DIR/data

  8. Create/edit XCOLAB_BUNDLES_DIR/portal-setup-wizard.properties and make sure it looks as follows:

    admin.email.from.name=ClimateColab Administrator
    liferay.home=E:/dev/XCOLAB/XCOLAB_BUNDLES_DIR
    admin.email.from.address=no-reply@climatecolab.org
    setup.wizard.enabled=false

Verify that the path to liferay.home is correct (E:/dev/XCOLAB/XCOLAB_BUNDLES_DIR if you use the given path) **If you have problems, try using // instead of / **

Test

Check https://github.com/CCI-MIT/XCoLab/wiki/Common-Pitfalls for Common Pitfalls.

  1. Run the server:

    XCOLAB_BUNDLES_DIR/tomcat-xxx/bin/startup.bat
    or
    %CATALINA_HOME%/startup.bat
  2. Follow the server logs in the file XCOLAB_BUNDLES_DIR/tomcat-xxx/logs/catalina.out.

    If you get the following exception: "The database contains changes from a previous upgrade attempt that failed.", modify the Release_ MySQL table and set the state_ column of all rows to 0. If you get an error that another version of Liferay is to be deployed, in the Release_ Table change the column buildNumber of the row with releaseid = 1 according to your version of Liferay (e.g. 6201 for Liferay 6.2.1). If you get the ClassNotFoundException for the class "org.xcolab.hooks.climatecolab.mailserverconfig.OverwriteMailServerConfig", try commenting the line "global.startup.events=org.xcolab.hooks.climatecolab.mailserverconfig.OverwriteMailServerConfig" in the portal-setup-wizard.properties file. If you get the ClassNotFoundException for the class "org.xcolab.portlets.members.expando.EnsureCountryExpandoCreated", try commenting the line "application.startup.events=org.xcolab.portlets.members.expando.EnsureCountryExpandoCreated" in the portal-setup-wizard.properties file.

Clone this wiki locally