Another way to install GateIn is by getting the source code from the JBoss SVN repository and then compiling it to generate the build artifacts as you found in the binary package.
The goal of building GateIn from the source code is to have the possibility to freely customize it. Another useful reason for building from source is that you simply want to contribute to the project and test your fixes before applying the patch on the issue tracker.
Notice that this book is based on GateIn 3.2.0, which has its source code based on the SVN repository. From GateIn 3.3.x the source code is based on a GitHub repository. For more information about how to build from GitHub, please see https://github.com/gatein/gatein-portal.
Let's first see if you have installed in your machine the following needed components:
Let's check your environment for the see following required tools:
svn --version
If the SVN client is correctly installed you should see output similar to the following:
svn, version 1.6.17 (r1128011) compiled Aug 25 2011, 17:31:03 Copyright (C) 2000-2009 CollabNet. Subversion is open source software, see http://subversion.apache.org/
If the svn command is not found in the scope of your operating system, then you can install it by following the instructions available on the official website, depending on your operating system, at http://subversion.apache.org/packages.html.
mvn --version
After running the command, you should see an output similar to the following:
Apache Maven 3.0.4 (r1232337; 2012-01-17 09:44:56+0100) Maven home: /Users/piergiorgiolucidi/tools/apache-maven-3.0.4 Java version: 1.6.0_29, vendor: Apple Inc. Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home Default locale: it_IT, platform encoding: MacRoman OS name: "mac os x", version: "10.6.8", arch: "x86_64", family: "mac"
If the mvn command is not found in your machine then it could mean either of the following two things:
We are going to assume that maven is not installed. In this way, we will describe both the cases:
Notice that you have to set two environment variables to allow Maven to work correctly, so please be sure to set the PATH
and M2
variables before continuing. For instance, for a Linux-based operating system, you should have a snippet in your profile configuration file similar to the following:
export M2_HOME="/Users/piergiorgiolucidi/tools/apache-maven-3.0.4" export M2=$M2_HOME/bin export MAVEN_OPTS="-Xms512m -Xmx1024m -Xss1024k -XX:MaxPermSize=256m -XX:NewSize=256m" export PATH=$M2:$PATH
Now we are ready to check out the source code. For this book, we will consider the current latest stable version of GateIn Portal, which is version 3.2.0.
svn checkout http://anonsvn.jboss.org/repos/gatein/portal/tags/3.2.0-GA/ gatein-portal-3.2.0
gatein-portal-3.2.0
in the folder where you have executed the command that contains all the source code of the project./Applications/Apache Tomcat/apache-tomcat-6.0.32
folder, you have to execute the following command line from the root folder of the project that contains the main pom.xml
file:mvn clean install -DskipTests -Ppkg-tomcat -Dexo.projects.directory.dependencies=/Applications/Apache Tomcat -Dexo.projects.app.tomcat.version=apache-tomcat-6.0.32
Upon completion, you should see the following output:
[INFO] ------------------------------------------- [INFO] BUILD SUCCESS [INFO] -------------------------------------------
The binary artifacts will be available on your machine inside the /gatein-portal-3.2.0/packaging/tomcat/pkg/tc6/target/tomcat6
folder.
As you have seen, the GateIn packaging process relies upon Apache Maven to execute the build process of the project. However, Maven allows you to manage the entire lifecycle process of the project and its own children modules by starting a command from a parent Project Object Model (POM).
In this recipe, we have invoked two Maven phases to execute the build process of the project—the clean phase and the install phase.
The clean phase will remove all the compiled artifacts created by prior builds to initialize the build state of the project. Typically, the final result of the clean goal is that the target folder will be removed for each submodule of the project.
The install phase will start the complete Maven lifecycle executing all the phases up to install. The details of this execution process are as follows:
Each phase is responsible for specific goals that need to be processed before the next phase.
The parameter skipTests
used in the previous Maven command allows skipping the execution of tests from the lifecycle process. This means that when Maven is executing, the entire process will skip the execution of the
test phase for each module.
So if you want to contribute to the project or you are customizing the product for your needs, you will probably want to remove this parameter. This is because if you want to be sure that your own implementation correctly works with all the other modules included in GateIn, you probably want to execute all the tests included in the project.
18.189.188.238