从命令行创建骨架

时间:2014-06-14 09:19:47

标签: java maven playn

我正在执行Getting Started Guide中的步骤,并从Maven收到MissingProjectException错误(缺少pom.xml文件)。

我已下载并安装了JavaSE jdk和Maven。我成功编译并运行了桌面和html5的PlayN演示展示。我修改了演示“你好”应用程序。

现在我想从标准的PlayN项目骨架开始创建自己的小游戏。如何从命令行执行此操作?(Win7,Java 1.8,Maven 3.2.1)

我十年后回到Java并没有使用Maven的经验,所以我不知道该指南是否有未说明的先决条件,比如从某个地方复制默认的pom.xml文件。

(following successful compilation of playn demo showcase in playn-samples)...
PS C:\dev\playn-samples> cd ..
PS C:\dev>
PS C:\dev> mkdir mygame


Directory: C:\dev


Mode                LastWriteTime     Length Name
----                -------------     ------ ----
d----         6/14/2014   5:41 PM            mygame


PS C:\dev> cd .\mygame

按照“入门指南”“生成骨架项目”...

粘贴命令
PS C:\dev\mygame> mvn archetype:generate -DarchetypeGroupId=com.googlecode.playn -DarchetypeArtifactId=playn-archetype -DarchetypeVersion=1.8
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.276 s
[INFO] Finished at: 2014-06-14T17:41:37+09:00
[INFO] Final Memory: 4M/94M
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:\dev\mygame). Please verify you invoked Maven from the correct directory. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException
PS C:\dev\mygame>

我的Java安装......

PS C:\dev\mygame> javac -version
javac 1.8.0_05

My Maven安装......

PS C:\dev\mygame> mvn --version
Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-15T02:37:52+09:00)
Maven home: C:\Program Files\Apache Software Foundation\apache-maven-3.2.1
Java version: 1.8.0_05, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_05\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos"
PS C:\dev\mygame>

1 个答案:

答案 0 :(得分:0)

使用PowerShell似乎是一个问题。尝试使用普通的cmd可执行文件运行它。