How to resolve issue with Maven dependencies "Failed to execute goal on project"

31,498

Try running mvn install on the Main project first.

Your project is missing the other modules, which likely have never been installed to local repository.

Not that you would have to run install every time before running jetty:run.

An alternative would be to use the eclipse, right click MyProject -> Run as -> Maven build..., enter -Djetty:port=8081 jetty:run in the goals field and check "Resolve workspace artifacts".

Share:
31,498
ruhungry
Author by

ruhungry

merge keep

Updated on July 09, 2022

Comments

  • ruhungry
    ruhungry almost 2 years

    I have got the following structure in Eclipse of my maven projects:

    MainMavenProject
    ---MyProject
    ---MProject-client
    ---MProject-xyz
    ---MProject-web
    ...
    

    In Eclipse, I use JBoss 7.1 to run MProject-web:

    JBoss

    Now, I want to run Jetty with another project. From directory /MainMavenProject/MyProject I run a command

    mvn -Djetty:port=8081 jetty:run
    

    It has been finished with an error:

    [ERROR] Failed to execute goal on project MyProject: Could not resolve dependencies for project ***.*****.MyProject:MyProject:war:0.0.1-SNAPSHOT: The following artifacts could not be resolved: ***.*****.********:MyProject-client:jar:1.0.
    1-SNAPSHOT, com.*****.********:MProject-xyz:jar:1.0.1-SNAPSHOT: Failure to find ***.*****.********:MyProject-client:jar:1.0.1-SNAPSHOT in https://*********.*****.com/nexus/content/groups/development was cached in the local repository, resolutio
    n will not be reattempted until the update interval of *****-central has elapsed or updates are forced -> [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/DependencyResolutionException
    

    In MyProject, I use depedencies to the other ones:

    <dependency>
        <groupId>com.*****.********</groupId>
        <artifactId>MyProject-client/artifactId>
        <version>1.0.1-SNAPSHOT</version>
    </dependency>
    
    <dependency>
        <groupId>com.*****.********</groupId>
        <artifactId>MProject-xyz</artifactId>
        <version>1.0.1-SNAPSHOT</version>
    </dependency>
    

    How can I check, what exactly happend and after that, how to fix it?

    Thank you in advance

  • ruhungry
    ruhungry about 10 years
    Hi, I did mvn clean and I still have the same problem. I prefer to use jetty in command line. Can I run Resolve workspace artifiacts not from Eclipse ?
  • blackbuild
    blackbuild about 10 years
    @IWillTryToCodeIt No (at least not without some very dirty tricks). Do mvn clean install from Main project. Does it work?