You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Ramesh Babu Pokala - TLS, Chennai" <PR...@hcl.in> on 2007/04/21 17:12:30 UTC

Problem in packaging multiple directories

Hi,
I was unable to compile multi directory project... I tried in different
ways (follwed from maven - getting started site) but still did not get
the solution. 
 
I have directory structure like
 
 
    abc
     |
     |___________src
                           |
                           |_____xxx
                                        |
                                        |______yyy
                                                      |
                                                      |_____zzz
                                                                 |
 
|________aaa   -->  java files
                                                                 |
 
|________bbb   -->  java files
                                                                 |
 
|________ccc   --> java files
 
 
Now i want to compile sources in all the packages xxx.yyy.zzz.aaa,
xxx.yyy.zzz.bbb  and  xxx.yyy.zzz.ccc.
 
 
Tries......
 
1)  Having only one POM in abc directory and packaging as jar.....
 
<project>
 :
 :
<modelVersion>4.0.0</modelVersion> 

<groupId>xxx.yyy.zzz</groupId> 

<artifactId>abc</artifactId> 

<packaging>jar</packaging> 

 :

</project>

 Note: I did not mention sub packages aaa, bbb and ccc as modules in the
pom.   
 
Output : no sources to compile  
 
 
2) Having Parent pom in abc and having separate poms in each and every
package aaa,bb and ccc
 
parent pom:  mentioned packaging as pom, also mentioned modules
 
<project>
 :
 :
<modelVersion>4.0.0</modelVersion> 

<groupId>xxx.yyy.zzz</groupId> 

<artifactId>abc</artifactId> 

<packaging>pom</packaging> 

 :

<modules> 

<module>xxx.yyy.zzz.aaa</module> 

<module>xxx.yyy.zzz.bbb</module> 

<module>xxx.yyy.zzz.ccc</module>

</modules>

</project>

 
Now i have child poms like
 
:
:
<parent> 

<groupId>xxx.yyy.zzz</groupId> 

<artifactId>abc</artifactId> 

</parent> 

<modelVersion>4.0.0</modelVersion> 

<groupId>xxx.yyy.zzz.aaa</groupId> 

<artifactId>aaa</artifactId> 

<packaging>jar</packaging> 

<name>aaa package</name> 

:

: 

 
 
Output :  
 

[INFO] Scanning for projects...
[INFO]
------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO]
------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
 

Project ID: unknown
 
Reason: Could not find the model file 'C:\Documents and
Settings\bpra\Desktop\SampleRCP\abc\xxx.yyy.zzz.
.aaa\pom.xml'.
 
 
Do I need to have pom in each of the packages aaa, bbb and ccc?
what is the problem?
 
Can anyone please help me out?
 
 

Thanks you 

Ramesh



DISCLAIMER:
-----------------------------------------------------------------------------------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in 
this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of 
this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have
received this email in error please delete it and notify the sender immediately. Before opening any mail and 
attachments please check them for viruses and defect.

-----------------------------------------------------------------------------------------------------------------------

Re: Problem in packaging multiple directories

Posted by Wayne Fay <wa...@gmail.com>.
Maven2 requires Java source code to be in:
my-app/src/main/java

You can change some settings in the pom so your source directory is
app/src/java for example, but you'll need to figure this out on your
own -- its documented on the Maven site. I suggest you don't head down
the path of changing all these values if you want to keep your sanity.

Wayne

