You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Anuerin Diaz <ra...@gmail.com> on 2005/11/03 12:40:45 UTC

[m2] multi-module visibility problem

hi,

   i am starting a multi-module project that has this structure

   root
   |---module1
       |-pom.xml
   |---module2
       |-pom.xml
   |-pom.xml

   wherein module2 depends on module1. compilation of module1 goes
fine but module2 fails because it cannot see the classes in module1. i
hope somebody can point out what i am missing. my pom files are as
follows.


root pom:
===========
<groupId>root</groupId>
<artifactId>Maintenance</artifactId>
<packaging>pom</packaging>
<version>1.0</version>
<name>Maintenance project</name>
<dependencies>
	<dependency>
		<groupId>log4j</groupId>
		<artifactId>log4j</artifactId>
		<version>1.2.8</version>
	</dependency>
	<dependency>
		<groupId>xerces</groupId>
		<artifactId>xercesImpl</artifactId>
		<version>2.5.0</version>
	</dependency>
</dependencies>
<modules>
	<module>module1</module>
	<module>module2</module>
</modules>

module1 pom:
===========
  <groupId>root.MODULES</groupId>
  <artifactId>module1</artifactId>
  <packaging>jar</packaging>
  <version>1.0</version>
  <name>Module1 - common</name>
  <parent>
    <groupId>root</groupId>
    <artifactId>Maintenance</artifactId>
    <version>1.0</version>
  </parent>
  <dependencies>
    <dependency>
      <groupId>commons-fileupload</groupId>
      <artifactId>commons-fileupload</artifactId>
      <version>1.0</version>
    </dependency>
  </dependencies>
  <build>
	<finalName>Mod1</finalName>
  </build>

module2 pom:
============
  <groupId>root.MODULES</groupId>
  <artifactId>module2</artifactId>
  <packaging>jar</packaging>
  <version>1.0</version>
  <name>Module2 - app</name>
  <parent>
    <groupId>root</groupId>
    <artifactId>Maintenance</artifactId>
    <version>1.0</version>
  </parent>
  <build>
	<finalName>Mod2</finalName>
  </build>


  i also tried removing the <finalName/> elements but the problem is
still the same. by my understanding maven should be able to resolve
the internal class dependencies of the  module but i cant seem to
manage it. thanks.

ciao!


--

"Programming, an artform that fights back"

Anuerin G. Diaz
Registered Linux User #246176
Friendly Linux Board @ http://mandrivausers.org/index.php
http://capsule.ramfree17.org , when you absolutely have nothing else
better to do

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


Re: [m2] multi-module visibility problem

Posted by Alexandre Poitras <al...@gmail.com>.
I understand, I did the same mistake at first. A good way to understand a
maven parent pom project, is to look at it like it was a workspace in a IDE.
The projects still have to declare the dependencies over their sibling
projects.

