Apache isis helloworld archtype构建失败

时间:2018-03-20 14:50:52

标签: maven maven-3 isis

我开始使用Apache isis(我有Windows 10)并遵循他们的教程(https://isis.apache.org/guides/ugfun/ugfun.html#_ugfun_getting-started_helloworld-archetype

我安装了Java和Maven,将它们添加到路径中然后我创建了一个文件夹,当我运行命令mvn -v时,我看到了后续输出:

E:\Apache isis\test_project>mvn -v
Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T20:49:05+01:00)
Maven home: D:\Development softwares\apache-maven-3.5.3-bin\apache-maven-3.5.3\bin\..
Java version: 9.0.4, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jre-9.0.4
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

当我运行其文档中指定的命令来生成app:

mvn archetype:generate  \
    -D archetypeGroupId=org.apache.isis.archetype \
    -D archetypeArtifactId=helloworld-archetype \
    -D archetypeVersion=1.16.2 \
    -D groupId=com.mycompany \
    -D artifactId=myapp \
    -D version=1.0-SNAPSHOT \
    -B

我收到以下错误:

PS C:\Users\Nitish> cd .\Desktop\
PS C:\Users\Nitish\Desktop> mvn archetype:generate  \
>>     -D archetypeGroupId=org.apache.isis.archetype \
>>     -D archetypeArtifactId=simpleapp-archetype \
>>     -D archetypeVersion=1.16.2 \
>>     -D groupId=com.mycompany \
>>     -D artifactId=myapp \
>>     -D version=1.0-SNAPSHOT \
>>     -B
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.114 s
[INFO] Finished at: 2018-03-20T15:42:22+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:\Users\Nitish\Desktop). 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
-D : The term '-D' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:2 char:5
+     -D archetypeGroupId=org.apache.isis.archetype \
+     ~~
    + CategoryInfo          : ObjectNotFound: (-D:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

-D : The term '-D' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:3 char:5
+     -D archetypeArtifactId=simpleapp-archetype \
+     ~~
    + CategoryInfo          : ObjectNotFound: (-D:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

-D : The term '-D' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:4 char:5
+     -D archetypeVersion=1.16.2 \
+     ~~
    + CategoryInfo          : ObjectNotFound: (-D:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

-D : The term '-D' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:5 char:5
+     -D groupId=com.mycompany \
+     ~~
    + CategoryInfo          : ObjectNotFound: (-D:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

-D : The term '-D' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:6 char:5
+     -D artifactId=myapp \
+     ~~
    + CategoryInfo          : ObjectNotFound: (-D:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

-D : The term '-D' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:7 char:5
+     -D version=1.0-SNAPSHOT \
+     ~~
    + CategoryInfo          : ObjectNotFound: (-D:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

-B : The term '-B' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:8 char:5
+     -B
+     ~~
    + CategoryInfo          : ObjectNotFound: (-B:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

我错过了什么吗?

2 个答案:

答案 0 :(得分:1)

当我使用Powershell时,我不得不使用命令:

mvn archetype:generate  "-DarchetypeGroupId=org.apache.isis.archetype" "-DarchetypeArtif
actId=helloworld-archetype" "-DarchetypeVersion=1.16.2" "-DgroupId=com.mycompany" "-DartifactId=myapp" "-Dversion=1.0-SN
APSHOT" "-B"

答案 1 :(得分:0)

对于Unix,它应如下所示。

mvn archetype:generate \
  -DarchetypeGroupId=org.apache.beam \
  -DarchetypeArtifactId=beam-sdks-java-maven-archetypes-examples \
  -DarchetypeVersion=2.14.0 \
  -DgroupId=org.example \
  -DartifactId=word-count-beam \
  -Dversion="0.1" \
  -Dpackage=org.apache.beam.examples \
  -DinteractiveMode=false

如果要在Powershell中使用它,请使用反引号`

替换反斜杠\