2

我正在关注教程: http: //persistentdesigns.com/wp/jersey-spring-and-jpa/ 这里说,运行命令

mvn archetype:generate -DarchetypeCatalog=http://download.java.net/maven/2

之后给出 groupId、ArtifactId 等。我运行了上面的命令。但在询问 groupId 之前,它要求:

选择一个数字或应用过滤器(格式:[groupId:]artifactId,包含区分大小写):

因为教程中没有给出这个数字,所以我在命令行中查看了给定的选项并选择了 3。之后它询问了 groupId 和其他。我给出了所有选项,然后按回车键。但我得到一个构建失败,说读取 POM 时出错。

这是输出:

Choose archetype:
1: http://download.java.net/maven/2 -> com.sun.jersey.archetypes:jersey-quickstart-    
grizzly (Archetype for creating a RESTful web application with Jersey and Grizzly)
2: http://download.java.net/maven/2 -> com.sun.jersey.archetypes:jersey-quickstart-grizzly2 (Archetype for creating a RESTful web application with Jersey and Grizzly 2.x)
3: http://download.java.net/maven/2 -> com.sun.jersey.archetypes:jersey-quickstart-webapp (Archetype for creating a Jersey based RESTful web application with WAR packaging)
4: http://download.java.net/maven/2 -> com.sun.jersey.archetypes:jersey-quickstart-ejb (Archetype for creating a Jersey based RESTful EJB application with WAR packaging)
5: http://download.java.net/maven/2 -> com.sun.faces:simple-jsf (Archetype for creating a simple JSF project)
6: http://download.java.net/maven/2 -> com.sun.faces.regression:i_jsf_XXXX-archetype (Archetype for mojarra JSF regression tests)
Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): : 3
Define value for property 'groupId': : com.persistent
Define value for property 'artifactId': : jerseySpringJPA
Define value for property 'version':  1.0-SNAPSHOT: : <CR>
Define value for property 'package':  com.persistent: : com.persistent.rest
Confirm properties configuration:
groupId: com.persistent
artifactId: jerseySpringJPA
version: <CR>
package: com.persistent.rest
 Y: : Y
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Old (1.x) Archetype: jersey-quickstart-webapp:1.8
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: com.persistent
[INFO] Parameter: packageName, Value: com.persistent.rest
[INFO] Parameter: package, Value: com.persistent.rest
[INFO] Parameter: artifactId, Value: jerseySpringJPA
[INFO] Parameter: basedir, Value: /mwallet
[INFO] Parameter: version, Value: <CR>
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:32.278s
[INFO] Finished at: Fri Aug 02 00:55:41 GMT+05:30 2013
[INFO] Final Memory: 7M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:generate (default-cli) on project standalone-pom: Error reading POM -> [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/MojoFailureException

我不知道为什么它不读取 POM。我在这里错过了什么吗?请帮忙!提前致谢!

4

2 回答 2

1

我解决了这个问题!

为了

Define value for property 'version':  1.0-SNAPSHOT: :

如教程中所述,我最初输入的是 <CR>。现在,我将其留空,这实际上是将版本设置为 1.0-SNAPSHOT。

这解决了这个问题。现在构建成功了!这是输出:

5: http://download.java.net/maven/2 -> com.sun.faces:simple-jsf (Archetype for creating a simple JSF project)
6: http://download.java.net/maven/2 -> com.sun.faces.regression:i_jsf_XXXX-archetype (Archetype for mojarra JSF regression tests)
Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): : 3
Define value for property 'groupId': : com.persistent
Define value for property 'artifactId': : jerseySpringJPA     
Define value for property 'version':  1.0-SNAPSHOT: : 
Define value for property 'package':  com.persistent: : com.persistent.rest
Confirm properties configuration:
groupId: com.persistent
artifactId: jerseySpringJPA
version: 1.0-SNAPSHOT
package: com.persistent.rest
 Y: : Y
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Old (1.x) Archetype: jersey-quickstart-webapp:1.8
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: com.persistent
[INFO] Parameter: packageName, Value: com.persistent.rest
[INFO] Parameter: package, Value: com.persistent.rest
[INFO] Parameter: artifactId, Value: jerseySpringJPA
[INFO] Parameter: basedir, Value: /mwallet
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] project created from Old (1.x) Archetype in dir: /mwallet/jerseySpringJPA
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:04.013s
[INFO] Finished at: Fri Aug 02 01:49:42 GMT+05:30 2013
[INFO] Final Memory: 7M/81M
[INFO] ------------------------------------------------------------------------
于 2013-08-01T20:36:34.287 回答
0

我能够毫无问题地创建一个模块。请参阅随附的屏幕截图。

您传递的版本号似乎不正确。

在此处输入图像描述

谢谢

于 2013-08-01T20:14:44.973 回答