You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by kanesee <ka...@gmail.com> on 2011/07/07 00:05:42 UTC
Referencing modules in a sibling folder
Hello,
I'm very new to Maven.
I'm trying to convert my company's build environment from a proprietary
configuration to Maven's.
We components that are dependent on one another and they lie in sibling
folders.
e.g. We may have components
./myComponents/A
./myComponents/B
./myComponents/C
./myComponents/D
Let's suppose component A depends on B and C. Component B depends on D. And
Component C depends on D.
A couple of questions:
1) How do I reference component D from B?
In the examples, it seems that the folder of component D has to be within
the folder of component B. But component B is also a module for component C
so I don't want to move it underneath B.
2) What should the <packaging> value of B be? Should it be pom since it
refers to submodule D? Or should it be a jar since it contains its own
classes and is referenced by A?
Thanks in advance,
Kane
--
View this message in context: http://maven.40175.n5.nabble.com/Referencing-modules-in-a-sibling-folder-tp4559091p4559091.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Referencing modules in a sibling folder
Posted by kanesee <ka...@gmail.com>.
I tried using dependency but I'm getting a similar error, that it can't find
the artifact.
{
ERROR] Failed to execute goal on project developmentenvironment: Could not
resolve dependencies for project
com.inferlink.entitybase:developmentenvironment:jar:1.0-SNAPSHOT: Could not
find artifact com.inferlink.entitybase:bootstrap:jar:1.0-SNAPSHOT -> [Help
1]
}
Here's part of my pom for the dependency:
{
...
<modelVersion>4.0.0</modelVersion>
<groupId>com.inferlink.entitybase</groupId>
<artifactId>bootstrap</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>bootstrap</name>
...
}
How does Maven know where to look for this other artifact? I thought all
dependencies come from the repository (I'm just pointing to the default
central repository).
Do I need to upload/publish my artifact before it can be used as a
dependency by others?
If so, do I need to set up my own repository proxy (Nexus?) to do so?
--
View this message in context: http://maven.40175.n5.nabble.com/Referencing-modules-in-a-sibling-folder-tp4559091p4559280.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Referencing modules in a sibling folder
Posted by Benson Margulies <bi...@gmail.com>.
Dependencies are also used for interdependencies of your components.
It's common to see
<dependency><groupId>my.group.id</groupId>
<artifactId>my.sibling</artifactId>
<version>${project.version}</version>
</dependency>
modules are only used in a project of packaging 'pom' to tell Maven to
include a collection of other projects into the reactor. Those
projects are ordinary and relate to each other via dependencies.
On Wed, Jul 6, 2011 at 6:37 PM, kanesee <ka...@gmail.com> wrote:
> I thought the <dependency> section was just for artifacts that are located in
> the repository.
> For artifacts that consist of my own code, aren't those modules? I may be
> confusing the two.
>
> Our code base actually contains several different products, so I don't think
> it makes sense to have one pom that lists all of the subdirs as modules. My
> understanding is that I would have a pom-package for each of our products,
> which references only the subdirs (modules or dependencies) that it needed.
>
> Is my understanding correct?
>
> --
> View this message in context: http://maven.40175.n5.nabble.com/Referencing-modules-in-a-sibling-folder-tp4559091p4559177.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> 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: Referencing modules in a sibling folder
Posted by kanesee <ka...@gmail.com>.
Ah thanks.
I forgot the "mvn install" part of it, which I guess makes it available in
the repository for other artifacts to use. I just did a "mvn compile" on the
dependency component.
I've got different errors now--a sign of progress.
Thanks guys,
Kane
--
View this message in context: http://maven.40175.n5.nabble.com/Referencing-modules-in-a-sibling-folder-tp4559091p4559294.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Referencing modules in a sibling folder
Posted by Sebastian Otaegui <fe...@gmail.com>.
The modules are not more than a maven project and as such they build to an
artifact that can be in your local machine repository or in a remote
repository like maven central.
You can reference them by using the <dependency> tag as Benson said.
If you have have a multi-module project like it seems to be the case you
usually do something like:
"mvn clean install" and it will put the artifacts in your local repository
for maven use.
If you haven't already you might want to create a parent pom that agregates
the build. The maven reactor will find the right order to build them.
If you do not have a parent pom then you will have to build each project and
run 'mvn clean install'
On Wed, Jul 6, 2011 at 5:55 PM, Benson Margulies <bi...@gmail.com>wrote:
> You will generally find it helpful to grab a look at some significant
> open source project that addresses some of what you are looking to do.
> Have, for example, a look at cxf.apache.org.
>
> On Wed, Jul 6, 2011 at 6:37 PM, kanesee <ka...@gmail.com> wrote:
> > I thought the <dependency> section was just for artifacts that are
> located in
> > the repository.
> > For artifacts that consist of my own code, aren't those modules? I may be
> > confusing the two.
> >
> > Our code base actually contains several different products, so I don't
> think
> > it makes sense to have one pom that lists all of the subdirs as modules.
> My
> > understanding is that I would have a pom-package for each of our
> products,
> > which references only the subdirs (modules or dependencies) that it
> needed.
> >
> > Is my understanding correct?
> >
> > --
> > View this message in context:
> http://maven.40175.n5.nabble.com/Referencing-modules-in-a-sibling-folder-tp4559091p4559177.html
> > Sent from the Maven - Users mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > 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
>
>
--
Those who do not understand Unix are condemned to reinvent it, poorly.
Any sufficiently recent Microsoft OS contains an ad hoc,
informally-specified, bug-ridden, slow implementation of half of Unix.
Re: Referencing modules in a sibling folder
Posted by Benson Margulies <bi...@gmail.com>.
You will generally find it helpful to grab a look at some significant
open source project that addresses some of what you are looking to do.
Have, for example, a look at cxf.apache.org.
On Wed, Jul 6, 2011 at 6:37 PM, kanesee <ka...@gmail.com> wrote:
> I thought the <dependency> section was just for artifacts that are located in
> the repository.
> For artifacts that consist of my own code, aren't those modules? I may be
> confusing the two.
>
> Our code base actually contains several different products, so I don't think
> it makes sense to have one pom that lists all of the subdirs as modules. My
> understanding is that I would have a pom-package for each of our products,
> which references only the subdirs (modules or dependencies) that it needed.
>
> Is my understanding correct?
>
> --
> View this message in context: http://maven.40175.n5.nabble.com/Referencing-modules-in-a-sibling-folder-tp4559091p4559177.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> 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: Referencing modules in a sibling folder
Posted by kanesee <ka...@gmail.com>.
I thought the <dependency> section was just for artifacts that are located in
the repository.
For artifacts that consist of my own code, aren't those modules? I may be
confusing the two.
Our code base actually contains several different products, so I don't think
it makes sense to have one pom that lists all of the subdirs as modules. My
understanding is that I would have a pom-package for each of our products,
which references only the subdirs (modules or dependencies) that it needed.
Is my understanding correct?
--
View this message in context: http://maven.40175.n5.nabble.com/Referencing-modules-in-a-sibling-folder-tp4559091p4559177.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Referencing modules in a sibling folder
Posted by Benson Margulies <bi...@gmail.com>.
Dependency does not imply folder structure. Just the opposite. If each
of these projects builds a jar, each is has the default packaging
(jar). You indicate dependency by adding a <dependency> element to the
pom.
You probably want a pom in the myComponents dir that has
<packaging>pom</packaging> and lists all the subdirs as modules.
On Wed, Jul 6, 2011 at 6:05 PM, kanesee <ka...@gmail.com> wrote:
> Hello,
>
> I'm very new to Maven.
> I'm trying to convert my company's build environment from a proprietary
> configuration to Maven's.
>
> We components that are dependent on one another and they lie in sibling
> folders.
> e.g. We may have components
> ./myComponents/A
> ./myComponents/B
> ./myComponents/C
> ./myComponents/D
>
> Let's suppose component A depends on B and C. Component B depends on D. And
> Component C depends on D.
>
> A couple of questions:
> 1) How do I reference component D from B?
> In the examples, it seems that the folder of component D has to be within
> the folder of component B. But component B is also a module for component C
> so I don't want to move it underneath B.
>
> 2) What should the <packaging> value of B be? Should it be pom since it
> refers to submodule D? Or should it be a jar since it contains its own
> classes and is referenced by A?
>
> Thanks in advance,
> Kane
>
> --
> View this message in context: http://maven.40175.n5.nabble.com/Referencing-modules-in-a-sibling-folder-tp4559091p4559091.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> 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