Maven PHP Basic存储库

Whatever I try I can not get a basic working maven environment for php, despite all efforts I have found on the internet. To start with the basic Settings.xml in the .m2 repository gives errors because that repo is not there anymore, so I use

<settings>
   <mirrors>
      <mirror>
         <!--This sends everything else to /public -->
         <id>nexus</id>
         <mirrorOf>*</mirrorOf>
         <url>http://sxgio.servehttp.com/nexus/content/groups/public</url>
      </mirror>
   </mirrors>
   <profiles>
      <profile>
         <id>profile-php-maven</id>
         <pluginRepositories>
            <pluginRepository>
               <id>release-repo1.php-maven.org</id>
               <name>PHP-Maven 2 Release Repository</name>
               <url>http://repos.php-maven.org/releases</url>
               <releases>
                  <enabled>true</enabled>
               </releases>
            </pluginRepository>
            <pluginRepository>
               <id>snapshot-repo1.php-maven.org</id>
               <name>PHP-Maven 2 Snapshot Repository</name>
               <url>http://repos.php-maven.org/snapshots</url>
               <releases>
                  <enabled>false</enabled>
               </releases>
               <snapshots>
                  <enabled>true</enabled>
               </snapshots>
            </pluginRepository>
         </pluginRepositories>
         <repositories>
            <repository>
               <id>release-repo1.php-maven.org</id>
               <name>PHP-Maven 2 Release Repository</name>
               <url>http://repos.php-maven.org/releases</url>
               <releases>
                  <enabled>true</enabled>
               </releases>
            </repository>
            <repository>
               <id>snapshot-repo1.php-maven.org</id>
               <name>PHP-Maven 2 Snapshot Repository</name>
               <url>http://repos.php-maven.org/snapshots</url>
               <releases>
                  <enabled>false</enabled>
               </releases>
               <snapshots>
                  <enabled>true</enabled>
               </snapshots>
            </repository>
            <repository>
               <id>snapshot-nexus.org</id>
               <name>Nexus repo</name>
               <url>http://nexus.php-maven.org/content/repositories/php-maven-plugin-snapshots</url>
               <releases>
                  <enabled>false</enabled>
               </releases>
               <snapshots>
                  <enabled>true</enabled>
               </snapshots>
            </repository>
         </repositories>
      </profile>
   </profiles>

   <activeProfiles>
      <activeProfile>profile-php-maven</activeProfile>
   </activeProfiles>
</settings>

and furthermore the pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project>
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.phpmaven</groupId>
        <artifactId>php-parent-pom</artifactId>
        <version>2.0.2</version>
    </parent>

    <properties>
        <phpmaven.release.number>2.0.2</phpmaven.release.number>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <phpunit.version>3.6.10</phpunit.version>
    </properties>

    <groupId>nict.sample</groupId>
    <artifactId>mvn-nict-webapp</artifactId>
    <version>2.0.2-SNAPSHOT</version>
    <packaging>php</packaging>

    <name>PHP 5 web Project</name>
    <description>Sample PHP 5 web project.</description>
    <url>http://www.php-maven.org</url>
    <inceptionYear>2008</inceptionYear>

    <build>
        <plugins>
            <plugin>
                <groupId>org.phpmaven</groupId>
                <artifactId>maven-php-plugin</artifactId>
                <!-- version>${phpmaven.plugin.version}</version -->
                <extensions>true</extensions>
                <configuration></configuration>
            </plugin>

            <!-- <plugin>
                <groupId>org.sample</groupId>
                <artifactId>own-plugin</artifactId>
                <version>1.0-SNAPSHOT</version>
                <extensions>true</extensions>
            </plugin> -->

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>3.0</version>
                <inherited>true</inherited>
                <configuration>
                    <reportPlugins>
                        <plugin>
                            <groupId>org.phpmaven</groupId>
                            <artifactId>maven-php-plugin</artifactId>
                            <version>${phpmaven.plugin.version}</version>
                            <reportSets>
                                <reportSet>
                                    <reports>
                                        <report>phpdocumentor</report>
                                        <report>phpunit-coverage</report>
                                        <report>phpunit</report>
                                    </reports>
                                </reportSet>
                            </reportSets>
                        </plugin>
                    </reportPlugins>
                </configuration>
            </plugin>

        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>de.phpunit</groupId>
            <artifactId>PHPUnit</artifactId>
            <version>${phpunit.version}</version>
            <scope>test</scope>
            <type>phar</type>
        </dependency>
    </dependencies>
</project>

What on earth is going wrong. It seems so simple and yet no result. Is the PHP maven project stopt in 2012, I see no updates on the repo-site

You're not alone. It indeed looks like php-maven is no longer under development.

Alternatives:

  • phing

Other bits and pieces

  • composer
  • phpunit
  • jenkins

Articles

With the massive rise of Composer in the last couple of years PHP Maven does not make any sense any more. Stick to the toolset the PHP community provides, it will make things much easier for you.

Back at #phpnw14 I gave I presentation about Composer and how we use it at my company. You might want to check it out as well.

If you are still interested I have one of the examples from the php-maven tutorials building using the repository indicated in a thread on the maven-for-php Google Groups.

The September 29, 2014 reply in that thread indicates that at least one developer is actively working on maven-for-php. My highly unofficial settings.xml currently looks like this:

<settings>
    <profiles>
        <profile>
            <id>profile-php-maven</id>
            <pluginRepositories>
                <pluginRepository>
                    <id>release-repo1.php-maven.org</id>
                    <name>PHP-Maven 2 Release Repository</name>
                    <!--<url>http://repos.php-maven.org/releases</url> -->
                    <url>https://nexus2.deviapps.com/nexus/content/groups/dev-public/</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                </pluginRepository>
                <pluginRepository>
                    <id>snapshot-repo1.php-maven.org</id>
                    <name>PHP-Maven 2 Snapshot Repository</name>
                    <!--<url>http://repos.php-maven.org/snapshots</url>-->
                    <url>https://nexus2.deviapps.com/nexus/content/groups/dev-public/</url>
                    <releases>
                        <enabled>false</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </pluginRepository>
            </pluginRepositories>
            <repositories>
                <repository>
                    <id>release-repo1.php-maven.org</id>
                    <name>PHP-Maven 2 Release Repository</name>
                    <!--<url>http://repos.php-maven.org/releases</url>-->
                    <url>https://nexus2.deviapps.com/nexus/content/groups/dev-public/</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                </repository>
                <repository>
                    <id>snapshot-repo1.php-maven.org</id>
                    <name>PHP-Maven 2 Snapshot Repository</name>
                    <!-- <url>http://repos.php-maven.org/snapshots</url> -->
                    <url>https://nexus2.deviapps.com/nexus/content/groups/dev-public/</url>
                    <releases>
                        <enabled>false</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </repository>
            </repositories>
        </profile>
    </profiles>

    <activeProfiles>
        <activeProfile>profile-php-maven</activeProfile>
    </activeProfiles>
</settings>

Don