On 4/24/07, Ramesh Babu Pokala - TLS, Chennai <PR...@hcl.in> wrote:
>
> Hi,
>
>  One small query:
>
> my-app
> >   |-- pom.xml
> >   `-- src
> >        -- main
> >          `-- java
> >             `-- package1
> >                  `-- package2
> >                      `-- package3
> >                      |   `-- App.java
> >                      `-- package4
> >                          `-- MyClass.java
>
>
> Is that main/java mandotory in package structure...?
>
> Can I have src/package1/package2/......  Instead of
> src/main/java/package1/package2/......?
>
> If I don't have main/java, maven -e compile goal saying no sources to
> compile.
>
>
> Thanks & Regards
> Ramesh Babu.P
>
>
>
> -----Original Message-----
> From: Tim Kettler [mailto:tim.kettler@udo.edu]
> Sent: Monday, April 23, 2007 7:53 PM
> To: Maven Users List
> Subject: RE: Problem in packaging multiple directories
>
> Hi,
>
> There only ever is one 'pom.xml' per project. The project structure
> below really shows all essential file needed.
>
> I suggest you set up a simple test project up-to the point where you can
> successfully compile and package it and then venture on from this
> starting point. The test project would have one 'pom.xml' in it's root
> directory and a 'src/main/java' directory containing the java classes
> and packages.
>
> Once you have that up and running you can extend you example like
> described in Point III. from my last mail. What you will have then is a
> working multi-module project (I don't know if that's the official term
> but it's what I'm calling it). And again like in the example for the
> simple (one-module) project all relevant files are shown in my last
> mail.
>
> One point I think you are confused with is the difference between a
> multi-module (aggregation) project and pom inheritance (parent pom).
> In a multi-module project there is no parent pom involved per se.
> You just have a set of (concrete) projects where the actual code is
> compiled and one or more aggregation projects (with a packaging of type
> pom) that _aggregate_ the build of the concrete projects via the
> <modules/> tag in the pom. No parent poms involved here.
>
> A parent pom is something analogue to a superclass in java it captures
> portions of common configuration. For example if you have multiple
> projects depending on the same library, you could create a parent pom
> which declares that library as a dependency and let all projects needing
> that library inherit from the parent pom via the <parent/> tag.
>
> -Tim
>
> Am Montag, den 23.04.2007, 18:40 +0530 schrieb Ramesh Babu Pokala - TLS,
> Chennai:
> >  Thanks for your response.
> > I am following the following structure as u mentioned
> >
> >  my-app
> >   |-- pom.xml
> >   `-- src
> >        -- main
> >          `-- java
> >             `-- package1
> >                  `-- package2
> >                      `-- package3
> >                      |   `-- App.java
> >                      `-- package4
> >                          `-- MyClass.java
> >
> >
> > Then what should be my parent POM.xml?
> > How many poms I need. Do I need poms for package3 as well as package4
> > along with main pom?
> >  `
> >
> > Thanks & Regards
> > Ramesh Babu.P
> >
> > -----Original Message-----
> > From: Tim Kettler [mailto:tim.kettler@udo.edu]
> > Sent: Saturday, April 21, 2007 11:42 PM
> > To: Maven Users List
> > Subject: Re: Problem in packaging multiple directories
> >
> > Hi,
> >
> > I. Maven Directory Layout
> >
> > If you follow the 'Getting Started Guide' you should have a directory
> > structure like the one below:
> >
> >   my-app
> >   |-- pom.xml
> >   `-- src
> >       |-- main
> >       |   `-- java
> >       |       `-- package1
> >       |           `-- package2
> >       |               `-- package3
> >       |               |   `-- App.java
> >       |               `-- package4
> >       |                   `-- MyClass.java
> >       `-- test
> >           `-- java
> >               `-- packakag1
> >                   `-- package2
> >                       `-- package3
> >                           `-- AppTest.java
> >
> > This is the default layout maven expects. If you are not converting
> > from a legacy project and absolutely need a different directory layout
>
> > you should stick to this default. That will save you from much hassle.
> >
> > If you really can't follow that proposed structure, you have to
> > override the maven default values in the pom (see [1], [2] and [3] for
>
> > a complete description of the pom).
> >
> > For example, to override the default source directory you would have
> > something like this in your pom:
> >
> >   <project>
> >     ...
> >     <build>
> >
> > <sourceDirectory>my/non/standard/source/directory</sourceDirectory>
> >       ...
> >     </build>
> >     ...
> >   </project>
> >
> >
> > II. Multiple Source Directories Per Project
> >
> > Maven has a one-set-of-sources-per-project philosophy so if you really
>
> > need multiple source directories you are somewhat working against the
> > spirit of maven. Instead you should organize your project in multiple
> > modules (see below) and make them depend on each other.
> >
> > If you really need to have more than one set of sources in a single
> > project you can attach an additional source directory using the
> > build-helper-maven-plugin [4].
> >
> >
> > III. Multi-Module Projects
> >
> > Multi-Module projects are a set of maven projects (logical!!, not
> > necessarily physical on disk) organized as a tree. The nodes in the
> > logical tree are projects with a packaging of type pom with the leaves
>
> > of the tree containing the projects where you actual build your
> > artifacts (jar, war, ...).
> >
> > A typical layout could look like this:
> >
> >   my-app
> >   |-- pom.xml
> >   |-- subproject1
> >   |   |-- pom.xml
> >   |   `-- src
> >   |       `-- main
> >   |           `-- java
> >   |               `-- package1
> >   |                   `-- package2
> >   |                       `-- package3
> >   |                           `-- App.java
> >   `-- subproject1
> >       |-- pom.xml
> >       `-- src
> >           `-- main
> >               `-- java
> >                   `-- package1
> >                       `-- package2
> >                           `-- UtilityClass.java
> >
> > The content of the poms would then look like this:
> >
> > my-app/pom.xml:
> >
> >   <project>
> >     <groupId>com.mycompany.app</groupId>
> >     <version>1.0-SNAPSHOT</version>
> >     <artifactId>app</artifactId>
> >
> >     <packaging>pom</packaging>
> >
> >     <modules>
> >       <module>subproject1</module>
> >       <module>subproject2</module>
> >     </modules>
> >   </project>
> >
> > subproject1/pom.xml:
> >
> >   <project>
> >     <groupId>com.mycompany.app</groupId>
> >     <artifactId>subproject1</artifactId>
> >     <version>1.0-SNAPSHOT</version>
> >
> >     <packaging>jar</packaging>
> >
> >     <dependencies>
> >       <dependency>
> >         <groupId>com.mycompany.app</groupId>
> >         <artifactId>subproject1</artifactId>
> >         <version>1.0-SNAPSHOT</version>
> >       </dependency>
> >     </dependencies>
> >   </project>
> >
> > subproject2/pom.xml:
> >
> >   <project>
> >     <groupId>com.mycompany.app</groupId>
> >     <artifactId>subproject2</artifactId>
> >     <version>1.0-SNAPSHOT</version>
> >
> >     <packaging>jar</packaging>
> >   </project>
> >
> >
> >
> > Hope this gets you started
> > -Tim
> >
> > [1]
> > http://maven.apache.org/guides/introduction/introduction-to-the-pom.ht
> > ml
> > [2] http://maven.apache.org/pom.html
> > [3] http://maven.apache.org/ref/current/maven-model/maven.html
> > [4] http://mojo.codehaus.org/build-helper-maven-plugin/howto.html
> >
> >
> >
> > Am Samstag, den 21.04.2007, 20:42 +0530 schrieb Ramesh Babu Pokala -
> > TLS, Chennai:
> > > Hi,
> > > I was unable to compile multi directory project... I tried in
> > > different ways (follwed from maven - getting started site) but still
>
> > > did not get the solution.
> > >
> > > I have directory structure like
> > >
> > >
> > >     abc
> > >      |
> > >      |___________src
> > >                            |
> > >                            |_____xxx
> > >                                         |
> > >                                         |______yyy
> > >                                                       |
> > >                                                       |_____zzz
> > >                                                                  |
> > >
> > > |________aaa   -->  java files
> > >                                                                  |
> > >
> > > |________bbb   -->  java files
> > >                                                                  |
> > >
> > > |________ccc   --> java files
> > >
> > >
> > > Now i want to compile sources in all the packages xxx.yyy.zzz.aaa,
> > > xxx.yyy.zzz.bbb  and  xxx.yyy.zzz.ccc.
> > >
> > >
> > > Tries......
> > >
> > > 1)  Having only one POM in abc directory and packaging as jar.....
> > >
> > > <project>
> > >  :
> > >  :
> > > <modelVersion>4.0.0</modelVersion>
> > >
> > > <groupId>xxx.yyy.zzz</groupId>
> > >
> > > <artifactId>abc</artifactId>
> > >
> > > <packaging>jar</packaging>
> > >
> > >  :
> > >
> > > </project>
> > >
> > >  Note: I did not mention sub packages aaa, bbb and ccc as modules in
> > the
> > > pom.
> > >
> > > Output : no sources to compile
> > >
> > >
> > > 2) Having Parent pom in abc and having separate poms in each and
> > > every
> >
> > > package aaa,bb and ccc
> > >
> > > parent pom:  mentioned packaging as pom, also mentioned modules
> > >
> > > <project>
> > >  :
> > >  :
> > > <modelVersion>4.0.0</modelVersion>
> > >
> > > <groupId>xxx.yyy.zzz</groupId>
> > >
> > > <artifactId>abc</artifactId>
> > >
> > > <packaging>pom</packaging>
> > >
> > >  :
> > >
> > > <modules>
> > >
> > > <module>xxx.yyy.zzz.aaa</module>
> > >
> > > <module>xxx.yyy.zzz.bbb</module>
> > >
> > > <module>xxx.yyy.zzz.ccc</module>
> > >
> > > </modules>
> > >
> > > </project>
> > >
> > >
> > > Now i have child poms like
> > >
> > > :
> > > :
> > > <parent>
> > >
> > > <groupId>xxx.yyy.zzz</groupId>
> > >
> > > <artifactId>abc</artifactId>
> > >
> > > </parent>
> > >
> > > <modelVersion>4.0.0</modelVersion>
> > >
> > > <groupId>xxx.yyy.zzz.aaa</groupId>
> > >
> > > <artifactId>aaa</artifactId>
> > >
> > > <packaging>jar</packaging>
> > >
> > > <name>aaa package</name>
> > >
> > > :
> > >
> > > :
> > >
> > >
> > >
> > > Output :
> > >
> > >
> > > [INFO] Scanning for projects...
> > > [INFO]
> > > --------------------------------------------------------------------
> > > --
> > > --
> > > [ERROR] FATAL ERROR
> > > [INFO]
> > > --------------------------------------------------------------------
> > > --
> > > -- [INFO] Error building POM (may not be this project's POM).
> > >
> > >
> > > Project ID: unknown
> > >
> > > Reason: Could not find the model file 'C:\Documents and
> > > Settings\bpra\Desktop\SampleRCP\abc\xxx.yyy.zzz.
> > > .aaa\pom.xml'.
> > >
> > >
> > > Do I need to have pom in each of the packages aaa, bbb and ccc?
> > > what is the problem?
> > >
> > > Can anyone please help me out?
> > >
> > >
> > >
> > > Thanks you
> > >
> > > Ramesh
> > >
> > >
> > >
> > > DISCLAIMER:
> > > --------------------------------------------------------------------
> > > --
> > > -------------------------------------------------
> > >
> > > The contents of this e-mail and any attachment(s) are confidential
> > > and
> > intended for the named recipient(s) only.
> > > It shall not attach any liability on the originator or HCL or its
> > > affiliates. Any views or opinions presented in this email are solely
> > those of the author and may not necessarily reflect the opinions of
> > HCL or its affiliates.
> > > Any form of reproduction, dissemination, copying, disclosure,
> > > modification, distribution and / or publication of this message
> > > without the prior written consent of the author of this e-mail is
> > > strictly prohibited. If you have received this email in error please
> > delete it and notify the sender immediately. Before opening any mail
> > and attachments please check them for viruses and defect.
> > >
> > > --------------------------------------------------------------------
> > > --
> > > -------------------------------------------------
> >
> >
> > ---------------------------------------------------------------------
> > 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
>
>
> ---------------------------------------------------------------------
> 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: Problem in packaging multiple directories

Posted by "Ramesh Babu Pokala - TLS, Chennai" <PR...@hcl.in>.
 
Yes I got the solution.
I modified POM.xml (<build> tag) to take the sources from required
location.


Thanks & Regards 
Ramesh Babu.P 
  

-----Original Message-----
From: Ramesh Babu Pokala - TLS, Chennai 
Sent: Tuesday, April 24, 2007 10:32 AM
To: Maven Users List
Subject: RE: Problem in packaging multiple directories

 
Hi,

  One small query:

my-app
>   |-- pom.xml
>   `-- src
>        -- main
>          `-- java
>             `-- package1
>                  `-- package2
>                      `-- package3
>                      |   `-- App.java
>                      `-- package4
>                          `-- MyClass.java


Is that main/java mandotory in package structure...?

Can I have src/package1/package2/......  Instead of
src/main/java/package1/package2/......?

If I don't have main/java, maven -e compile goal saying no sources to
compile.


Thanks & Regards
Ramesh Babu.P 
  
 

-----Original Message-----
From: Tim Kettler [mailto:tim.kettler@udo.edu]
Sent: Monday, April 23, 2007 7:53 PM
To: Maven Users List
Subject: RE: Problem in packaging multiple directories

Hi,

There only ever is one 'pom.xml' per project. The project structure
below really shows all essential file needed.

I suggest you set up a simple test project up-to the point where you can
successfully compile and package it and then venture on from this
starting point. The test project would have one 'pom.xml' in it's root
directory and a 'src/main/java' directory containing the java classes
and packages.

Once you have that up and running you can extend you example like
described in Point III. from my last mail. What you will have then is a
working multi-module project (I don't know if that's the official term
but it's what I'm calling it). And again like in the example for the
simple (one-module) project all relevant files are shown in my last
mail.

One point I think you are confused with is the difference between a
multi-module (aggregation) project and pom inheritance (parent pom).
In a multi-module project there is no parent pom involved per se.
You just have a set of (concrete) projects where the actual code is
compiled and one or more aggregation projects (with a packaging of type
pom) that _aggregate_ the build of the concrete projects via the
<modules/> tag in the pom. No parent poms involved here.

A parent pom is something analogue to a superclass in java it captures
portions of common configuration. For example if you have multiple
projects depending on the same library, you could create a parent pom
which declares that library as a dependency and let all projects needing
that library inherit from the parent pom via the <parent/> tag.

-Tim

Am Montag, den 23.04.2007, 18:40 +0530 schrieb Ramesh Babu Pokala - TLS,
Chennai:
>  Thanks for your response.
> I am following the following structure as u mentioned
> 
>  my-app
>   |-- pom.xml
>   `-- src
>        -- main
>          `-- java
>             `-- package1
>                  `-- package2
>                      `-- package3
>                      |   `-- App.java
>                      `-- package4
>                          `-- MyClass.java
>      
> 
> Then what should be my parent POM.xml? 
> How many poms I need. Do I need poms for package3 as well as package4 
> along with main pom?
>  `
> 
> Thanks & Regards
> Ramesh Babu.P
>   
> -----Original Message-----
> From: Tim Kettler [mailto:tim.kettler@udo.edu]
> Sent: Saturday, April 21, 2007 11:42 PM
> To: Maven Users List
> Subject: Re: Problem in packaging multiple directories
> 
> Hi,
> 
> I. Maven Directory Layout
> 
> If you follow the 'Getting Started Guide' you should have a directory 
> structure like the one below:
> 
>   my-app
>   |-- pom.xml
>   `-- src
>       |-- main
>       |   `-- java
>       |       `-- package1
>       |           `-- package2
>       |               `-- package3
>       |               |   `-- App.java
>       |               `-- package4
>       |                   `-- MyClass.java
>       `-- test
>           `-- java
>               `-- packakag1
>                   `-- package2
>                       `-- package3
>                           `-- AppTest.java
> 
> This is the default layout maven expects. If you are not converting 
> from a legacy project and absolutely need a different directory layout

