php-maven / maven-php-plugin

A maven plugin for dependency management and quality assurance for PHP projects.
http://www.php-maven.org/
Apache License 2.0
37 stars 29 forks source link

Creating custom artifacts #3

Closed pulse00 closed 12 years ago

pulse00 commented 12 years ago

I'm currently looking into solutions to "bootstrap" project skeletons for the Symfony2 framework, which comes with a standard distribution: https://github.com/symfony/symfony-standard.

Based on this standard distribution, there are very common setups with additional configuration and bundles/plugins. These setups need to be configured manually when the project is created, so using a maven artifact to do this automatically would be handy.

The documentation only mentions the main/test/site structure for projects, but the Symfony2 framework needs it's own structure. Is there a way to create custom artifacts using this maven plugin?

mepeisen commented 12 years ago

Hi. This is not available for know. But in future versions we will support various frameworks. There will be plugins that are aware of creating framework related packages.

There is no timeline yet. What type of setup do you need?

pulse00 commented 12 years ago

i'm looking for a generic solution which is not framework dependent. This would improve the process of setting up php projects with recurring configurations, for example:

So basically, if you have one of the above setups finished, you can create an archetype from that which will re-initialize any future project with the same skeleton.

If i can help out with that, please let me know.

mepeisen commented 12 years ago

First of all you should devide projects that are simply requiring a directory layout from those that require additional work.

For example a typical Zend project simply requires a directory layout. It will be nicrely integrating with php-maven since the only task is to setup a proper bootstrap for phpunit execution and the project itself. A archetype may only contain a bootstrap script to run the zend autoloader, the dependencies to zend itself and one or two examples.

The typical web project from scratch devides several folders. They will nicely integrate with php-maven as long as a) src/main/php contains all the needed files (index.php as well as library). For example src/main/php/webroot may contain the index.php and src/main/php/lib may contain the class files. b) Some aaditional output folders should be configured, Maybe via pom.xml inclusion of an additional build action. I am thinking of folders like smarty template cache.

The third one is more dificult to be that generic. Let us think of flow3 (typo3 phoenix). It contains a package manager. Well, only unpacking the stuff won't work. And it contains a different directory layout requiring to have the test cases at a very different location. However before starting there need to be some additional setup. It may integrate with php-maven and with a huge pom.xml that adds some additional actions to the whole build process. However for this one I don't see any point why using php-maven at all.

And that's the point: Everything that is really some kind of "php-like" stuff, will be working. Project types such as flow3 won't be working with php-maven ever. So we are planning to have some plugin mechanism. Some kind of stuff that tells php-maven that the project is not a "normal" php-project at all. This requires to use a different packaging type. Maybe packaging:flow3pck instead of packaging:phar. This prevents anyone from loading a flow3pkg within a non-flow3 web application. Simply because the php-maven core does not know how to handle a flow3pkg dependency. But the flow3 extension will know how to load a normal jar file for 3rd party library inclusion.

Another example is the pre-work that is needed to generate ddl and other things from models. Php-maven will never support this one directly. But - and that is important - maven itself supports to configure additional invocations during build. There is already a small goal in php-maven 2.0 that is able to invoke any php script during build. Typically generating resources is a build phase in maven. You are able to invoke some configuration scripts that automatically create some files a framework needs. You are even able to creat them in target/classes so that they are packed in the phar.

mepeisen commented 12 years ago

This weekend I will publish some research document with a possible solution. Targeted for version 2.1. I will publish a link here.

mepeisen commented 12 years ago

Closed. Please review the PHP Maven 2.1 analysis draft. It is trying to declare a flexible way for frameworks, validations and controlling things that are going on. https://groups.google.com/forum/?fromgroups#!topic/maven-for-php/wKzpnAiDT1U