You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Robert Blixt <ro...@tinyobject.com> on 2007/05/30 10:42:12 UTC

M2 Eclipse project dependency

  Hi,

I'm trying to get a handle on Maven2 (Been using Ant
for a while, and this seems to be the next logical step).

However, I've stumpled upon some problems. I have two
projects (Project A and B). Project A is dependent on
project B. (I'm using Eclipse IDE with Maven plugin).

I know how to create a jar of project B and make a dependency
of that in project A. But I would like to make a dependency
directly to the Eclipse project. So I do not need to create
a jar each time I've updated project B. Is this possible?

What is the preferred way to deal with this?

Kind Regards,
Robert

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: M2 Eclipse project dependency

Posted by Robert Blixt <ro...@tinyobject.com>.

Ok, thanks Peter and Jo for your responses they were
very helpful.

Kind Regards,
Robert




Den 2007-05-30 13:31:01 skrev Hayes, Peter <Pe...@fmr.com>:

> Two ways :
>
> Maven Plugin for Eclipse
>
> Use the maven plugin for eclipse
> (http://maven.apache.org/plugins/maven-eclipse-plugin/index.html), i.e.
> mvn eclipse:eclipse.  This will generate (modify if already existing) a
> .project and a .classpath file for your eclipse project or if you have a
> multi-module build, it will repeat this process for each module.  The
> key piece that you are looking for is that for multi-module projects, it
> will create an eclipse project reference in the generated .classpath
> file.
>
> Eclipse Plugin for Maven
>
> The m2eclipse plugin (http://m2eclipse.codehaus.org/) which is what you
> are using is a dynamic classpath manager in that it reads your pom.xml
> files for your projects and manages an eclipse classpath container which
> reflects your maven dependencies.  As of version 0.0.10, the plugin will
> automatically reference other projects in your eclipse workspace if
> those projects (groupId, artifactId & versionId) are the same as one of
> your dependencies.  This is a really nice feature though I have found
> the plugin to be somewhat unstable when changing dependencies and / or
> using inherited dependency management versioning.
>
> For our projects, we have been using the Maven Plugin for Eclipse as it
> "just works" though I am waiting to move to the m2eclipse plugin once it
> improves stability and "just works" as its dynamic nature promises
> easier use.
>
> -----Original Message-----
> From: Robert Blixt [mailto:robert@tinyobject.com]
> Sent: Wednesday, May 30, 2007 4:42 AM
> To: users@maven.apache.org
> Subject: M2 Eclipse project dependency
>
>
>   Hi,
>
> I'm trying to get a handle on Maven2 (Been using Ant
> for a while, and this seems to be the next logical step).
>
> However, I've stumpled upon some problems. I have two
> projects (Project A and B). Project A is dependent on
> project B. (I'm using Eclipse IDE with Maven plugin).
>
> I know how to create a jar of project B and make a dependency
> of that in project A. But I would like to make a dependency
> directly to the Eclipse project. So I do not need to create
> a jar each time I've updated project B. Is this possible?
>
> What is the preferred way to deal with this?
>
> Kind Regards,
> Robert
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: M2 Eclipse project dependency

Posted by "Hayes, Peter" <Pe...@fmr.com>.
Two ways :

Maven Plugin for Eclipse

Use the maven plugin for eclipse
(http://maven.apache.org/plugins/maven-eclipse-plugin/index.html), i.e.
mvn eclipse:eclipse.  This will generate (modify if already existing) a
.project and a .classpath file for your eclipse project or if you have a
multi-module build, it will repeat this process for each module.  The
key piece that you are looking for is that for multi-module projects, it
will create an eclipse project reference in the generated .classpath
file.

Eclipse Plugin for Maven

The m2eclipse plugin (http://m2eclipse.codehaus.org/) which is what you
are using is a dynamic classpath manager in that it reads your pom.xml
files for your projects and manages an eclipse classpath container which
reflects your maven dependencies.  As of version 0.0.10, the plugin will
automatically reference other projects in your eclipse workspace if
those projects (groupId, artifactId & versionId) are the same as one of
your dependencies.  This is a really nice feature though I have found
the plugin to be somewhat unstable when changing dependencies and / or
using inherited dependency management versioning.  

For our projects, we have been using the Maven Plugin for Eclipse as it
"just works" though I am waiting to move to the m2eclipse plugin once it
improves stability and "just works" as its dynamic nature promises
easier use.

-----Original Message-----
From: Robert Blixt [mailto:robert@tinyobject.com] 
Sent: Wednesday, May 30, 2007 4:42 AM
To: users@maven.apache.org
Subject: M2 Eclipse project dependency


  Hi,

I'm trying to get a handle on Maven2 (Been using Ant
for a while, and this seems to be the next logical step).

However, I've stumpled upon some problems. I have two
projects (Project A and B). Project A is dependent on
project B. (I'm using Eclipse IDE with Maven plugin).

I know how to create a jar of project B and make a dependency
of that in project A. But I would like to make a dependency
directly to the Eclipse project. So I do not need to create
a jar each time I've updated project B. Is this possible?

What is the preferred way to deal with this?

Kind Regards,
Robert

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: M2 Eclipse project dependency

Posted by Jo Vandermeeren <jo...@gmail.com>.
Robert,

Glad to see that you're giving Maven a try.

Maven modules always depends on compiled artifacts that are installed in
your repository, not directly on the source of other modules.
This is good practice because now you are certain that you depend on
pre-built, pre-tested artifacts, rather than on possibly buggy source code.

If your two projects are modules of a multi-module project, you can just
build the entire project from the parent root.
Maven is smart enough to detect that project B is part of the same project
and that project A depends on it.
Maven will arrange the build reactor sequence in such a way that project B
is built and installed before project A.
This guarantees that project A will have a fresh version of project B as a
dependency.

I am not an Eclipse user - hail IntelliJ IDEA ;) - but you could possibly
create direct source links (module dependencies) for modules of your parent
project.
This is usually easier if you're working on more than one module, because
the source is directly available in your IDE and code changes appear to be
available to the other module.

But bare in mind that Maven never depends on the sources of other modules,
but on the compiled artifacts.

Cheers
Jo

On 5/30/07, Robert Blixt <ro...@tinyobject.com> wrote:
>
>
>   Hi,
>
> I'm trying to get a handle on Maven2 (Been using Ant
> for a while, and this seems to be the next logical step).
>
> However, I've stumpled upon some problems. I have two
> projects (Project A and B). Project A is dependent on
> project B. (I'm using Eclipse IDE with Maven plugin).
>
> I know how to create a jar of project B and make a dependency
> of that in project A. But I would like to make a dependency
> directly to the Eclipse project. So I do not need to create
> a jar each time I've updated project B. Is this possible?
>
> What is the preferred way to deal with this?
>
> Kind Regards,
> Robert
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>