maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Anderson <benander...@benanderson.us>
Subject Re: Build setup for multiple "small projects" that are related
Date Thu, 21 Oct 2004 18:28:06 GMT
Irv,
It doesn't sound like your directory structures need to change.  I would suggest
keeping the same one you have, then you can use maven's inheritance:

src
  project.xml
  common
    project.xml
    java
    xml
    conf
  web-services
    project.xml
    java
    xml
    conf
  xml-util
    project.xml
    java
    xml
    conf

In your top level project.xml you can define your common structure:
<project>
  ...
  <build>
    <sourceDirectory>java</sourceDirectory>
    <resources>
      <resource>
        <directory>xml</directory>
        <includes>
          <include>*.xml</include>
        </includes>
      </resource>
      <resource>
        <directory>conf</directory>
        <includes>
          <include>*.properties</include>
        </includes>
      </resource>
    </resources>
  </build>
  ...
</project>

then in your subdirectories
<project>
  <extend>../project.xml</extend>
  ...
</project>


> Also, in the web-services and xml-util projects, would I then list the
> common project as a dependency?
If you're creating a war or ear, or some other aggregate artifact, then you will
need to specify the artifacts you want to include.  For instance:
    <dependency>
      <groupId>dotech</groupId>
      <artifactId>common</artifactId>
      <version>1.0</version>
      <properties>
        <war.bundle>true</war.bundle>
      </properties>
    </dependency>

If, however, you are building a component jar, then you only need to specify the
dependency if it needs to be in your classpath during compile time.  So, it
seems like you will in your case.  Note: Make sure that you "install" the
dependency in your local repo ("maven jar:install") before you try to access
it.

> So, I'd have build/web-services where the common source would be built
> with the web-services src.  (With nested <src> tags under javac)
I think the thing you want to focus on is what artifacts you wish to create.
Maven has had some controversy about whether to allow multiple source
directories in the same project.  The general understanding is that you should
not do this, but you can if you want:
http://maven.apache.org/faq.html#multiple-source-directories

In most cases in makes more sense to keep the jars separate.  So, your
web-services and xml-util jars would not contain the class files that are in
the common jar.

HTH,
Ben



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


Mime
View raw message