QuestionEverything
QuestionEverything

Reputation: 5097

Spring Roo multimodule.roo doesn't compile: Failed to resolve local artifact

I have set up a project using multimodule.roo which is provided with spring roo 1.2.3.

However, when i run 'mvn tomcat:run', it gives the following error:

[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] ------------------------------------------------------------------------

Here is my part of the root pom.xml

<modules>
        <module>core</module>
    <module>ui</module>
    </modules>

Now, inside the ui module, there is another module named mvc whose pom.xml contains:

<dependency>
            <groupId>com.example.petclinic</groupId>
            <artifactId>core</artifactId>
            <version>0.1.0.BUILD-SNAPSHOT</version>
        </dependency>

The packaging of core module is jar.

Now, as far as I understand, Maven is trying to locate a local artifact 'core' in remote places. That's why its getting this error.

How can I prevent maven from searching for this local artifact in remote places? Or am I getting some other problem?

RE: I've found a great blog post, my problems seem to have vanished

Please have a look at this link:

link

Upvotes: 0

Views: 544

Answers (1)

H6_
H6_

Reputation: 32808

I had the same error when trying to run the mvc module via

mvn jetty:run

The error i got was

Could not find artifact com.example.petclinic:core:jar:0.1.0.BUILD-SNAPSHOT

The problem was that I didn't installed the artifact core in my Maven repository. So I went back to the project root and a simple

mvn install

installed the artifact.

After that I was able to start the jetty server.

Upvotes: 1

Related Questions