我已经使用 spring roo 1.2.3 提供的 multimodule.roo 建立了一个项目。
但是,当我运行“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] ------------------------------------------------------------------------
这是我的根 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:我找到了一篇很棒的博客文章,我的问题似乎已经消失了
请看一下这个链接: