You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Florian Rampp <Fl...@web.de> on 2009/02/23 11:57:55 UTC

project internal dependencies in a multi-module project

Hello everybody,

I'm working on a quite big project using a maven multimodule project layout. I learned quite a lot about Maven the last month and I'm happy to use this tool.
Currently, I'm wondering about a issue, I couldn't find a guide or a hint for best practice for.

I'm using a dependency management section at the root pom for managing project external dependencies like mysql connector, or spring framework version.
It is perfectly clear to me, to use dependency management here.
But what about project-internal dependencies? Should I also include each leaf of my project tree (i.e. each module with packaging type jar) in the dependency management section, with the project.version as its version?

Like this?
<dependency>
	<groupId>ourGroup</groupId>
	<artifactId>rootmodule.submodule1.subsubmodule1</artifactId>
	<version>${project.version}</version>
</dependency>

What is the best practice here?

Furthermore, if I run a compile on the root pom, I get the feeling, that maven does not try to find project-internal dependencies by traversing the multi-module-project, but looking up the local repository. Can this behaviour be changed? Otherwise, I always have to redeploy the modules, other modules depend on, to the local repository before I can compile the module itself...
I hope you get the problem!

Nonetheless, thanks a lot for this great tool, that really helps me developing and following good development practice!

Regards,

Flo

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


RE: project internal dependencies in a multi-module project

Posted by Jon Georg Berentsen <Jo...@Objectware.no>.

-----Original Message-----
From: Florian Rampp [mailto:Florian.Rampp@web.de] 
Sent: 23. februar 2009 11:58
To: users@maven.apache.org
Subject: project internal dependencies in a multi-module project

"Hello everybody,

I'm working on a quite big project using a maven multimodule project
layout. I learned quite a lot about Maven the last month and I'm happy
to use this tool.
Currently, I'm wondering about a issue, I couldn't find a guide or a
hint for best practice for.

I'm using a dependency management section at the root pom for managing
project external dependencies like mysql connector, or spring framework
version.
It is perfectly clear to me, to use dependency management here.
But what about project-internal dependencies? Should I also include each
leaf of my project tree (i.e. each module with packaging type jar) in
the dependency management section, with the project.version as its
version?

Like this?
<dependency>
	<groupId>ourGroup</groupId>
	<artifactId>rootmodule.submodule1.subsubmodule1</artifactId>
	<version>${project.version}</version>
</dependency>

What is the best practice here?"

I think you nailed it.
That's the practice I use.


"Furthermore, if I run a compile on the root pom, I get the feeling,
that maven does not try to find project-internal dependencies by
traversing the multi-module-project, but looking up the local
repository. Can this behaviour be changed? Otherwise, I always have to
redeploy the modules, other modules depend on, to the local repository
before I can compile the module itself...
I hope you get the problem!

Nonetheless, thanks a lot for this great tool, that really helps me
developing and following good development practice!"

Maven builds up the compile order based on the modules pom's.
It will try to compile your active code aka. your modules.
So no, it will not look in the repo for the artifact if it's a module in
your project.
Removing it as a module, but keeping it as a dependency will make it
look in the repo.  

"Regards,

Flo"

Jon
---------------------------------------------------------------------
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