apache_maven

Doxygen phpDocumentator phpunit-logo teamcity512 maven4php

Maven for PHP uses the power of Maven for building, reporting on and creating documentations of PHP projects. It adapts the Maven build lifecycle to the PHP world while fully supporting PHP 4 and PHP 5. PHP for Maven uses PHPUnit for unit testing and doxygen for creating the api documentation.
Use a PHP library project to create a library that can be used by other PHP libraries or PHP web projects. Use a PHP web project to create a standalone web project.

So I quickly describe what I did install on my root server (OpenSuse 11.X)

My Objectives: being able to build all my Joomla! component using best agile development practices

“Specific tools and techniques such as continuous integration, automated or xUnit test, pair programming, test driven development, design patterns, domain-driven design, code refactoring and other techniques are often used to improve quality and enhance project agility.”

Maven

While not needed as TeamCity has an integrated Maven engine, I would like to use an external MAVEN version, in order to have the latest version and living dangerously on the edge!

So I download

# wget http://apache.mirror.testserver.li/maven/binaries/apache-maven-2.1.0-bin.tar.gz

And unpack

# tar xvf apache-maven-2.1.0-bin.tar.gz

Since I would like to avoid having a version number in my configuration build path, I create a symlink

# ln -s apache-maven-2.1.0 maven

I just now tell TeamCity to use my own Maven version, by specifying the Maven Home Path

teamcity.maven4php 

phpDocumentor

phpDocumentor is an open source documentation generator written in PHP. It automatically parses PHP source code and produces readable API and source code documentation in a variety of formats. phpDocumentor generates documentation based on PHPDoc-formatted comments and the structure of the source code itself. It supports documentation of both object-oriented and procedural code. phpDocumentor can create documentation in HTML, PDF, CHM or Docbook formats.

Can be installed using PEAR, simply run

# pear upgrade PhpDocumentor
downloading PhpDocumentor-1.4.2.tgz ...
Starting to download PhpDocumentor-1.4.2.tgz (2,421,028 bytes)
..............................................................................done: 2,421,028 bytes
upgrade ok: channel://pear.php.net/PhpDocumentor-1.4.2

PHPUnit

PHPUnit is a unit testing framework for the PHP programming language. Created by Sebastian Bergmann, PHPUnit is one of the xUnit family of frameworks that originated with Kent Beck's SUnit.

Can be installed using PEAR, simply run

# pear upgrade PHPunit

DOxygen

Doxygen is a documentation generator for C++, C, Java, Objective-C, Python, IDL (Corba and Microsoft flavors), Fortran, VHDL, PHP, C#, and to some extent D. It runs on most Unix-like systems, including Mac OS X, as well as on Windows. The first version of Doxygen borrowed some code of an old version of DOC++; later, the Doxygen code was rewritten by Dimitri van Heesch. from www.doxygen.org

# zypper se doxy
Lese installierte Pakete...

S | Name       | Zusammenfassung                                    | Typ 
--+------------+----------------------------------------------------+------
  | doxygen    | Automated C, C++, and Java Documentation Generator | Paket
  | doxywizard | Graphical User Interface for Doxygen               | Paket

# zypper in doxygen

Herunterladen von Paket doxygen-1.5.5-17.1.x86_64 (1/1), 2,3 M (6,2 M installiert)
Lade herunter: doxygen-1.5.5-17.1.x86_64.rpm [fertig] 
Installiere: doxygen-1.5.5-17.1 [fertig]

Artifactory

Prepare Artifactory by adding new Maven for PHP repositories

At http://maven.waltercedric.com/artifactory/webapp/repositoryconfig.html

As Admin user (you cant go to that links without being an admin!), add 2 new repositories

teamcity.maven4php.artifactory

In Maven settings.xml

In order to use Artifactory at his best (proxy and caching of remote repositories), I have a Maven settings.xml that contains ONLY

# vi /home/teamcity/.m2/settings.xml

<activeProfiles>
  <activeProfile>cedric-profile</activeProfile>
</activeProfiles>

<profiles>
   <profile>
        <id>cedric-profile</id>
        <activation>
        <activeByDefault>true</activeByDefault>
        </activation>
<repositories>
    <repository>
        <id>central</id>
        <url>http://maven.waltercedric.com/artifactory/repo/</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
    <repository>
        <id>snapshots</id>
        <url>http://maven.waltercedric.com/artifactory/repo/</url>
        <releases>
            <enabled>false</enabled>
        </releases>
    </repository>
</repositories>
<pluginRepositories>
    <pluginRepository>
        <id>central</id>
        <url>http://maven.waltercedric.com/artifactory/plugins-releases/</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </pluginRepository>
    <pluginRepository>
        <id>snapshots</id>
        <url>http://maven.waltercedric.com/artifactory/plugins-snapshots/</url>
        <releases>
            <enabled>false</enabled>
        </releases>
    </pluginRepository>