> you should stick to this default. That will save you from much hassle.
> 
> If you really can't follow that proposed structure, you have to 
> override the maven default values in the pom (see [1], [2] and [3] for

> a complete description of the pom).
> 
> For example, to override the default source directory you would have 
> something like this in your pom:
> 
>   <project>
>     ...
>     <build>
>  
> <sourceDirectory>my/non/standard/source/directory</sourceDirectory>
>       ...
>     </build>
>     ...
>   </project>
> 
> 
> II. Multiple Source Directories Per Project
> 
> Maven has a one-set-of-sources-per-project philosophy so if you really

> need multiple source directories you are somewhat working against the 
> spirit of maven. Instead you should organize your project in multiple 
> modules (see below) and make them depend on each other.
> 
> If you really need to have more than one set of sources in a single 
> project you can attach an additional source directory using the 
> build-helper-maven-plugin [4].
> 
> 
> III. Multi-Module Projects
> 
> Multi-Module projects are a set of maven projects (logical!!, not 
> necessarily physical on disk) organized as a tree. The nodes in the 
> logical tree are projects with a packaging of type pom with the leaves

> of the tree containing the projects where you actual build your 
> artifacts (jar, war, ...).
> 
> A typical layout could look like this:
> 
>   my-app
>   |-- pom.xml
>   |-- subproject1
>   |   |-- pom.xml
>   |   `-- src
>   |       `-- main
>   |           `-- java
>   |               `-- package1
>   |                   `-- package2
>   |                       `-- package3
>   |                           `-- App.java
>   `-- subproject1
>       |-- pom.xml
>       `-- src
>           `-- main
>               `-- java
>                   `-- package1
>                       `-- package2
>                           `-- UtilityClass.java
> 
> The content of the poms would then look like this:
> 
> my-app/pom.xml:
> 
>   <project>
>     <groupId>com.mycompany.app</groupId>
>     <version>1.0-SNAPSHOT</version>
>     <artifactId>app</artifactId>
> 
>     <packaging>pom</packaging>
> 
>     <modules>
>       <module>subproject1</module>
>       <module>subproject2</module>
>     </modules>
>   </project>
> 
> subproject1/pom.xml:
> 
>   <project>
>     <groupId>com.mycompany.app</groupId>
>     <artifactId>subproject1</artifactId>
>     <version>1.0-SNAPSHOT</version>
> 
>     <packaging>jar</packaging>
> 
>     <dependencies>
>       <dependency>
>         <groupId>com.mycompany.app</groupId>
>         <artifactId>subproject1</artifactId>
>         <version>1.0-SNAPSHOT</version>
>       </dependency>
>     </dependencies>
>   </project>
> 
> subproject2/pom.xml:
> 
>   <project>
>     <groupId>com.mycompany.app</groupId>
>     <artifactId>subproject2</artifactId>
>     <version>1.0-SNAPSHOT</version>
> 
>     <packaging>jar</packaging>
>   </project>
> 
> 
> 
> Hope this gets you started
> -Tim
> 
> [1]
> http://maven.apache.org/guides/introduction/introduction-to-the-pom.ht
> ml
> [2] http://maven.apache.org/pom.html
> [3] http://maven.apache.org/ref/current/maven-model/maven.html
> [4] http://mojo.codehaus.org/build-helper-maven-plugin/howto.html
> 
> 
> 
> Am Samstag, den 21.04.2007, 20:42 +0530 schrieb Ramesh Babu Pokala - 
> TLS, Chennai:
> > Hi,
> > I was unable to compile multi directory project... I tried in 
> > different ways (follwed from maven - getting started site) but still

