Hi,
I'm no maven expert, but I believe Maven can work with parent poms in
two ways:
* fetch the pom from some local directory relative to the project being
built, or
* fetch the pom from a repository
If you've defined
<parent>
<relativePath>../parentstuff/pom.xml</relativePath>
then the parent pom is picked up from the specified location, and there
is no need to have the parent pom installed in a repository. Note that
there is a default value for relativePath of "../pom.xml", so if that
exists then the pom is also picked up locally.
However if the relative path (including the default ../pom.xml value)
doesn't point to a pom (or the file found has group/artefact/version
values that don't match the specified parent dependency) then the
repository is checked, using the declared parent group/artefact-id
values. This allows subprojects to be built without the parent stuff
checked out, as long as the parent stuff is in a repo - a major
convenience.
http://maven.apache.org/ref/2.0.3-SNAPSHOT/maven-model/maven.html
I agree that your original problem ("robot") is probably a transitive
dependency, ie something your project depends on has a dependency on
robot, so maven2 fetches it.
It's not clear what you're trying to do by "excluding the parent
project". If you've declared a <parent> then presumably it *is* a
dependency, ie your code cannot successfully be built without it. So why
would you want to exclude it?
Cheers,
Simon
On Sat, 2006-03-18 at 11:45 -0500, Stephen Duncan wrote:
> Since the parent POM is part of the definition of the artifact, it
> does have to be installed.
>
> -Stephen
>
> On 3/18/06, Rune Flobakk <[EMAIL PROTECTED]> wrote:
> > Ah, of course! The new transitive dependency thingie! It worked when I
> > ran mvn install first on the parent project.
> >
> > But I tried to exclude the parent project in the dependency definition
> > to make maven fetch the project without also looking for the parent POM,
> > but that didn't work. Must the parent project be installed to the
> > repository, or is it a way to avoid this? I didn't have to install any
> > other project than the one sub-project in question when using Maven 1.
> >
> > Thanks for your valuable startup help :)
> >
> > Rune
> >
> > Stephen Duncan skrev:
> > > Here's the steps as I understand them:
> > >
> > > 1) It sees the dependency.
> > > 2) It attempts to get the dependency's POM, so that it can resolve
> > > transitive dependencies.
> > > 3) It sees the <parent> element in the dependency's POM.
> > > 4) It attempts to get the parent POM so it can have all the
> > > information it needs for transitive dependencies.
> > >
> > > I assume the problem is the parent project has NOT been installed into
> > > the local repo using mvn install. When you remove the dependency,
> > > it's ok, because it find the parent pom using the <relativePath>
> > > element (or it's default, the directory above). When it tries to find
> > > it for the dependency, however, it doesn't have access to this
> > > relativePath, so it looks it up the normal way, which is to look in
> > > the local repo, and if not found, in the remote repos.
> > >
> > > -Stephen
> > >
> > > On 3/17/06, Rune Flobakk <[EMAIL PROTECTED]> wrote:
> > >> Hi!
> > >> I've just begun to make a Maven 1 project into a Maven 2 project. The
> > >> project consists of a parent project with a few sub projects.
> > >>
> > >> One of the subprojects depends on another, and with the Maven 1 project
> > >> I can on the dependee project run 'maven jar:install' to install it to
> > >> the local repository, and the project depending on it will fetch it when
> > >> compiling its source.
> > >>
> > >> I've managed to make a functional Maven 2 project on the dependee
> > >> project and installed it to the local Maven 2 repository using 'mvn
> > >> install'. The project installs nicely to C:\Documents and
> > >> Settings\Rune\.m2\repository\wsu_khepera\simulator\1.0\simulator-1.0.jar.
> > >>
> > >> Now, for the project depending on the just installed artifact, I have
> > >> defined in pom.xml:
> > >>
> > >> <dependencies>
> > >> <dependency>
> > >> <artifactId>simulator</artifactId>
> > >> <groupId>wsu_khepera</groupId>
> > >> <version>1.0</version>
> > >> </dependency>
> > >> </dependencies>
> > >>
> > >> But when running 'mvn compile' it seems to try to fetch the parent
> > >> project from the repository, and the first downloading-message I get is
> > >> this:
> > >>
> > >> Downloading:
> > >> http://repo1.maven.org/maven2/tdt4240/group10/robot/0.1/robot-0.1.pom
> > >>
> > >> I'm assuming it has already looked in the local repository when trying
> > >> to download from the default remote one?
> > >>
> > >> Why is it looking for the groupId 'tdt4240.group10', artifactId 'robot',
> > >> version '0.1' which is the parent project, instead of the one I've
> > >> defined as a dependency? I assume it finds the parent project which I've
> > >> defined already with <parent>...</parent>, because if I remove the
> > >> defined dependency and try to compile, I get no errors about missing
> > >> parent project (but of course compile errors because of the dependency
> > >> project).
> > >>
> > >> I'm a bit stuck on this one, and hope somebody can shed some light on
> > >> this matter. I'm very familiar with these concepts from Maven 1, but
> > >> have just started to use Maven 2. If I need to provide more info, please
> > >> tell me.
> > >>
> > >> Cheers,
> > >> Rune
> > >>
> > >>
> > >>
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >> For additional commands, e-mail: [EMAIL PROTECTED]
> > >>
> > >>
> > >
> > >
> > > --
> > > Stephen Duncan Jr
> > > www.stephenduncanjr.com
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> Stephen Duncan Jr
> www.stephenduncanjr.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]