</pluginRepositories>
    </profile>
  </profiles>
</settings>

Attention: Artifactory WIKI tell to use http://maven.waltercedric.com/artifactory/plugins-releases and not http://maven.waltercedric.com/artifactory/plugins-releases/ on my HOST with mod_proxy it made an error 404 If I do not add a slash at the end. Try with your host before, you will gain a lot of time by checking if the URL is valid!

Note that http://url:port/artifactory/repo/ is a virtual repositories that proxy all external repositories

 

Eclipse

Use SolarJoomla (hopefully to be distributed this week) to have a running Eclipse, PDT, Maven 4 PHP environment, Mylyn, TeamCity in no time

Lets build!

First I create a new Maven Project with Archetype “Maven for PHP” “PHP5 libraries”

In TeamCity I did create a new project “Joomla 15 components plugins and modules” and a new Build “MyGuestbook”.

teamcity.maven4php.myguestbook

The first build failed with

[INFO]  PHP Warning: require_once(PHPUnit/TextUI/TestRunner.php): failed to open stream: Operation not permitted

This is because of my PHP security restrictions, I only allow file to be opened from /home/teamcity/

So I just add

/home/teamcity/TeamCity/buildAgent/ to my open_basedir in my php.ini

; open_basedir, if set, limits all file operations to the defined directory
; and below.  This directive makes most sense if used in a per-directory
; or per-virtualhost web server configuration file. This directive is
; *NOT* affected by whether Safe Mode is turned On or Off.
open_basedir = /srv/www/vhosts:/tmp:/home/teamcity/TeamCity/buildAgent/

To be continued

So long an empty PHP project is building successfully, tomorrow I will try to make a REAL Joomla! component build there!

As soon as It works, and all my Joomla! components are running in TeamCity, I will try to achieve the same goal in Bamboo, why? because it is simply . . .fun!

Links

You might like also

Failed opening required PHPUnit/TextUI/TestRunner.php in Maven For PHP
This issue has turn me upside down a long time. In fact in the official Google Group http://groups.google.de/group/maven-for-php/ I was not the only one to have this issue. I did try the following, and it is always good to check first Checking PHP version, Starting #Maven with -X for having more debug information Testing it in Eclipse + M2Eclipse on windows, was working there, Comparing calculated PHP include path on Windows and #Linux: they were identical in this case Only …
3598 Days ago
When Joomla! meet Maven for PHP
I will quickly describe in this post how you can code your component/plugins/modules against a specific version of #Joomla! with no effort using #Maven for PHP. The trick I made is to package the whole #Joomla distribution in a jar file, and add a #Maven dependency to the project. As #Joomla, PHPUnit, or any other 3rd party is not a set of class packaged in a jar, the brilliant idea of #Maven for PHP is to unpack all these dependencies …
3889 Days ago
My 2 first Joomla! component in continuous build
Status/Done Build with Maven For PHP in TeamCity SVN repository at http://joomlacode.org/svn/com_securityi1/trunk/ and http://joomlacode.org/svn/com_akobookplus/trunk/ Totally independent of continuous build server (Thanks to MAVEN), so Hudson, Bamboo and Cruise Control are SUPPORTED. …
3890 Days ago
No Thumbnail was found
I put some effort the last few days in this new framework. Done: I did document some part of it at http://wiki.waltercedric.com/index.php?title=ContinuousBuildforJoomla TeamCity is installed/configured/documented (windows only) XAMPP is installed/configured/documented (windows only) I also at the same time configured a Puppy #Linux VMWare image that will permit to anybody to have a running environment in no time. I am able to unpack all #Joomla! versions that are committed in any repository (CVS, SVN, Clearcase) They can be unpacked anywhere on …
3977 Days ago
Installing PHPUnit / Selenium in XAMPP
    A small how to install PHPUnit via PEAR in an XAMPP running on a windows box. A prerequisite for a continuous build strategy. PHPUnit is a member of the xUnit family of testing frameworks and provides both a framework that makes the writing of tests easy as well as the functionality to easily run the tests and analyze their results. PHPUnit homepage ONLamp.com - Testing PHP Code with PHPUnit Planet PHPUnit Sebastian Bergmann (creator of PHPUnit) Installing XAMPP …
4002 Days ago
ContinuousBuild4Joomla project submitted to JoomlaCode.org
I will commit soon a first draft (alpha) of what is expected to bring continuous build to any #Joomla! component (or event to #Joomla! core itself ;-)) You are free to join the project, all documentation effort stay at the moment in my WIKI   …
4024 Days ago
No Thumbnail was found
Automatic installation of #Joomla! runtime environments Main ideas Build is scalable Distributed build management optimize hardware resources utilization by parallelizing product builds within the build agents grid. With build chains support, it is even possible to break down a single build procedure into several parts to run them on different build agents — both in sequence and in parallel — using the same set of sources in all of them. I want to be able to test my components against …
4029 Days ago