On Wed, Sep 23, 2009 at 7:22 PM, Steven D. Majewski <sd...@virginia.edu>wrote:

>
> I can create, 'mvn install' & 'mvn jetty:run' both myBlock1 & myBlock2.
> When I try to connect the two blocks as in
> http://cocoon.apache.org/2.2/1291_1_1.html,
> I get this error on either a jetty:run or an install:
>
>
> myBlock1$ mvn jetty:run
> [INFO] Scanning for projects...
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Building myBlock1
> [INFO]    task-segment: [jetty:run]
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Preparing jetty:run
> [INFO] [resources:resources {execution: default-resources}]
> [WARNING] Using platform encoding (MacRoman actually) to copy filtered
> resources, i.e. build is platform dependent!
> [INFO] Copying 9 resources
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] BUILD ERROR
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Failed to resolve artifact.
>
> Missing:
> ----------
> 1) edu.virginia.lib:myBlock2:jar:1.0-SNAPSHOT
>
>  Try downloading the file manually from the project website.
>
>  Then, install it using the command:
>      mvn install:install-file -DgroupId=edu.virginia.lib
> -DartifactId=myBlock2 -Dversion=1.0-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=edu.virginia.lib
> -DartifactId=myBlock2 -Dversion=1.0-SNAPSHOT -Dpackaging=jar
> -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
>
>  Path to dependency:
>        1) edu.virginia.lib:myBlock1:jar:1.0.0
>        2) edu.virginia.lib:myBlock2:jar:1.0-SNAPSHOT
>
> ----------
> 1 required artifact is missing.
>
> for artifact:
>  edu.virginia.lib:myBlock1:jar:1.0.0
>
> from the specified remote repositories:
>  central (http://repo1.maven.org/maven2)
>
>
>
> [INFO]
> ------------------------------------------------------------------------
> [INFO] For more information, run Maven with the -e switch
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: 2 seconds
> [INFO] Finished at: Wed Sep 23 14:10:58 EDT 2009
> [INFO] Final Memory: 17M/31M
> [INFO]
> ------------------------------------------------------------------------
>
>
>

This means you need to run "mvn install" in myBlock2 first, because maven
can't find it in ~/.m2/repository.


> If I comment out the myBlock2 dependency in myBlock1/pom.xml which I just
> added:
>
>
>  <!--
>    <dependency>
>        <groupId>edu.virginia.lib</groupId>
>        <artifactId>myBlock2</artifactId>
>        <version>1.0-SNAPSHOT</version>
>    </dependency>
>  -->
>
> it will run again.
>
>
Yes, because the project is now dependent only on things that are already
available through maven.


> Does the order of the dependencies in the pom matter ?
> ( Eclipse is appending new ones at the end of <dependencies> )
>
>
No, the order doesn't matter.  What matters is that maven can find the
dependencies in ~/.m2/repository, or in the central repository (
http://repo1.maven.org/maven2/)


> Maybe I should try skipping the "Connect two blocks" part
> and jump straight to trying to join them with the webapp.


No, keep plugging.  It'll work!  You just need to install myBlock2 first,
because myBlock1 depends on it being available.

Incidentally, this is one of the best reasons for having a "parent" POM, as
described at the bottom of the "deploying" tutorial.  The parent POM takes
care of building all the dependencies in the correct order.

-Dom

Reply via email to