On 11/3/05, Anuerin Diaz <ra...@gmail.com> wrote:
>
> thank you. i guess i misunderstood the way maven works. i initially
> thought that the reactor (or whatever internal component) also keeps
> track of the compiled classes.
>
> ciao!
>
> On 11/3/05, Alexandre Poitras <al...@gmail.com> wrote:
> > You have to declare module1 as dependency in module2. Maven cannot guess
> it
> > automatically. Add this in your Module2 pom.
> >
> > <dependencies>
> > <dependency>
> > <groupId>root.MODULES</groupId>
> > <artifactId>module1</artifactId>
> > <version>1.0</version>
> > </dependency>
> > </dependencies>
> >
> > Voilà, it should work now. Hope this help!
> >
> > On 11/3/05, Anuerin Diaz <ra...@gmail.com> wrote:
> > >
> > > hi,
> > >
> > > i am starting a multi-module project that has this structure
> > >
> > > root
> > > |---module1
> > > |-pom.xml
> > > |---module2
> > > |-pom.xml
> > > |-pom.xml
> > >
> > > wherein module2 depends on module1. compilation of module1 goes
> > > fine but module2 fails because it cannot see the classes in module1. i
> > > hope somebody can point out what i am missing. my pom files are as
> > > follows.
> > >
> > >
> > > root pom:
> > > ===========
> > > <groupId>root</groupId>
> > > <artifactId>Maintenance</artifactId>
> > > <packaging>pom</packaging>
> > > <version>1.0</version>
> > > <name>Maintenance project</name>
> > > <dependencies>
> > > <dependency>
> > > <groupId>log4j</groupId>
> > > <artifactId>log4j</artifactId>
> > > <version>1.2.8</version>
> > > </dependency>
> > > <dependency>
> > > <groupId>xerces</groupId>
> > > <artifactId>xercesImpl</artifactId>
> > > <version>2.5.0</version>
> > > </dependency>
> > > </dependencies>
> > > <modules>
> > > <module>module1</module>
> > > <module>module2</module>
> > > </modules>
> > >
> > > module1 pom:
> > > ===========
> > > <groupId>root.MODULES</groupId>
> > > <artifactId>module1</artifactId>
> > > <packaging>jar</packaging>
> > > <version>1.0</version>
> > > <name>Module1 - common</name>
> > > <parent>
> > > <groupId>root</groupId>
> > > <artifactId>Maintenance</artifactId>
> > > <version>1.0</version>
> > > </parent>
> > > <dependencies>
> > > <dependency>
> > > <groupId>commons-fileupload</groupId>
> > > <artifactId>commons-fileupload</artifactId>
> > > <version>1.0</version>
> > > </dependency>
> > > </dependencies>
> > > <build>
> > > <finalName>Mod1</finalName>
> > > </build>
> > >
> > > module2 pom:
> > > ============
> > > <groupId>root.MODULES</groupId>
> > > <artifactId>module2</artifactId>
> > > <packaging>jar</packaging>
> > > <version>1.0</version>
> > > <name>Module2 - app</name>
> > > <parent>
> > > <groupId>root</groupId>
> > > <artifactId>Maintenance</artifactId>
> > > <version>1.0</version>
> > > </parent>
> > > <build>
> > > <finalName>Mod2</finalName>
> > > </build>
> > >
> > >
> > > i also tried removing the <finalName/> elements but the problem is
> > > still the same. by my understanding maven should be able to resolve
> > > the internal class dependencies of the module but i cant seem to
> > > manage it. thanks.
> > >
> > > ciao!
> > >
> > >
> > > --
> > >
> > > "Programming, an artform that fights back"
> > >
> > > Anuerin G. Diaz
> > > Registered Linux User #246176
> > > Friendly Linux Board @ http://mandrivausers.org/index.php
> > > http://capsule.ramfree17.org , when you absolutely have nothing else
> > > better to do
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> >
> >
> > --
> > Alexandre Poitras
> > Québec, Canada
> >
> >
>
>
> --
>
> "Programming, an artform that fights back"
>
> Anuerin G. Diaz
> Registered Linux User #246176
> Friendly Linux Board @ http://mandrivausers.org/index.php
> http://capsule.ramfree17.org , when you absolutely have nothing else
> better to do
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


--
Alexandre Poitras
Québec, Canada

Re: [m2] multi-module visibility problem

Posted by Anuerin Diaz <ra...@gmail.com>.
thank you. i guess i misunderstood the way maven works. i initially
thought that the reactor (or whatever internal component) also keeps
track of the compiled classes.

ciao!

On 11/3/05, Alexandre Poitras <al...@gmail.com> wrote:
> You have to declare module1 as dependency in module2. Maven cannot guess it
> automatically. Add this in your Module2 pom.
>
> <dependencies>
> <dependency>
> <groupId>root.MODULES</groupId>
>  <artifactId>module1</artifactId>
> <version>1.0</version>
> </dependency>
> </dependencies>
>
> Voilà, it should work now. Hope this help!
>
> On 11/3/05, Anuerin Diaz <ra...@gmail.com> wrote:
> >
> > hi,
> >
> > i am starting a multi-module project that has this structure
> >
> > root
> > |---module1
> > |-pom.xml
> > |---module2
> > |-pom.xml
> > |-pom.xml
> >
> > wherein module2 depends on module1. compilation of module1 goes
> > fine but module2 fails because it cannot see the classes in module1. i
> > hope somebody can point out what i am missing. my pom files are as
> > follows.
> >
> >
> > root pom:
> > ===========
> > <groupId>root</groupId>
> > <artifactId>Maintenance</artifactId>
> > <packaging>pom</packaging>
> > <version>1.0</version>
> > <name>Maintenance project</name>
> > <dependencies>
> > <dependency>
> > <groupId>log4j</groupId>
> > <artifactId>log4j</artifactId>
> > <version>1.2.8</version>
> > </dependency>
> > <dependency>
> > <groupId>xerces</groupId>
> > <artifactId>xercesImpl</artifactId>
> > <version>2.5.0</version>
> > </dependency>
> > </dependencies>
> > <modules>
> > <module>module1</module>
> > <module>module2</module>
> > </modules>
> >
> > module1 pom:
> > ===========
> > <groupId>root.MODULES</groupId>
> > <artifactId>module1</artifactId>
> > <packaging>jar</packaging>
> > <version>1.0</version>
> > <name>Module1 - common</name>
> > <parent>
> > <groupId>root</groupId>
> > <artifactId>Maintenance</artifactId>
> > <version>1.0</version>
> > </parent>
> > <dependencies>
> > <dependency>
> > <groupId>commons-fileupload</groupId>
> > <artifactId>commons-fileupload</artifactId>
> > <version>1.0</version>
> > </dependency>
> > </dependencies>
> > <build>
> > <finalName>Mod1</finalName>
> > </build>
> >
> > module2 pom:
> > ============
> > <groupId>root.MODULES</groupId>
> > <artifactId>module2</artifactId>
> > <packaging>jar</packaging>
> > <version>1.0</version>
> > <name>Module2 - app</name>
> > <parent>
> > <groupId>root</groupId>
> > <artifactId>Maintenance</artifactId>
> > <version>1.0</version>
> > </parent>
> > <build>
> > <finalName>Mod2</finalName>
> > </build>
> >
> >
> > i also tried removing the <finalName/> elements but the problem is
> > still the same. by my understanding maven should be able to resolve
> > the internal class dependencies of the module but i cant seem to
> > manage it. thanks.
> >
> > ciao!
> >
> >
> > --
> >
> > "Programming, an artform that fights back"
> >
> > Anuerin G. Diaz
> > Registered Linux User #246176
> > Friendly Linux Board @ http://mandrivausers.org/index.php
> > http://capsule.ramfree17.org , when you absolutely have nothing else
> > better to do
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
>
> --
> Alexandre Poitras
> Québec, Canada
>
>


