Maven Archetype

Possibility to create real multiple modules with Java sources

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Won't Fix
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: Plugin
  • Labels:
    None
  • Number of attachments :
    3

Description

I'm lacking the possibility to be able to generate a real multimodule application i.e. an ear containing both a web module and an ejb module with java sources.

I know it is possible to list all classes as a <resource>, however when doing so I can't get the packageName to automatically be prepended to the java files path (src/main/java/<package>/.../App.java).

What it means is that I'd like to be able to mark the java files as source files also when doing multiple modules generations.

  1. archetype.mdo
    01/Feb/06 1:37 PM
    3 kB
    John Didion
  2. DefaultArchetype.java
    01/Feb/06 1:37 PM
    24 kB
    John Didion
  3. MavenArchetypeMojo.java
    01/Feb/06 1:37 PM
    7 kB
    John Didion

Issue Links

Activity

Hide
Johannes Carlén added a comment -

Also somewhat related to this...

How about creating Java sources in different subpackages such as ${package}\model or ${package}\web ?

Show
Johannes Carlén added a comment - Also somewhat related to this... How about creating Java sources in different subpackages such as ${package}\model or ${package}\web ?
Hide
John Didion added a comment -

I've modified archetype-core and archetype-plugin to provide this functionality for our projects. I'll attache the code I modified to get this to work. Here's an example of a multi-module archetype.xml:

<?xml version="1.0"?>
<archetype xmlns="http://maven.apache.org/Archetype/1.0.0">
  <id>archetype-webservice</id>
  <modules>
    <module>
      <dir>api</dir>
      <sources>
        <source>src/main/java/readme.txt</source>
      </sources>
    </module>
    <module>
      <dir>impl</dir>
      <sources>
        <source>src/main/java/readme.txt</source>
      </sources>
      <resources>
        <resource>src/main/resources/readme.txt</resource>
        <resource>src/main/resources/META-INF/PropertyMetadata.xml</resource>
        <resource>src/main/sql/readme.txt</resource>
      </resources>
      <testSources>
        <testSource>src/test/java/readme.txt</testSource>
      </testSources>
      <testResources>
        <testResource>src/test/resources/readme.txt</testResource>
        <testResource>src/test/sql/readme.txt</testResource>
      </testResources>
      <siteResources>
        <siteResource>src/site/site.xml</siteResource>
        <siteResource>src/site/apt/index.apt</siteResource>
      </siteResources>
    </module>
    <module>
      <dir>client</dir>
    </module>
    <module>
      <dir>webapp</dir>
      <resources>
        <resource>src/main/resources/log4j.xml</resource>
        <resource>src/main/webapp/WEB-INF/web.xml</resource>
      </resources>
      <testSources>
        <testSource>src/test/java/readme.txt</testSource>
      </testSources>
    </module>
  </modules>
</archetype>
Show
John Didion added a comment - I've modified archetype-core and archetype-plugin to provide this functionality for our projects. I'll attache the code I modified to get this to work. Here's an example of a multi-module archetype.xml:
<?xml version="1.0"?>
<archetype xmlns="http://maven.apache.org/Archetype/1.0.0">
  <id>archetype-webservice</id>
  <modules>
    <module>
      <dir>api</dir>
      <sources>
        <source>src/main/java/readme.txt</source>
      </sources>
    </module>
    <module>
      <dir>impl</dir>
      <sources>
        <source>src/main/java/readme.txt</source>
      </sources>
      <resources>
        <resource>src/main/resources/readme.txt</resource>
        <resource>src/main/resources/META-INF/PropertyMetadata.xml</resource>
        <resource>src/main/sql/readme.txt</resource>
      </resources>
      <testSources>
        <testSource>src/test/java/readme.txt</testSource>
      </testSources>
      <testResources>
        <testResource>src/test/resources/readme.txt</testResource>
        <testResource>src/test/sql/readme.txt</testResource>
      </testResources>
      <siteResources>
        <siteResource>src/site/site.xml</siteResource>
        <siteResource>src/site/apt/index.apt</siteResource>
      </siteResources>
    </module>
    <module>
      <dir>client</dir>
    </module>
    <module>
      <dir>webapp</dir>
      <resources>
        <resource>src/main/resources/log4j.xml</resource>
        <resource>src/main/webapp/WEB-INF/web.xml</resource>
      </resources>
      <testSources>
        <testSource>src/test/java/readme.txt</testSource>
      </testSources>
    </module>
  </modules>
</archetype>
Hide
John Didion added a comment -

Files I modified to provide multi-module archetype functionality.

Show
John Didion added a comment - Files I modified to provide multi-module archetype functionality.
Hide
Brett Porter added a comment -

John, this looks like a good change (including using modello), but the attached files are only part of the picture, and the plugin has changed since 1 Feb. I don't have time to manually implement this for the 1.0-alpha-4 version, but I'm sure Jason will add similar functionality to the next version.

Show
Brett Porter added a comment - John, this looks like a good change (including using modello), but the attached files are only part of the picture, and the plugin has changed since 1 Feb. I don't have time to manually implement this for the 1.0-alpha-4 version, but I'm sure Jason will add similar functionality to the next version.
Hide
Casey Butterworth added a comment -

I see that ARCHETYPE-33 is said to supercede this issue, but I can't see whether it has been released as the new archetype plugin. Any idea when this might happen? I'd love to provide a multi module maven archetype for our projects and at this stage am unable to.

Show
Casey Butterworth added a comment - I see that ARCHETYPE-33 is said to supercede this issue, but I can't see whether it has been released as the new archetype plugin. Any idea when this might happen? I'd love to provide a multi module maven archetype for our projects and at this stage am unable to.
Hide
Raphaël Piéroni added a comment -

This issue will be fixed by NG-alpha-1

Show
Raphaël Piéroni added a comment - This issue will be fixed by NG-alpha-1
Hide
Jason van Zyl added a comment -

Addressed in ArchetypeNG.

Show
Jason van Zyl added a comment - Addressed in ArchetypeNG.

People

Vote (9)
Watch (10)

Dates

  • Created:
    Updated:
    Resolved: