creating a maven sub module project

Hello all;

I would like to inquire how does one create a sub module project using the sdk or any other way ,i have been trying to create one for the provider management module depending on openmrs platform 2.0 with the sdk in eclipse but in vain. :slightly_frowning_face:

Thanks

@samuel34 @mksd @ssmusoke

1 Like
  1. A parent project is built from an aggregator POM that manages a group of submodules. In most cases, the aggregator is located in the project’s root directory and must have packaging of type pom . Now, the submodules are regular Maven projects, and they can be built separately or through the aggregator POM. just to be more clear.

    We can also create a parent module using this command mvn archetype:generate -DgroupId=org.openmrs -DartifactId=parent-project but for your case no need for this.

You will go into the parent pom.file and change packaging to pom. eg < packaging >pom</ packaging > . By setting packaging as pom, we are simply declaring that project to serve as a parent or an aggregator . inotherowords it wont produce other artifact ids. Now if your done, you can go ahead and create submodule using some command.However you should also take note that all configurations will be done and shared in child submodules by the use of dependency Management. From here go to the directory you have your project, cd parent-project

mvn archetype:generate -DgroupId=org.openmrs -DartifactId="submodule name"

mvn archetype:generate -DgroupId=org.openmrs -DartifactId="service"

mvn archetype:generate -DgroupId=org.openmrs -DartifactId=webapp.As suggested when you are creating a skeleton of a dynamic web maven module hope this will guide you some how some where. and we may also get other ideas cc @dkayiwa @mksd @ibacher @ssmusoke

thanks @sharif for the feedback :+1: ,looking into this

1 Like

@ibacher could be having an idea or reference on how this is done?

Thanks

this command generates the module though in this case the sub-module needs to be set up using the openmrs sdk archetype

Like you said any option, Again that command may not help you apparently because already the project is set, you may need to use another commands specified thanks

I don’t know of any way to do this easily. I usually just create the sub-module manually… I do think this would be a good feature to add to the SDK.

2 Likes

hello @ibacher i have been creating the sub-module manually,though am getting an error,i have googled around the error and the corrections point to properly defining the child pom artifact and also to declare the child in the modules element of the parent pom which i did but the problem still persists …

parent pom configurations

child pom configurations

what could i be missing in my pom definitions and configurations ? POM

Thanks

cc @mozzy @ssmusoke

@gcliff , Look at the submodule you created

its named
api<space>-2.0

yet in the parent Pom , you defined it as
api-2.0 (without space)

`Remove the space in the sub-module folder

thanks @mozzy for the tip :+1: ,hard not seen it

am able to build now

2 Likes