So it's pretty clear to me that I just have a partial understanding of the tools at work here. In my mind I'm trying to do something pretty simple. I have a project that includes a php-based site, and my assumption is that I should be able to design my project in such a way that I can issue a single "mvn something something" command that (among other things) would deploy (literally: move to correct directory) the required php scripts to a web directory. Yes, I am assuming that I'm issuing this mvn command on the actual machine that will host my app. (Is that weird?)
I'm assuming that I'm thinking about this too much like if I were using ant ("move this crap from point A to point B please, ant"...) and am looking for someone to help straighten me out. The documentation (and similar searches on stackoverflow) haven't led me to a solution yet. (I tried!)
So far I understand that .php pages should go under my-app/src/main/php/webapp/whatever.php ... that's fine, check that off the list.
my-app
|-- pom.xml
`-- src
|-- main
| `-- php
| |-- lib
| | `-- org
| | `-- sample
| | `-- app.php
| `-- webapp
| `-- index.php
|`-- test
| `-- php
| `-- org
| `-- sample
| `-- apptest.php
`-- site
|-- site.xml
`-- apt
`-- index.apt
php-maven dot org/tags/2.0.2/php-web-10min.html
A fair suggestion I encountered was that Maven will assume that you want to package your php app prior to deploying it, presumably as a phar file. I'm ok with this, I don't currently use phar, but if it's required to make this work, then I'm up for it. (If I have pulled code from a git repo, I already have the right .php files ready to go, they just need to go to the right place-- it's not like my php is compiled, so I'm a bit confused as to why I care about this step, or if it would really be necessary.)
sitepoint dot com/maven-and-php/
Building on that last idea, apparently it is possible to use Maven to extract the contents of a phar file to a particular directory. The example in the link looks like somewhat of a one-off command line instruction (it requires multiple -D parameters and doesn't appear that it would be executed as part of a more mundane goal like "deploy"?) This is sort of along the lines of what I envision, but apparently not the "right" or "conventional" answer. (Again, I'm probably thinking of this much in the way that one would use ant.)
php-maven dot org/tags/2.0.2/tut-tools-phar.html
The most promising section from the documentation gives some information on how to "deploy" a phar package, but in this instance it looks like "deploy" is meaning "upload the project package somewhere so that others are able to find and use it".. which isn't really what I'm after. The next section "Deploy the site" (mvn site-deploy) might be what I am after?-- I assume we are specifying a place to send the "built" php site with this description:
php-maven dot org/tags/2.0.2/tut-lifecycle-deploy.html
<project>
...
<distributionManagement>
...
<site>
<id>project-site.mydomain.org</id>
<name>My releases</name>
<url>ftp://ftp dot mydomain.org/documentation</url>
</site>
...
</distributionManagement>
...
</project>
However this seems a bit weird that we would need to use ftp/sftp to "send" the files to a presumably remote server. After all, I'm assuming we are running "mvn do-the-thing" on the actual server that is hosting my app. (Are we defaulting to assume that we are always building/deploying on a machine that will not host a web app?) I could of course work around this by setting up ftp/sftp access on the host... in order for it to access itself... to move the files to itself... which all sounds a little silly. Furthermore, I'm assuming this is "deploying" the files from /target/site -- but that's a little implicit (much like other things in Maven!)
Folks, what exactly am I missing here? It can't be this hard. Did I miss something on page 2 of the manual? Is my entire life a lie? Is maven just really confusing at first? Help is much appreciated.
For what it's worth I am attempting to deploy to a Windows/IIS/PHP host, which in retrospect I somewhat regret.
Thanks!