我已经使用multimodule.roo设置了一个项目,该项目提供了spring roo 1.2.3。
然而,当我运行'mvn tomcat:run'时,它会出现以下错误:
[INFO] Scanning for projects...
[INFO] Reactor build order:
[INFO] core
[INFO] mvc
[INFO] ui
[INFO] petclinic
[INFO] Searching repository for plugin with prefix: 'tomcat'.
[INFO] ------------------------------------------------------------------------
[INFO] Building core
[INFO] task-segment: [tomcat:run]
[INFO] ------------------------------------------------------------------------
[INFO] Preparing tomcat:run
[INFO] [aspectj:compile {execution: default}]
[WARNING] advice defined in org.springframework.mock.staticmock.AnnotationDrivenStaticEntityMockingControl has not been applied [Xlint:adviceDidNotMatch]
[WARNING] advice defined in org.springframework.mock.staticmock.AbstractMethodMockingControl has not been applied [Xlint:adviceDidNotMatch]
[WARNING] advice defined in org.springframework.scheduling.aspectj.AbstractAsyncExecutionAspect has not been applied [Xlint:adviceDidNotMatch]
[INFO] [resources:resources {execution: default-resources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [tomcat:run {execution: default-cli}]
[INFO] Skipping non-war project
[INFO] ------------------------------------------------------------------------
[INFO] Building mvc
[INFO] task-segment: [tomcat:run]
[INFO] ------------------------------------------------------------------------
[INFO] Preparing tomcat:run
[INFO] snapshot com.example.petclinic:core:0.1.0.BUILD-SNAPSHOT: checking for updates from spring-maven-release
[INFO] snapshot com.example.petclinic:core:0.1.0.BUILD-SNAPSHOT: checking for updates from spring-maven-milestone
[INFO] snapshot com.example.petclinic:core:0.1.0.BUILD-SNAPSHOT: checking for updates from spring-roo-repository
Downloading: http://maven.springframework.org/release/com/example/petclinic/core/0.1.0.BUILD-SNAPSHOT/core-0.1.0.BUILD-SNAPSHOT.jar
[INFO] Unable to find resource 'com.example.petclinic:core:jar:0.1.0.BUILD-SNAPSHOT' in repository spring-maven-release (http://maven.springframework.org/release)
Downloading: http://maven.springframework.org/milestone/com/example/petclinic/core/0.1.0.BUILD-SNAPSHOT/core-0.1.0.BUILD-SNAPSHOT.jar
[INFO] Unable to find resource 'com.example.petclinic:core:jar:0.1.0.BUILD-SNAPSHOT' in repository spring-maven-milestone (http://maven.springframework.org/milestone)
Downloading: http://spring-roo-repository.springsource.org/release/com/example/petclinic/core/0.1.0.BUILD-SNAPSHOT/core-0.1.0.BUILD-SNAPSHOT.jar
[INFO] Unable to find resource 'com.example.petclinic:core:jar:0.1.0.BUILD-SNAPSHOT' in repository spring-roo-repository (http://spring-roo-repository.springsource.org/release)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.
Missing:
----------
1) com.example.petclinic:core:jar:0.1.0.BUILD-SNAPSHOT
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=com.example.petclinic -DartifactId=core -Dversion=0.1.0.BUILD-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=com.example.petclinic -DartifactId=core -Dversion=0.1.0.BUILD-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
Path to dependency:
1) com.example.petclinic.ui.mvc:mvc:war:0.1.0.BUILD-SNAPSHOT
2) com.example.petclinic:core:jar:0.1.0.BUILD-SNAPSHOT
----------
1 required artifact is missing.
for artifact:
com.example.petclinic.ui.mvc:mvc:war:0.1.0.BUILD-SNAPSHOT
from the specified remote repositories:
spring-maven-milestone (http://maven.springframework.org/milestone),
central (http://repo1.maven.org/maven2),
spring-roo-repository (http://spring-roo-repository.springsource.org/release),
spring-maven-release (http://maven.springframework.org/release)
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15 seconds
[INFO] Finished at: Wed Dec 26 13:43:06 BDT 2012
[INFO] Final Memory: 36M/286M
[INFO] ------------------------------------------------------------------------
这是我的root pom.xml
的一部分<modules>
<module>core</module>
<module>ui</module>
</modules>
现在,在ui模块中,还有另一个名为mvc的模块,其pom.xml包含:
<dependency>
<groupId>com.example.petclinic</groupId>
<artifactId>core</artifactId>
<version>0.1.0.BUILD-SNAPSHOT</version>
</dependency>
核心模块的包装是jar。
现在,据我所知,Maven正试图在偏远的地方找到一个本地神器“核心”。这就是为什么它会出现这个错误。
如何防止maven在远程位置搜索此本地工件?或者我还有其他问题吗?
RE:我发现了一篇很棒的博文,我的问题似乎已经消失了
请看一下这个链接:
答案 0 :(得分:1)
尝试通过
运行mvc模块时遇到了同样的错误mvn jetty:run
我得到的错误是
无法找到工件com.example.petclinic:core:jar:0.1.0.BUILD-SNAPSHOT
问题是我没有在我的Maven存储库中安装工件 core 。所以我回到了项目根目录和一个简单的
mvn install
安装了工件。
之后我就能启动了码头服务器。