I actually don't want to install these jars/wars/hars into my repository
because they aren't really separate components. No other project of ours
uses them. Instead, I'm trying to build a multi-part project which consists
of two built wars, a built har, three built jars, plus all of the dependent
jar files into a single ear. No need to waste the diskspace (even though
"install" only puts them into my local .m2 repository)

The problem I'm having is getting Maven to understand that the jars it needs
aren't in the repository, but are the ones it just built earlier in the
project. This works beautifully when I do:

  *$ mvn package*

Everything builds as I expect it too. It's that when I do:

*  $ mvn assembly:assembly*

that everything fails.

According to the book, the assembly:assembly goal executes all the poms up
to the package lifecycle. That sounds like it first does a:

*   $ mvn package*

before it attempts to create the assembly. I have no problems with that. The
problem I have is that when the "assembly:assembly" step executes the
package lifecycle on all the poms, the build fails because suddenly Maven
cannot figure out that the jars it needs were built earlier in the build
process.

Even stranger is I discovered after I sent out the email, that this:

   *$ mvn clean package assembly:assembly
*
works! Suddenly. the assembly is built.

Can someone explain the difference between
*
    $ mvn clean package
    $ mvn assembly:assembly*

and

  * $ mvn clean package assembly:assembly*

Why does the first one fail because of the dependency confusion, and the
second one works fine?

On Thu, Jul 9, 2009 at 2:34 PM, Tim O'Brien <tobr...@discursive.com> wrote:

> David,
>
> It looks like
> com.solbright.adinventory.projects.base:jar:jar:2.1.2-SNAPSHOT
> can't be found in the local repository.   Instead of running
> assembly:assembly by itself, try:  mvn install assembly:assembly
>
> Better yet, why not just bind the assembly goal to the package phase
> of the project that is going to produce the assembly? like this:
> http://tr.im/rBBw
>
> Maybe binding to the package phase isn't the right solution for you,
> if you are looking for a list of phases, see  http://tr.im/rBAq
>
>
> On Thu, Jul 9, 2009 at 12:49 PM, David Weintraub<qazw...@gmail.com> wrote:
> > We have a project we're converting over to Maven. The structure is a bit
> > convoluted:
> >
> > Project Root
> >   apps.war: Builds apps.war
> >   aimwebservices: Builds aimwebservices.war
> >   ear: Builds adinventory.ear. Contains all other modules
> >   projects
> >      adplanning: Builds adplanning.jar
> >      base
> >         jar: Builds base.jar
> >         har: Builds base-hib.har
> >         servlet: Builds base-ui.jar
> >
> > For various reasons, we do not want the version names in any of these
> files
> > we create.
> >
> > The project is structured so that most of the components depend upon
> > base.jar. The aimwebservices.war and apps.war also depend upon the
> > base-hib.har and the base-ui.jar.
> >
> > The adinventory.ear file contains all of the built wars, hars, and jars.
> > Each component directory contains a pom.xml.
> >
> > When I do a "mvn package", everything is built, and the final result is
> the
> > adinventory.ear file which contains all the jars, hars, and wars that it
> is
> > suppose to have. This is what I want. Beautiful.
> >
> > The problem is I want to package this adinventory.ear file with a bunch
> of
> > scripts, configuration files, and other items that are in the
> > src/main/instance directory. I configured a assembly, and am using the
> > assembly plugin. The problem is when I run "mvn assembly:assembly", I get
> > the following error:
> >
> > [INFO]
> > ------------------------------------------------------------------------
> > [INFO] Building servlet
> > [INFO]
> > ------------------------------------------------------------------------
> > [INFO] [resources:resources]
> > [WARNING] Using platform encoding (UTF-8 actually) to copy filtered
> > resources, i.e. build is platform dependent!
> > [INFO] Copying 16 resources
> > [INFO] snapshot
> com.solbright.adinventory.projects.base:jar:2.1.2-SNAPSHOT:
> > checking for updates from snapshot
> > Downloading:
> >
> http://aladdin.solbright.com:8082/nexus/content/repositories/snapshots//com/solbright/adinventory/projects/base/jar/2.1.2-SNAPSHOT/jar-2.1.2-SNAPSHOT.jar
> > [INFO] Unable to find resource
> > 'com.solbright.adinventory.projects.base:jar:jar:2.1.2-SNAPSHOT' in
> > repository snapshot
> > (http://aladdin.solbright.com:8082/nexus/content/repositories/snapshots/
> )
> > [INFO]
> > ------------------------------------------------------------------------
> > [ERROR] BUILD ERROR
> > [INFO]
> > ------------------------------------------------------------------------
> > [INFO] Failed to resolve artifact.
> >
> > Missing:
> > ----------
> > 1) com.solbright.adinventory.projects.base:jar:jar:2.1.2-SNAPSHOT
> >
> >  Try downloading the file manually from the project website.
> >
> >  Then, install it using the command:
> >      mvn install:install-file
> > -DgroupId=com.solbright.adinventory.projects.base -DartifactId=jar
> > -Dversion=2.1.2-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.solbright.adinventory.projects.base -DartifactId=jar
> > -Dversion=2.1.2-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file -Durl=[url]
> > -DrepositoryId=[id]
> >
> >  Path to dependency:
> >   1) com.solbright.adinventory.projects.base:servlet:jar:2.1.2-SNAPSHOT
> >   2) com.solbright.adinventory.projects.base:jar:jar:2.1.2-SNAPSHOT
> >
> > ----------
> > 1 required artifact is missing.
> >
> > for artifact:
> >  com.solbright.adinventory.projects.base:servlet:jar:2.1.2-SNAPSHOT
> >
> > from the specified remote repositories:
> >  snapshot
> > (http://aladdin.solbright.com:8082/nexus/content/repositories/snapshots/
> ),
> >  production
> > (http://aladdin.solbright.com:8082/nexus/content/repositories/releases/
> ),
> >  Nexus (http://aladdin.solbright.com:8082/nexus/content/groups/public)
> >
> >
> >
> > [INFO]
> > ------------------------------------------------------------------------
> > [INFO] For more information, run Maven with the -e switch
> > [INFO]
> > ------------------------------------------------------------------------
> > [INFO] Total time: 9 seconds
> > [INFO] Finished at: Thu Jul 09 12:10:15 GMT-05:00 2009
> > [INFO] Final Memory: 29M/194M
> > [INFO]
> > ------------------------------------------------------------------------
> >
> > Why does the build suddenly fail when I run the assembly:assembly
> lifecycle,
> > yet the same setup succeeds when I do "mvn package"?
> >
> > For convinence, the pom files I use are at
> > <http://files.getdropbox.com/u/433257/pom.tar>. I've also attached it to
> > this message.
> >
> > --
> > David Weintraub
> > qazw...@gmail.com
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> > For additional commands, e-mail: users-h...@maven.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>


-- 
David Weintraub
qazw...@gmail.com

Reply via email to