0

I have this java project handled by Ant modules (subant.xml)

-src
¦
+---com
¦       ¦   +---SomePackage1
¦       ¦   +---SomePackage2
¦       ¦   +---OtherPackage
¦       +---businessPackage
¦       ¦   +---business
¦       ¦   ¦   +---ejb1
¦       ¦   ¦   ¦   +---managers
¦       ¦   ¦   ¦   +---session
¦       ¦   ¦   +---exceptions
¦       ¦   ¦   +---utils
¦       ¦   +---gateway
¦       ¦       +---ejb
¦       ¦       +---managers
¦       +---MyPackage
¦       ¦   +---database
¦       ¦   ¦   +---ejb
¦       ¦   ¦   +---exceptions
¦       ¦   ¦   +---model
¦       ¦   ¦   +---utils
¦       ¦   +---ejb
¦       ¦   ¦   +---configuration
¦       ¦   +---global
¦       ¦       +---config
¦       ¦       ¦   +---exceptions
¦       ¦       +---utils
¦       ¦       +---xml
¦       ¦           +---exceptions
¦       ¦           +---utils
¦       +---utils
+---CMEjbModule
¦   +---META-INF->subant.xml, ejb-jar.xml (tag <ejbjar>)
+---OtherEjbModule
¦   +---META-INF->subant.xml, ejb-jar.xml (tag <ejbjar>)
+---FrontOfficeEjbModule
¦   +---META-INF->subant.xml, ejb-jar.xml (tag <ejbjar>)
+---BackOfficeEjbModule
¦   +---META-INF->subant.xml, ejb-jar.xml (tag <ejbjar>)
+---MyJarModule
¦   +---META-INF->subant.xml, (tag <jar>)
+---MyJar2Module
¦   +---META-INF->subant.xml, (tag <jar>)
build.xml

Each subant.xml contains <ejbjar> for EJB (it's creates a JAR module) and <jar> for JAR archives. The <ejbjar> source is like that:

<ejbjar  
    basejarname="CMEjbModule"
    destdir=<dir.to.copyJar>
    flatdestdir="true"
    genericjarsuffix=".jar"
    srcdir=<directory classes>
        descriptordir=<ejb descriptor dir>  
    dependency="full">
    <jboss/>            
    <include name="**/ejb-jar.xml"/>
    <include name="**/jboss-deployment-structure.xml"/>
    <dtd publicId="-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 3.0//EN" location="${jboss.home}/docs/dtd/ejb-jar_3_0.dtd" />
</ejbjar>

The other module are simply JAR archives created by <jar> ant tag.

The result after build.xml is six components, i.e. six JARs, one for any module directory: CMEjbModule.jar, OtherEjbModule.jar, FrontOfficeEjbModule.jar, BackOfficeEjbModule.jar, MyJarModule.jar, MyJar2Module.jar (the first four JARs contain stateless EJBs as described in their own ejb-jar.xml)

Now, I would like to update this project to a Maven (POM) project without ant-run plugin Maven. The problem is: the source java directory is unique and it's very difficult to split src into independent sub-project because there are many source classes shared by six modules.

Is it possible? For example, I prefer using the Maven <module> pattern like subant.xml without ejb-jar.xml because the EJB are 3.0, but I ignore how is possible, i.e., in each Maven module sub-project if it's possible to select some source directory to compile each module or some EJB Java source (and their dependencies) from Java project.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
  • Those shared classes into a separate module which is used a dependency by other modules... ? – khmarbaise Apr 14 '23 at 10:24
  • It's a possible alternative, but primary i would convert the ant project in Maven project with module but leaving source java as is – Frank Cherry Apr 14 '23 at 11:37
  • It's not an alternative that's the only way which will really work... otherwise you will hack the Maven setup which is a bad idea and it will become a nightmare to maintain...convention over configuration which means also separate things into common things etc. ... etc... yes that takes time... but that's the technical deps which has been accumulated over the times... now you are paying the real costs... also a good separated ant build would have been easier to maintain and could be eaiser migrated ... – khmarbaise Apr 14 '23 at 11:42

0 Answers0