--

"Programming, an artform that fights back"

Anuerin G. Diaz
Registered Linux User #246176
Friendly Linux Board @ http://mandrivausers.org/index.php
http://capsule.ramfree17.org , when you absolutely have nothing else
better to do

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


Re: [m2] multi-module visibility problem

Posted by Alexandre Poitras <al...@gmail.com>.
You have to declare module1 as dependency in module2. Maven cannot guess it
automatically. Add this in your Module2 pom.

<dependencies>
<dependency>
<groupId>root.MODULES</groupId>
 <artifactId>module1</artifactId>
<version>1.0</version>
</dependency>
</dependencies>

Voilà, it should work now. Hope this help!

On 11/3/05, Anuerin Diaz <ra...@gmail.com> wrote:
>
> hi,
>
> i am starting a multi-module project that has this structure
>
> root
> |---module1
> |-pom.xml
> |---module2
> |-pom.xml
> |-pom.xml
>
> wherein module2 depends on module1. compilation of module1 goes
> fine but module2 fails because it cannot see the classes in module1. i
> hope somebody can point out what i am missing. my pom files are as
> follows.
>
>
> root pom:
> ===========
> <groupId>root</groupId>
> <artifactId>Maintenance</artifactId>
> <packaging>pom</packaging>
> <version>1.0</version>
> <name>Maintenance project</name>
> <dependencies>
> <dependency>
> <groupId>log4j</groupId>
> <artifactId>log4j</artifactId>
> <version>1.2.8</version>
> </dependency>
> <dependency>
> <groupId>xerces</groupId>
> <artifactId>xercesImpl</artifactId>
> <version>2.5.0</version>
> </dependency>
> </dependencies>
> <modules>
> <module>module1</module>
> <module>module2</module>
> </modules>
>
> module1 pom:
> ===========
> <groupId>root.MODULES</groupId>
> <artifactId>module1</artifactId>
> <packaging>jar</packaging>
> <version>1.0</version>
> <name>Module1 - common</name>
> <parent>
> <groupId>root</groupId>
> <artifactId>Maintenance</artifactId>
> <version>1.0</version>
> </parent>
> <dependencies>
> <dependency>
> <groupId>commons-fileupload</groupId>
> <artifactId>commons-fileupload</artifactId>
> <version>1.0</version>
> </dependency>
> </dependencies>
> <build>
> <finalName>Mod1</finalName>
> </build>
>
> module2 pom:
> ============
> <groupId>root.MODULES</groupId>
> <artifactId>module2</artifactId>
> <packaging>jar</packaging>
> <version>1.0</version>
> <name>Module2 - app</name>
> <parent>
> <groupId>root</groupId>
> <artifactId>Maintenance</artifactId>
> <version>1.0</version>
> </parent>
> <build>
> <finalName>Mod2</finalName>
> </build>
>
>
> i also tried removing the <finalName/> elements but the problem is
> still the same. by my understanding maven should be able to resolve
> the internal class dependencies of the module but i cant seem to
> manage it. thanks.
>
> ciao!
>
>
> --
>
> "Programming, an artform that fights back"
>
> Anuerin G. Diaz
> Registered Linux User #246176
> Friendly Linux Board @ http://mandrivausers.org/index.php
> http://capsule.ramfree17.org , when you absolutely have nothing else
> better to do
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


--
Alexandre Poitras
Québec, Canada