0

我开始使用 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"

当我运行他们的文档中指定的命令来生成应用程序时:

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

我错过了什么吗?

4

2 回答 2

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"
于 2018-03-20T15:24:42.650 回答
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 中使用它,请将反斜杠 \ 替换为反引号 `

于 2019-08-02T05:39:09.083 回答