> > did not get the solution.
> >  
> > I have directory structure like
> >  
> > 
> >     abc
> >      |
> >      |___________src
> >                            |
> >                            |_____xxx
> >                                         |
> >                                         |______yyy
> >                                                       |
> >                                                       |_____zzz
> >                                                                  |
> >  
> > |________aaa   -->  java files
> >                                                                  |
> >  
> > |________bbb   -->  java files
> >                                                                  |
> >  
> > |________ccc   --> java files
> >  
> > 
> > Now i want to compile sources in all the packages xxx.yyy.zzz.aaa, 
> > xxx.yyy.zzz.bbb  and  xxx.yyy.zzz.ccc.
> >  
> > 
> > Tries......
> >  
> > 1)  Having only one POM in abc directory and packaging as jar.....
> >  
> > <project>
> >  :
> >  :
> > <modelVersion>4.0.0</modelVersion>
> > 
> > <groupId>xxx.yyy.zzz</groupId>
> > 
> > <artifactId>abc</artifactId>
> > 
> > <packaging>jar</packaging>
> > 
> >  :
> > 
> > </project>
> > 
> >  Note: I did not mention sub packages aaa, bbb and ccc as modules in
> the
> > pom.   
> >  
> > Output : no sources to compile
> >  
> > 
> > 2) Having Parent pom in abc and having separate poms in each and 
> > every
> 
> > package aaa,bb and ccc
> >  
> > parent pom:  mentioned packaging as pom, also mentioned modules
> >  
> > <project>
> >  :
> >  :
> > <modelVersion>4.0.0</modelVersion>
> > 
> > <groupId>xxx.yyy.zzz</groupId>
> > 
> > <artifactId>abc</artifactId>
> > 
> > <packaging>pom</packaging>
> > 
> >  :
> > 
> > <modules>
> > 
> > <module>xxx.yyy.zzz.aaa</module>
> > 
> > <module>xxx.yyy.zzz.bbb</module>
> > 
> > <module>xxx.yyy.zzz.ccc</module>
> > 
> > </modules>
> > 
> > </project>
> > 
> >  
> > Now i have child poms like
> >  
> > :
> > :
> > <parent>
> > 
> > <groupId>xxx.yyy.zzz</groupId>
> > 
> > <artifactId>abc</artifactId>
> > 
> > </parent>
> > 
> > <modelVersion>4.0.0</modelVersion>
> > 
> > <groupId>xxx.yyy.zzz.aaa</groupId>
> > 
> > <artifactId>aaa</artifactId>
> > 
> > <packaging>jar</packaging>
> > 
> > <name>aaa package</name>
> > 
> > :
> > 
> > : 
> > 
> >  
> > 
> > Output :  
> >  
> > 
> > [INFO] Scanning for projects...
> > [INFO]
> > --------------------------------------------------------------------
> > --
> > --
> > [ERROR] FATAL ERROR
> > [INFO]
> > --------------------------------------------------------------------
> > --
> > -- [INFO] Error building POM (may not be this project's POM).
> >  
> > 
> > Project ID: unknown
> >  
> > Reason: Could not find the model file 'C:\Documents and 
> > Settings\bpra\Desktop\SampleRCP\abc\xxx.yyy.zzz.
> > .aaa\pom.xml'.
> >  
> > 
> > Do I need to have pom in each of the packages aaa, bbb and ccc?
> > what is the problem?
> >  
> > Can anyone please help me out?
> >  
> > 
> > 
> > Thanks you
> > 
> > Ramesh
> > 
> > 
> > 
> > DISCLAIMER:
> > --------------------------------------------------------------------
> > --
> > -------------------------------------------------
> > 
> > The contents of this e-mail and any attachment(s) are confidential 
> > and
> intended for the named recipient(s) only.
> > It shall not attach any liability on the originator or HCL or its 
> > affiliates. Any views or opinions presented in this email are solely
> those of the author and may not necessarily reflect the opinions of 
> HCL or its affiliates.
> > Any form of reproduction, dissemination, copying, disclosure, 
> > modification, distribution and / or publication of this message 
> > without the prior written consent of the author of this e-mail is 
> > strictly prohibited. If you have received this email in error please
> delete it and notify the sender immediately. Before opening any mail 
> and attachments please check them for viruses and defect.
> > 
> > --------------------------------------------------------------------
> > --
> > -------------------------------------------------
> 
> 
> ---------------------------------------------------------------------
> 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


---------------------------------------------------------------------
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: Problem in packaging multiple directories

Posted by "Ramesh Babu Pokala - TLS, Chennai" <PR...@hcl.in>.
 
Hi,

  One small query:

my-app
>   |-- pom.xml
>   `-- src
>        -- main
>          `-- java
>             `-- package1
>                  `-- package2
>                      `-- package3
>                      |   `-- App.java
>                      `-- package4
>                          `-- MyClass.java


Is that main/java mandotory in package structure...?

Can I have src/package1/package2/......  Instead of
src/main/java/package1/package2/......?

If I don't have main/java, maven -e compile goal saying no sources to
compile.


Thanks & Regards 
Ramesh Babu.P 
  
 

-----Original Message-----
From: Tim Kettler [mailto:tim.kettler@udo.edu] 
Sent: Monday, April 23, 2007 7:53 PM
To: Maven Users List
Subject: RE: Problem in packaging multiple directories

Hi,

There only ever is one 'pom.xml' per project. The project structure
below really shows all essential file needed.

I suggest you set up a simple test project up-to the point where you can
successfully compile and package it and then venture on from this
starting point. The test project would have one 'pom.xml' in it's root
directory and a 'src/main/java' directory containing the java classes
and packages.

Once you have that up and running you can extend you example like
described in Point III. from my last mail. What you will have then is a
working multi-module project (I don't know if that's the official term
but it's what I'm calling it). And again like in the example for the
simple (one-module) project all relevant files are shown in my last
mail.

One point I think you are confused with is the difference between a
multi-module (aggregation) project and pom inheritance (parent pom).
In a multi-module project there is no parent pom involved per se.
You just have a set of (concrete) projects where the actual code is
compiled and one or more aggregation projects (with a packaging of type
pom) that _aggregate_ the build of the concrete projects via the
<modules/> tag in the pom. No parent poms involved here.

A parent pom is something analogue to a superclass in java it captures
portions of common configuration. For example if you have multiple
projects depending on the same library, you could create a parent pom
which declares that library as a dependency and let all projects needing
that library inherit from the parent pom via the <parent/> tag.

-Tim

Am Montag, den 23.04.2007, 18:40 +0530 schrieb Ramesh Babu Pokala - TLS,
Chennai:
>  Thanks for your response.
> I am following the following structure as u mentioned
> 
>  my-app
>   |-- pom.xml
>   `-- src
>        -- main
>          `-- java
>             `-- package1
>                  `-- package2
>                      `-- package3
>                      |   `-- App.java
>                      `-- package4
>                          `-- MyClass.java
>      
> 
> Then what should be my parent POM.xml? 
> How many poms I need. Do I need poms for package3 as well as package4 
> along with main pom?
>  `
> 
> Thanks & Regards
> Ramesh Babu.P
>   
> -----Original Message-----
> From: Tim Kettler [mailto:tim.kettler@udo.edu]
> Sent: Saturday, April 21, 2007 11:42 PM
> To: Maven Users List
> Subject: Re: Problem in packaging multiple directories
> 
> Hi,
> 
> I. Maven Directory Layout
> 
> If you follow the 'Getting Started Guide' you should have a directory 
> structure like the one below:
> 
>   my-app
>   |-- pom.xml
>   `-- src
>       |-- main
>       |   `-- java
>       |       `-- package1
>       |           `-- package2
>       |               `-- package3
>       |               |   `-- App.java
>       |               `-- package4
>       |                   `-- MyClass.java
>       `-- test
>           `-- java
>               `-- packakag1
>                   `-- package2
>                       `-- package3
>                           `-- AppTest.java
> 
> This is the default layout maven expects. If you are not converting 
> from a legacy project and absolutely need a different directory layout

> you should stick to this default. That will save you from much hassle.
> 
> If you really can't follow that proposed structure, you have to 
> override the maven default values in the pom (see [1], [2] and [3] for

> a complete description of the pom).
> 
> For example, to override the default source directory you would have 
> something like this in your pom:
> 
>   <project>
>     ...
>     <build>
>  
> <sourceDirectory>my/non/standard/source/directory</sourceDirectory>
>       ...
>     </build>
>     ...
>   </project>
> 
> 
> II. Multiple Source Directories Per Project
> 
> Maven has a one-set-of-sources-per-project philosophy so if you really

> need multiple source directories you are somewhat working against the 
> spirit of maven. Instead you should organize your project in multiple 
> modules (see below) and make them depend on each other.
> 
> If you really need to have more than one set of sources in a single 
> project you can attach an additional source directory using the 
> build-helper-maven-plugin [4].
> 
> 
> III. Multi-Module Projects
> 
> Multi-Module projects are a set of maven projects (logical!!, not 
> necessarily physical on disk) organized as a tree. The nodes in the 
> logical tree are projects with a packaging of type pom with the leaves

> of the tree containing the projects where you actual build your 
> artifacts (jar, war, ...).
> 
> A typical layout could look like this:
> 
>   my-app
>   |-- pom.xml
>   |-- subproject1
>   |   |-- pom.xml
>   |   `-- src
>   |       `-- main
>   |           `-- java
>   |               `-- package1
>   |                   `-- package2
>   |                       `-- package3
>   |                           `-- App.java
>   `-- subproject1
>       |-- pom.xml
>       `-- src
>           `-- main
>               `-- java
>                   `-- package1
>                       `-- package2
>                           `-- UtilityClass.java
> 
> The content of the poms would then look like this:
> 
> my-app/pom.xml:
> 
>   <project>
>     <groupId>com.mycompany.app</groupId>
>     <version>1.0-SNAPSHOT</version>
>     <artifactId>app</artifactId>
> 
>     <packaging>pom</packaging>
> 
>     <modules>
>       <module>subproject1</module>
>       <module>subproject2</module>
>     </modules>
>   </project>
> 
> subproject1/pom.xml:
> 
>   <project>
>     <groupId>com.mycompany.app</groupId>
>     <artifactId>subproject1</artifactId>
>     <version>1.0-SNAPSHOT</version>
> 
>     <packaging>jar</packaging>
> 
>     <dependencies>
>       <dependency>
>         <groupId>com.mycompany.app</groupId>
>         <artifactId>subproject1</artifactId>
>         <version>1.0-SNAPSHOT</version>
>       </dependency>
>     </dependencies>
>   </project>
> 
> subproject2/pom.xml:
> 
>   <project>
>     <groupId>com.mycompany.app</groupId>
>     <artifactId>subproject2</artifactId>
>     <version>1.0-SNAPSHOT</version>
> 
>     <packaging>jar</packaging>
>   </project>
> 
> 
> 
> Hope this gets you started
> -Tim
> 
> [1]
> http://maven.apache.org/guides/introduction/introduction-to-the-pom.ht
> ml
> [2] http://maven.apache.org/pom.html
> [3] http://maven.apache.org/ref/current/maven-model/maven.html
> [4] http://mojo.codehaus.org/build-helper-maven-plugin/howto.html
> 
> 
> 
> Am Samstag, den 21.04.2007, 20:42 +0530 schrieb Ramesh Babu Pokala - 
> TLS, Chennai:
> > Hi,
> > I was unable to compile multi directory project... I tried in 
> > different ways (follwed from maven - getting started site) but still

> > did not get the solution.
> >  
> > I have directory structure like
> >  
> > 
> >     abc
> >      |
> >      |___________src
> >                            |
> >                            |_____xxx
> >                                         |
> >                                         |______yyy
> >                                                       |
> >                                                       |_____zzz
> >                                                                  |
> >  
> > |________aaa   -->  java files
> >                                                                  |
> >  
> > |________bbb   -->  java files
> >                                                                  |
> >  
> > |________ccc   --> java files
> >  
> > 
> > Now i want to compile sources in all the packages xxx.yyy.zzz.aaa, 
> > xxx.yyy.zzz.bbb  and  xxx.yyy.zzz.ccc.
> >  
> > 
> > Tries......
> >  
> > 1)  Having only one POM in abc directory and packaging as jar.....
> >  
> > <project>
> >  :
> >  :
> > <modelVersion>4.0.0</modelVersion>
> > 
> > <groupId>xxx.yyy.zzz</groupId>
> > 
> > <artifactId>abc</artifactId>
> > 
> > <packaging>jar</packaging>
> > 
> >  :
> > 
> > </project>
> > 
> >  Note: I did not mention sub packages aaa, bbb and ccc as modules in
> the
> > pom.   
> >  
> > Output : no sources to compile
> >  
> > 
> > 2) Having Parent pom in abc and having separate poms in each and 
> > every
> 
> > package aaa,bb and ccc
> >  
> > parent pom:  mentioned packaging as pom, also mentioned modules
> >  
> > <project>
> >  :
> >  :
> > <modelVersion>4.0.0</modelVersion>
> > 
> > <groupId>xxx.yyy.zzz</groupId>
> > 
> > <artifactId>abc</artifactId>
> > 
> > <packaging>pom</packaging>
> > 
> >  :
> > 
> > <modules>
> > 
> > <module>xxx.yyy.zzz.aaa</module>
> > 
> > <module>xxx.yyy.zzz.bbb</module>
> > 
> > <module>xxx.yyy.zzz.ccc</module>
> > 
> > </modules>
> > 
> > </project>
> > 
> >  
> > Now i have child poms like
> >  
> > :
> > :
> > <parent>
> > 
> > <groupId>xxx.yyy.zzz</groupId>
> > 
> > <artifactId>abc</artifactId>
> > 
> > </parent>
> > 
> > <modelVersion>4.0.0</modelVersion>
> > 
> > <groupId>xxx.yyy.zzz.aaa</groupId>
> > 
> > <artifactId>aaa</artifactId>
> > 
> > <packaging>jar</packaging>
> > 
> > <name>aaa package</name>
> > 
> > :
> > 
> > : 
> > 
> >  
> > 
> > Output :  
> >  
> > 
> > [INFO] Scanning for projects...
> > [INFO]
> > --------------------------------------------------------------------
> > --
> > --
> > [ERROR] FATAL ERROR
> > [INFO]
> > --------------------------------------------------------------------
> > --
> > -- [INFO] Error building POM (may not be this project's POM).
> >  
> > 
> > Project ID: unknown
> >  
> > Reason: Could not find the model file 'C:\Documents and 
> > Settings\bpra\Desktop\SampleRCP\abc\xxx.yyy.zzz.
> > .aaa\pom.xml'.
> >  
> > 
> > Do I need to have pom in each of the packages aaa, bbb and ccc?
> > what is the problem?
> >  
> > Can anyone please help me out?
> >  
> > 
> > 
> > Thanks you
> > 
> > Ramesh
> > 
> > 
> > 
> > DISCLAIMER:
> > --------------------------------------------------------------------
> > --
> > -------------------------------------------------
> > 
> > The contents of this e-mail and any attachment(s) are confidential 
> > and
> intended for the named recipient(s) only.
> > It shall not attach any liability on the originator or HCL or its 
> > affiliates. Any views or opinions presented in this email are solely
> those of the author and may not necessarily reflect the opinions of 
> HCL or its affiliates.
> > Any form of reproduction, dissemination, copying, disclosure, 
> > modification, distribution and / or publication of this message 
> > without the prior written consent of the author of this e-mail is 
> > strictly prohibited. If you have received this email in error please
> delete it and notify the sender immediately. Before opening any mail 
> and attachments please check them for viruses and defect.
> > 
> > --------------------------------------------------------------------
> > --
> > -------------------------------------------------
> 
> 
> ---------------------------------------------------------------------
> 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


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


RE: Problem in packaging multiple directories

Posted by Tim Kettler <ti...@udo.edu>.
Hi,

There only ever is one 'pom.xml' per project. The project structure
below really shows all essential file needed.

I suggest you set up a simple test project up-to the point where you can
successfully compile and package it and then venture on from this
starting point. The test project would have one 'pom.xml' in it's root
directory and a 'src/main/java' directory containing the java classes
and packages.

Once you have that up and running you can extend you example like
described in Point III. from my last mail. What you will have then is a
working multi-module project (I don't know if that's the official term
but it's what I'm calling it). And again like in the example for the
simple (one-module) project all relevant files are shown in my last
mail.

One point I think you are confused with is the difference between a
multi-module (aggregation) project and pom inheritance (parent pom).
In a multi-module project there is no parent pom involved per se.
You just have a set of (concrete) projects where the actual code is
compiled and one or more aggregation projects (with a packaging of type
pom) that _aggregate_ the build of the concrete projects via the
<modules/> tag in the pom. No parent poms involved here.

A parent pom is something analogue to a superclass in java it captures
portions of common configuration. For example if you have multiple
projects depending on the same library, you could create a parent pom
which declares that library as a dependency and let all projects needing
that library inherit from the parent pom via the <parent/> tag.

-Tim

Am Montag, den 23.04.2007, 18:40 +0530 schrieb Ramesh Babu Pokala - TLS,
Chennai:
>  Thanks for your response.
> I am following the following structure as u mentioned
> 
>  my-app
>   |-- pom.xml
>   `-- src
>        -- main
>          `-- java
>             `-- package1
>                  `-- package2
>                      `-- package3
>                      |   `-- App.java
>                      `-- package4
>                          `-- MyClass.java
>      
> 
> Then what should be my parent POM.xml? 
> How many poms I need. Do I need poms for package3 as well as package4
> along with main pom?
>  `
> 
> Thanks & Regards 
> Ramesh Babu.P 
>   
> -----Original Message-----
> From: Tim Kettler [mailto:tim.kettler@udo.edu] 
> Sent: Saturday, April 21, 2007 11:42 PM
> To: Maven Users List
> Subject: Re: Problem in packaging multiple directories
> 
> Hi,
> 
> I. Maven Directory Layout
> 
> If you follow the 'Getting Started Guide' you should have a directory
> structure like the one below:
> 
>   my-app
>   |-- pom.xml
>   `-- src
>       |-- main
>       |   `-- java
>       |       `-- package1
>       |           `-- package2
>       |               `-- package3
>       |               |   `-- App.java
>       |               `-- package4
>       |                   `-- MyClass.java
>       `-- test
>           `-- java
>               `-- packakag1
>                   `-- package2
>                       `-- package3
>                           `-- AppTest.java
> 
> This is the default layout maven expects. If you are not converting from
> a legacy project and absolutely need a different directory layout you
> should stick to this default. That will save you from much hassle.
> 
> If you really can't follow that proposed structure, you have to override
> the maven default values in the pom (see [1], [2] and [3] for a complete
> description of the pom).
> 
> For example, to override the default source directory you would have
> something like this in your pom:
> 
>   <project>
>     ...
>     <build>
>  
> <sourceDirectory>my/non/standard/source/directory</sourceDirectory>
>       ...
>     </build>
>     ...
>   </project>
> 
> 
> II. Multiple Source Directories Per Project
> 
> Maven has a one-set-of-sources-per-project philosophy so if you really
> need multiple source directories you are somewhat working against the
> spirit of maven. Instead you should organize your project in multiple
> modules (see below) and make them depend on each other.
> 
> If you really need to have more than one set of sources in a single
> project you can attach an additional source directory using the
> build-helper-maven-plugin [4].
> 
> 
> III. Multi-Module Projects
> 
> Multi-Module projects are a set of maven projects (logical!!, not
> necessarily physical on disk) organized as a tree. The nodes in the
> logical tree are projects with a packaging of type pom with the leaves
> of the tree containing the projects where you actual build your
> artifacts (jar, war, ...).
> 
> A typical layout could look like this:
> 
>   my-app
>   |-- pom.xml
>   |-- subproject1
>   |   |-- pom.xml
>   |   `-- src
>   |       `-- main
>   |           `-- java
>   |               `-- package1
>   |                   `-- package2
>   |                       `-- package3
>   |                           `-- App.java
>   `-- subproject1
>       |-- pom.xml
>       `-- src
>           `-- main
>               `-- java
>                   `-- package1
>                       `-- package2
>                           `-- UtilityClass.java
> 
> The content of the poms would then look like this:
> 
> my-app/pom.xml:
> 
>   <project>
>     <groupId>com.mycompany.app</groupId>
>     <version>1.0-SNAPSHOT</version>
>     <artifactId>app</artifactId>
> 
>     <packaging>pom</packaging>
> 
>     <modules>
>       <module>subproject1</module>
>       <module>subproject2</module>
>     </modules>
>   </project>
> 
> subproject1/pom.xml:
> 
>   <project>
>     <groupId>com.mycompany.app</groupId>
>     <artifactId>subproject1</artifactId>
>     <version>1.0-SNAPSHOT</version>
> 
>     <packaging>jar</packaging>
> 
>     <dependencies>
>       <dependency>
>         <groupId>com.mycompany.app</groupId>
>         <artifactId>subproject1</artifactId>
>         <version>1.0-SNAPSHOT</version>
>       </dependency>
>     </dependencies>
>   </project>
> 
> subproject2/pom.xml:
> 
>   <project>
>     <groupId>com.mycompany.app</groupId>
>     <artifactId>subproject2</artifactId>
>     <version>1.0-SNAPSHOT</version>
> 
>     <packaging>jar</packaging>
>   </project>
> 
> 
> 
> Hope this gets you started
> -Tim
> 
> [1]
> http://maven.apache.org/guides/introduction/introduction-to-the-pom.html
> [2] http://maven.apache.org/pom.html
> [3] http://maven.apache.org/ref/current/maven-model/maven.html
> [4] http://mojo.codehaus.org/build-helper-maven-plugin/howto.html
> 
> 
> 
> Am Samstag, den 21.04.2007, 20:42 +0530 schrieb Ramesh Babu Pokala -
> TLS, Chennai:
> > Hi,
> > I was unable to compile multi directory project... I tried in 
> > different ways (follwed from maven - getting started site) but still 
> > did not get the solution.
> >  
> > I have directory structure like
> >  
> > 
> >     abc
> >      |
> >      |___________src
> >                            |
> >                            |_____xxx
> >                                         |
> >                                         |______yyy
> >                                                       |
> >                                                       |_____zzz
> >                                                                  |
> >  
> > |________aaa   -->  java files
> >                                                                  |
> >  
> > |________bbb   -->  java files
> >                                                                  |
> >  
> > |________ccc   --> java files
> >  
> > 
> > Now i want to compile sources in all the packages xxx.yyy.zzz.aaa, 
> > xxx.yyy.zzz.bbb  and  xxx.yyy.zzz.ccc.
> >  
> > 
> > Tries......
> >  
> > 1)  Having only one POM in abc directory and packaging as jar.....
> >  
> > <project>
> >  :
> >  :
> > <modelVersion>4.0.0</modelVersion>
> > 
> > <groupId>xxx.yyy.zzz</groupId>
> > 
> > <artifactId>abc</artifactId>
> > 
> > <packaging>jar</packaging>
> > 
> >  :
> > 
> > </project>
> > 
> >  Note: I did not mention sub packages aaa, bbb and ccc as modules in
> the
> > pom.   
> >  
> > Output : no sources to compile
> >  
> > 
> > 2) Having Parent pom in abc and having separate poms in each and every
> 
> > package aaa,bb and ccc
> >  
> > parent pom:  mentioned packaging as pom, also mentioned modules
> >  
> > <project>
> >  :
> >  :
> > <modelVersion>4.0.0</modelVersion>
> > 
> > <groupId>xxx.yyy.zzz</groupId>
> > 
> > <artifactId>abc</artifactId>
> > 
> > <packaging>pom</packaging>
> > 
> >  :
> > 
> > <modules>
> > 
> > <module>xxx.yyy.zzz.aaa</module>
> > 
> > <module>xxx.yyy.zzz.bbb</module>
> > 
> > <module>xxx.yyy.zzz.ccc</module>
> > 
> > </modules>
> > 
> > </project>
> > 
> >  
> > Now i have child poms like
> >  
> > :
> > :
> > <parent>
> > 
> > <groupId>xxx.yyy.zzz</groupId>
> > 
> > <artifactId>abc</artifactId>
> > 
> > </parent>
> > 
> > <modelVersion>4.0.0</modelVersion>
> > 
> > <groupId>xxx.yyy.zzz.aaa</groupId>
> > 
> > <artifactId>aaa</artifactId>
> > 
> > <packaging>jar</packaging>
> > 
> > <name>aaa package</name>
> > 
> > :
> > 
> > : 
> > 
> >  
> > 
> > Output :  
> >  
> > 
> > [INFO] Scanning for projects...
> > [INFO]
> > ----------------------------------------------------------------------
> > --
> > [ERROR] FATAL ERROR
> > [INFO]
> > ----------------------------------------------------------------------
> > -- [INFO] Error building POM (may not be this project's POM).
> >  
> > 
> > Project ID: unknown
> >  
> > Reason: Could not find the model file 'C:\Documents and 
> > Settings\bpra\Desktop\SampleRCP\abc\xxx.yyy.zzz.
> > .aaa\pom.xml'.
> >  
> > 
> > Do I need to have pom in each of the packages aaa, bbb and ccc?
> > what is the problem?
> >  
> > Can anyone please help me out?
> >  
> > 
> > 
> > Thanks you
> > 
> > Ramesh
> > 
> > 
> > 
> > DISCLAIMER:
> > ----------------------------------------------------------------------
> > -------------------------------------------------
> > 
> > The contents of this e-mail and any attachment(s) are confidential and
> intended for the named recipient(s) only.
> > It shall not attach any liability on the originator or HCL or its 
> > affiliates. Any views or opinions presented in this email are solely
> those of the author and may not necessarily reflect the opinions of HCL
> or its affiliates.
> > Any form of reproduction, dissemination, copying, disclosure, 
> > modification, distribution and / or publication of this message 
> > without the prior written consent of the author of this e-mail is 
> > strictly prohibited. If you have received this email in error please
> delete it and notify the sender immediately. Before opening any mail and
> attachments please check them for viruses and defect.
> > 
> > ----------------------------------------------------------------------
> > -------------------------------------------------
> 
> 
> ---------------------------------------------------------------------
> 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: Problem in packaging multiple directories

Posted by "Ramesh Babu Pokala - TLS, Chennai" <PR...@hcl.in>.
 
Thanks for your response.
I am following the following structure as u mentioned

 my-app
  |-- pom.xml
  `-- src
       -- main
         `-- java
            `-- package1
                 `-- package2
                     `-- package3
                     |   `-- App.java
                     `-- package4
                         `-- MyClass.java
     

Then what should be my parent POM.xml? 
How many poms I need. Do I need poms for package3 as well as package4
along with main pom?
 `

Thanks & Regards 
Ramesh Babu.P 
  
-----Original Message-----
From: Tim Kettler [mailto:tim.kettler@udo.edu] 
Sent: Saturday, April 21, 2007 11:42 PM
To: Maven Users List
Subject: Re: Problem in packaging multiple directories

Hi,

I. Maven Directory Layout

If you follow the 'Getting Started Guide' you should have a directory
structure like the one below:

  my-app
  |-- pom.xml
  `-- src
      |-- main
      |   `-- java
      |       `-- package1
      |           `-- package2
      |               `-- package3
      |               |   `-- App.java
      |               `-- package4
      |                   `-- MyClass.java
      `-- test
          `-- java
              `-- packakag1
                  `-- package2
                      `-- package3
                          `-- AppTest.java

This is the default layout maven expects. If you are not converting from
a legacy project and absolutely need a different directory layout you
should stick to this default. That will save you from much hassle.

If you really can't follow that proposed structure, you have to override
the maven default values in the pom (see [1], [2] and [3] for a complete
description of the pom).

For example, to override the default source directory you would have
something like this in your pom:

  <project>
    ...
    <build>
 
<sourceDirectory>my/non/standard/source/directory</sourceDirectory>
      ...
    </build>
    ...
  </project>


II. Multiple Source Directories Per Project

Maven has a one-set-of-sources-per-project philosophy so if you really
need multiple source directories you are somewhat working against the
spirit of maven. Instead you should organize your project in multiple
modules (see below) and make them depend on each other.

If you really need to have more than one set of sources in a single
project you can attach an additional source directory using the
build-helper-maven-plugin [4].


III. Multi-Module Projects

Multi-Module projects are a set of maven projects (logical!!, not
necessarily physical on disk) organized as a tree. The nodes in the
logical tree are projects with a packaging of type pom with the leaves
of the tree containing the projects where you actual build your
artifacts (jar, war, ...).

A typical layout could look like this:

  my-app
  |-- pom.xml
  |-- subproject1
  |   |-- pom.xml
  |   `-- src
  |       `-- main
  |           `-- java
  |               `-- package1
  |                   `-- package2
  |                       `-- package3
  |                           `-- App.java
  `-- subproject1
      |-- pom.xml
      `-- src
          `-- main
              `-- java
                  `-- package1
                      `-- package2
                          `-- UtilityClass.java

The content of the poms would then look like this:

my-app/pom.xml:

  <project>
    <groupId>com.mycompany.app</groupId>
    <version>1.0-SNAPSHOT</version>
    <artifactId>app</artifactId>

    <packaging>pom</packaging>

    <modules>
      <module>subproject1</module>
      <module>subproject2</module>
    </modules>
  </project>

subproject1/pom.xml:

  <project>
    <groupId>com.mycompany.app</groupId>
    <artifactId>subproject1</artifactId>
    <version>1.0-SNAPSHOT</version>

    <packaging>jar</packaging>

    <dependencies>
      <dependency>
        <groupId>com.mycompany.app</groupId>
        <artifactId>subproject1</artifactId>
        <version>1.0-SNAPSHOT</version>
      </dependency>
    </dependencies>
  </project>

subproject2/pom.xml:

  <project>
    <groupId>com.mycompany.app</groupId>
    <artifactId>subproject2</artifactId>
    <version>1.0-SNAPSHOT</version>

    <packaging>jar</packaging>
  </project>



Hope this gets you started
-Tim

[1]
http://maven.apache.org/guides/introduction/introduction-to-the-pom.html
[2] http://maven.apache.org/pom.html
[3] http://maven.apache.org/ref/current/maven-model/maven.html
[4] http://mojo.codehaus.org/build-helper-maven-plugin/howto.html



Am Samstag, den 21.04.2007, 20:42 +0530 schrieb Ramesh Babu Pokala -
TLS, Chennai:
> Hi,
> I was unable to compile multi directory project... I tried in 
> different ways (follwed from maven - getting started site) but still 
> did not get the solution.
>  
> I have directory structure like
>  
> 
>     abc
>      |
>      |___________src
>                            |
>                            |_____xxx
>                                         |
>                                         |______yyy
>                                                       |
>                                                       |_____zzz
>                                                                  |
>  
> |________aaa   -->  java files
>                                                                  |
>  
> |________bbb   -->  java files
>                                                                  |
>  
> |________ccc   --> java files
>  
> 
> Now i want to compile sources in all the packages xxx.yyy.zzz.aaa, 
> xxx.yyy.zzz.bbb  and  xxx.yyy.zzz.ccc.
>  
> 
> Tries......
>  
> 1)  Having only one POM in abc directory and packaging as jar.....
>  
> <project>
>  :
>  :
> <modelVersion>4.0.0</modelVersion>
> 
> <groupId>xxx.yyy.zzz</groupId>
> 
> <artifactId>abc</artifactId>
> 
> <packaging>jar</packaging>
> 
>  :
> 
> </project>
> 
>  Note: I did not mention sub packages aaa, bbb and ccc as modules in
the
> pom.   
>  
> Output : no sources to compile
>  
> 
> 2) Having Parent pom in abc and having separate poms in each and every

> package aaa,bb and ccc
>  
> parent pom:  mentioned packaging as pom, also mentioned modules
>  
> <project>
>  :
>  :
> <modelVersion>4.0.0</modelVersion>
> 
> <groupId>xxx.yyy.zzz</groupId>
> 
> <artifactId>abc</artifactId>
> 
> <packaging>pom</packaging>
> 
>  :
> 
> <modules>
> 
> <module>xxx.yyy.zzz.aaa</module>
> 
> <module>xxx.yyy.zzz.bbb</module>
> 
> <module>xxx.yyy.zzz.ccc</module>
> 
> </modules>
> 
> </project>
> 
>  
> Now i have child poms like
>  
> :
> :
> <parent>
> 
> <groupId>xxx.yyy.zzz</groupId>
> 
> <artifactId>abc</artifactId>
> 
> </parent>
> 
> <modelVersion>4.0.0</modelVersion>
> 
> <groupId>xxx.yyy.zzz.aaa</groupId>
> 
> <artifactId>aaa</artifactId>
> 
> <packaging>jar</packaging>
> 
> <name>aaa package</name>
> 
> :
> 
> : 
> 
>  
> 
> Output :  
>  
> 
> [INFO] Scanning for projects...
> [INFO]
> ----------------------------------------------------------------------
> --
> [ERROR] FATAL ERROR
> [INFO]
> ----------------------------------------------------------------------
> -- [INFO] Error building POM (may not be this project's POM).
>  
> 
> Project ID: unknown
>  
> Reason: Could not find the model file 'C:\Documents and 
> Settings\bpra\Desktop\SampleRCP\abc\xxx.yyy.zzz.
> .aaa\pom.xml'.
>  
> 
> Do I need to have pom in each of the packages aaa, bbb and ccc?
> what is the problem?
>  
> Can anyone please help me out?
>  
> 
> 
> Thanks you
> 
> Ramesh
> 
> 
> 
> DISCLAIMER:
> ----------------------------------------------------------------------
> -------------------------------------------------
> 
> The contents of this e-mail and any attachment(s) are confidential and
intended for the named recipient(s) only.
> It shall not attach any liability on the originator or HCL or its 
> affiliates. Any views or opinions presented in this email are solely
those of the author and may not necessarily reflect the opinions of HCL
or its affiliates.
> Any form of reproduction, dissemination, copying, disclosure, 
> modification, distribution and / or publication of this message 
> without the prior written consent of the author of this e-mail is 
> strictly prohibited. If you have received this email in error please
delete it and notify the sender immediately. Before opening any mail and
attachments please check them for viruses and defect.
> 
> ----------------------------------------------------------------------
> -------------------------------------------------


---------------------------------------------------------------------
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: Problem in packaging multiple directories

Posted by Tim Kettler <ti...@udo.edu>.
Hi,

I. Maven Directory Layout

If you follow the 'Getting Started Guide' you should have a directory
structure like the one below:

  my-app
  |-- pom.xml
  `-- src
      |-- main
      |   `-- java
      |       `-- package1
      |           `-- package2
      |               `-- package3
      |               |   `-- App.java
      |               `-- package4
      |                   `-- MyClass.java
      `-- test
          `-- java
              `-- packakag1
                  `-- package2
                      `-- package3
                          `-- AppTest.java

This is the default layout maven expects. If you are not converting from
a legacy project and absolutely need a different directory layout you
should stick to this default. That will save you from much hassle.

If you really can't follow that proposed structure, you have to override
the maven default values in the pom (see [1], [2] and [3] for a complete
description of the pom).

For example, to override the default source directory you would have
something like this in your pom:

  <project>
    ...
    <build>
      <sourceDirectory>my/non/standard/source/directory</sourceDirectory>
      ...
    </build>
    ...
  </project>


II. Multiple Source Directories Per Project

Maven has a one-set-of-sources-per-project philosophy so if you really
need multiple source directories you are somewhat working against the
spirit of maven. Instead you should organize your project in multiple
modules (see below) and make them depend on each other.

If you really need to have more than one set of sources in a single
project you can attach an additional source directory using the
build-helper-maven-plugin [4].


III. Multi-Module Projects

Multi-Module projects are a set of maven projects (logical!!, not
necessarily physical on disk) organized as a tree. The nodes in the
logical tree are projects with a packaging of type pom with the leaves
of the tree containing the projects where you actual build your
artifacts (jar, war, ...).

A typical layout could look like this:

  my-app
  |-- pom.xml
  |-- subproject1
  |   |-- pom.xml
  |   `-- src
  |       `-- main
  |           `-- java
  |               `-- package1
  |                   `-- package2
  |                       `-- package3
  |                           `-- App.java
  `-- subproject1
      |-- pom.xml
      `-- src
          `-- main
              `-- java
                  `-- package1
                      `-- package2
                          `-- UtilityClass.java

The content of the poms would then look like this:

my-app/pom.xml:

  <project>
    <groupId>com.mycompany.app</groupId>
    <version>1.0-SNAPSHOT</version>
    <artifactId>app</artifactId>

    <packaging>pom</packaging>

    <modules>
      <module>subproject1</module>
      <module>subproject2</module>
    </modules>
  </project>

subproject1/pom.xml:

  <project>
    <groupId>com.mycompany.app</groupId>
    <artifactId>subproject1</artifactId>
    <version>1.0-SNAPSHOT</version>

    <packaging>jar</packaging>

    <dependencies>
      <dependency>
        <groupId>com.mycompany.app</groupId>
        <artifactId>subproject1</artifactId>
        <version>1.0-SNAPSHOT</version>
      </dependency>
    </dependencies>
  </project>

subproject2/pom.xml:

  <project>
    <groupId>com.mycompany.app</groupId>
    <artifactId>subproject2</artifactId>
    <version>1.0-SNAPSHOT</version>

    <packaging>jar</packaging>
  </project>



Hope this gets you started
-Tim

[1]
http://maven.apache.org/guides/introduction/introduction-to-the-pom.html
[2] http://maven.apache.org/pom.html
[3] http://maven.apache.org/ref/current/maven-model/maven.html
[4] http://mojo.codehaus.org/build-helper-maven-plugin/howto.html



Am Samstag, den 21.04.2007, 20:42 +0530 schrieb Ramesh Babu Pokala -
TLS, Chennai:
> Hi,
> I was unable to compile multi directory project... I tried in different
> ways (follwed from maven - getting started site) but still did not get
> the solution. 
>  
> I have directory structure like
>  
> 
>     abc
>      |
>      |___________src
>                            |
>                            |_____xxx
>                                         |
>                                         |______yyy
>                                                       |
>                                                       |_____zzz
>                                                                  |
>  
> |________aaa   -->  java files
>                                                                  |
>  
> |________bbb   -->  java files
>                                                                  |
>  
> |________ccc   --> java files
>  
> 
> Now i want to compile sources in all the packages xxx.yyy.zzz.aaa,
> xxx.yyy.zzz.bbb  and  xxx.yyy.zzz.ccc.
>  
> 
> Tries......
>  
> 1)  Having only one POM in abc directory and packaging as jar.....
>  
> <project>
>  :
>  :
> <modelVersion>4.0.0</modelVersion> 
> 
> <groupId>xxx.yyy.zzz</groupId> 
> 
> <artifactId>abc</artifactId> 
> 
> <packaging>jar</packaging> 
> 
>  :
> 
> </project>
> 
>  Note: I did not mention sub packages aaa, bbb and ccc as modules in the
> pom.   
>  
> Output : no sources to compile  
>  
> 
> 2) Having Parent pom in abc and having separate poms in each and every
> package aaa,bb and ccc
>  
> parent pom:  mentioned packaging as pom, also mentioned modules
>  
> <project>
>  :
>  :
> <modelVersion>4.0.0</modelVersion> 
> 
> <groupId>xxx.yyy.zzz</groupId> 
> 
> <artifactId>abc</artifactId> 
> 
> <packaging>pom</packaging> 
> 
>  :
> 
> <modules> 
> 
> <module>xxx.yyy.zzz.aaa</module> 
> 
> <module>xxx.yyy.zzz.bbb</module> 
> 
> <module>xxx.yyy.zzz.ccc</module>
> 
> </modules>
> 
> </project>
> 
>  
> Now i have child poms like
>  
> :
> :
> <parent> 
> 
> <groupId>xxx.yyy.zzz</groupId> 
> 
> <artifactId>abc</artifactId> 
> 
> </parent> 
> 
> <modelVersion>4.0.0</modelVersion> 
> 
> <groupId>xxx.yyy.zzz.aaa</groupId> 
> 
> <artifactId>aaa</artifactId> 
> 
> <packaging>jar</packaging> 
> 
> <name>aaa package</name> 
> 
> :
> 
> : 
> 
>  
> 
> Output :  
>  
> 
> [INFO] Scanning for projects...
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] FATAL ERROR
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Error building POM (may not be this project's POM).
>  
> 
> Project ID: unknown
>  
> Reason: Could not find the model file 'C:\Documents and
> Settings\bpra\Desktop\SampleRCP\abc\xxx.yyy.zzz.
> .aaa\pom.xml'.
>  
> 
> Do I need to have pom in each of the packages aaa, bbb and ccc?
> what is the problem?
>  
> Can anyone please help me out?
>  
> 
> 
> Thanks you 
> 
> Ramesh
> 
> 
> 
> DISCLAIMER:
> -----------------------------------------------------------------------------------------------------------------------
> 
> The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
> It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in 
> this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates.
> Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of 
> this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have
> received this email in error please delete it and notify the sender immediately. Before opening any mail and 
> attachments please check them for viruses and defect.
> 
> -----------------------------------------------------------------------------------------------------------------------


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