2013-04-15 41 views
1

我想通過把下面的命令來創建使用maven PHP項目:Maven的錯誤:所需的原型不存在(org.phpmaven:PHP5的web-原型:2.0-SNAPSHOT)

sudo mvn archetype:generate -DarchetypeGroupId=org.phpmaven 
    -DarchetypeArtifactId=php5-web-archetype -DarchetypeVersion=2.0-SNAPSHOT 
    -DgroupId=org.sample -DartifactId=my-app -Dversion=0.0.1-SNAPSHOT 

但給我錯誤:

Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:generate (default-cli) 
    on project standalone-pom: The desired archetype does not exist (org.phpmaven:php5-web-archetype:2.0-SNAPSHOT) -> [Help 1] 
+0

從哪裏獲得該命令?你有沒有遵循準備步驟?在此之前您已經採取了哪些步驟? – eis

+0

我從http://www.php-maven.org/branches/2.0-SNAPSHOT/php-web-5min.html得到了這個命令,並且我還遵循了準備步驟(例如在.m2/repository /中創建settings.xml。但仍然給我同樣的錯誤。我在哪裏做錯了? – user2282615

回答

3

顯然你正在嘗試關注these instructions。如果這樣做,則還應該執行已列出的preparation steps

這樣做是因爲您依賴快照原型,而這些不在默認存儲庫中,因此您必須配置php-maven快照存儲庫。

這樣做之後,

  1. 確認你的settings.xml位置(在評論中指出,你有你在錯誤的文件夾)
  2. 嘗試

    mvn archetype:generate -DarchetypeGroupId=org.phpmaven.sites -DarchetypeArtifactId=php5-web-archetype -DarchetypeVersion=2.0.0-beta-1 -DgroupId=org.sample -DartifactId=my-app -Dversion=0.0.1-SNAPSHOT

既然你可以從the repo看到那個原型版本應該在地點。注意不同的archetypeversion和不同的archetypegroupid!

+0

我也已經完成了http://www.php-maven.org/prepare.html中所述的準備步驟。我已經在m2/repository中創建了settings.xml/ – user2282615

+0

@ user2282615爲什麼你在那裏創建它?指示說它應該在'〜/ .m2'中創建,而不是在'm2/repository'中。 – eis

+0

@ user2282615更新了我的答案 – eis