- After you have downloaded the tomcat bundled Liferay unzip the file which will create a folder named “liferay-portal-6.1.1-ce-ga2-ja”, rename this folder to “server”
- Once you have downloaded the Liferay plugins SDK from the link provided. Before you download the SDK check the version of Liferay you are working on and download the respective SDK.
- After downloading the SDK Zip file unzip the file into a folder called “plugins”.
- Open the plugins folder and make a copy of build.properties file under plugins folder and rename it to build.COMPUTER_NAME.properties.
- Keep the following properties and delete all the others:
7. Do not change any other properties if you are using default setup of Liferay.
- Once you have downloaded the apache ant zip file. Unzip the file and rename the folder to “apache-ant”.
- After unzipping the package we need to set the path for Ant. Open Control Panel and then open Advanced System Settings.
- Click on the “Environment Variable” , Under System Variables click on “New…” button.
- Provide the variable name as “ANT_HOME” and provide the path of apache ant installation path. For example if you have unzipped the Ant zip file under Program Files(x86) then you path should be like “C:\Program Files (x86)\apache-ant-1.8.0\”.
- After setting ant home, we need to set path for the apache ant. Open the system variable with name “Path” in the edit mode and add the following path “C:\Program Files (x86)\apache-ant-1.8.0\bin\” and save the settings.
- Verify installation: to verify whether ant installation was a success open command prompt and type “ant --version” command if you see the version number in the next line then it means installation was successful.
- Once you have downloaded the Apache JMeter, unzip and rename the folder as “apache-jmeter”.
- Open the Control Panel and open Advance System Settings , click on “Environment Variables” button.
- Under system variable click on “New…” button. Provide Variable name as “JMETER_HOME” and provide the path of apache JMeter installation path. For example if you have unzipped the JMeter zip file under Program Files(x86) then you path should be like “C:\Program Files (x86)\apache-jmeter\”.
- After setting jmeter home, we need to set path for the apache jmeter. Open the system variable with name “Path” in the edit mode and add the following path “C:\Program Files (x86)\apache-jmeter\bin\” and save the settings.
- Verify installation: to verify whether jmeter installation was a success open command prompt and type “jmeter --version” command if you see the version number in the next line then it means installation was successful.
- After downloading the latest version of Sonar from the link provided, unzip the file and rename the folder to “sonar”.
- Create a database called “sonar” in the mysql database.
- Under the sonar directory open the conf folder and then open sonar.properties file. sonar.jdbc.username: rootsonar.jdbc.password: root
- Uncomment the following line by removing ‘#’ symbol for configuring the Sonar with MySql database sonar.jdbc.url: jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8 sonar.jdbc.driverClassName: com.mysql.jdbc.Driver
- Start the sonar server by running the file “
\bin\windows-x86-32\StartSonar.bat” - Once the server starts up with no errors you will see the following log : "Started SelectChannelConnector@0.0.0.0:9000”
- Open the browser and hit the URL : http://localhost:9000/
- Login using the following default credentials: username: admin password: admin
- If you are able to login then it means that you have completed the setup of Sonar successfully.
- Download the sonar ant task jar file from this link and place it inside lib folder of
directory. - Open build.xml file under the “plugins” directory and add the following code:
</taskdef>
<!-- Add the target -->
<target name="sonar">
<property name="sonar.jdbc.url" value="jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8" />
<property name="sonar.jdbc.driverClassName" value="com.mysql.jdbc.Driver" />
<!-- the username and password of your database -->
<property name="sonar.jdbc.username" value="root" />
<property name="sonar.jdbc.password" value="root" />
<!-- list of mandatories Sonar properties -->
<property name="sonar.sources" value="<relative-path-to-src-folders> " />
<property name="sonar.projectName" value="<project-name> " />
<property name="sonar.binaries" value="<relative-path-to-classes>" />
<property name="sonar.libraries" value="<relative-path-to-lib>" />
<sonar:sonar key="<project-name>" version="0.1-SNAPSHOT" xmlns:sonar="antlib:org.sonar.ant"/>
</target>
4. Once the build for portlets is successful run ant task “ant sonar” to generate sonar reports. Make sure sonar task doesn’t throw any errors.
5. Login to the Sonar server to see the results.
6. If you face any heap size while running sonar task use the following command:
for linux : export ANT_OPTS=-Xmx1g
- Before you configure Sonar with JMeter you need to configure JMeter with Liferay. Please follow this link and once you have completed a test case with Liferay export the result as .jtl file.
- To configure JMeter with Sonar download the JMeter Reporting Server from this link.
- Once you have downloaded unzip the file and add configuration related to project as the following: testconfig.project_name.desc=project_name testconfig.project_name.prject=PATH_TO_JTL_FIL
- Here "testconfig.project_name.desc" is the name of Project. and "testconfig.project_name.jtlpath" is the path of Jmeter report file.
- Once you are done with changes in jmeter-report-server.properties file, then start Jmeter Report server by running jmeter-report-server.bat on Windows platform.\
- Select Project in which you want to show output of Jmeter Load test result. Go to project Settings -> Jmeter.
- Add below configuration and click on "Save Jmeter Settings" button: Remote config name=project_name Remote server host=
Remote server port=5555 - Now when next build will run, Sonar-Jmeter will show out of Jmeter Result file.