I have been experiencing similar problems and working them through with Rafa.
Mark, I think it was decided that the two artifacts to be used as dependencies would be module-api.jar and module-omod.jar, both required. Module.omod is solely for use by the module manager. I think you should consider whether it serves any purpose to maintain the -api, <unnamed> artifact naming scheme, such as the behavior of the mavenizer. I think that all three artifacts need to go in the openmrs maven repository. I think the module downloader ought to have a checkbox to download the -api and -omod as well as the .omod. From: [email protected] [mailto:[email protected]] On Behalf Of Ben Wolfe Sent: Tuesday, January 10, 2012 3:06 AM To: [email protected] Subject: Re: [OPENMRS-DEV] Including one mavenized module within another mavenized module I don't know when/you would use "pom" over "jar". I've always used jar. Perhaps Matt Blanchette can chime in on that? Rafal figured out the api vs omod unit test thing. He has modified the module archetype and the basicmodule to have the right separation. Ben On Tue, Jan 10, 2012 at 6:24 AM, Mark Goodrich <[email protected]<mailto:[email protected]>> wrote: Darius, yeah, I agree... When I deploy the module to the repo via mvn deploy, all three projects are added, as follows: addresshierarchy - with the pom addresshierarchy-api - with the pom and jar addresshierarchy-omod - with the pom and jar This seems correct to me. However, including the projects via type "pom" doesn't seem to work for me... if I try something like: <groupId>org.openmrs.module</groupId> <artifactId>addresshierarchy</artifactId> (or <artifactId>addresshierarchy-api</artifact>) <version>2.2.0</version> <type>pom</type> The build fails (and, prior to that, Eclipse doesn't see the address hierarchy packages on the build path). The only way I can include the module as a dependency is using <type>jar</type>... and since there is no jar in the parent project, I have to directly reference the api jar: <groupId>org.openmrs.module</groupId> <artifactId>addresshierarchy-api</artifactId> <version>2.2.0</version> <type>jar</type> I would assume that the <type>pom</type> should work... does anyone know why this doesn't? Has anyone gotten a pom include to work with another module? Mark ________________________________________ From: [email protected]<mailto:[email protected]> [[email protected]<mailto:[email protected]>] On Behalf Of Darius Jazayeri [[email protected]<mailto:djazayeri%[email protected]>] Sent: Monday, January 09, 2012 5:53 PM To: [email protected]<mailto:[email protected]> Subject: Re: [OPENMRS-DEV] Including one mavenized module within another mavenized module Offhand, I think that the correct behavior should be that you just need to require the api of the required module. (Also that things like hbm.xmls, and unit test classes should be in the api, rather the omod as they sometimes are...) That said, if you include the parent project, that ought to work as well... -Darius On Mon, Jan 9, 2012 at 2:23 PM, Mark Goodrich <[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>> wrote: It is really a matter of 1) determining what we want mvn deploy to deploy to the module repo and then 2) having someone who knows how to configure maven give a tutorial on how to upgrade the poms and/or configure the deploy plugin appropriately. To see an example of what a mvn deploy currently deploys, take a look at the three addresshierarchy directories below: http://mavenrepo.openmrs.org/nexus/content/repositories/releases/org/openmrs/module/ I don't think it is particularly bad for the api and omod to be broken out into different jars, is it? Really, if you are using one module from within another you only need to import the api anyway. We could keep the mvn deploy as-is--we'd just have to update the instructions for how to include another module to note that you have to declare a dependency to the module-name-api artifact instead of module-name. Take care, Mark From: [email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>> [mailto:[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>] On Behalf Of Burke Mamlin Sent: Monday, January 09, 2012 4:15 PM To: [email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>> Subject: Re: [OPENMRS-DEV] Including one mavenized module within another mavenized module Assuming the jar within the omod target only contains web classes as you say, then how about: * Rename Target/omod/moduleid-x.y.z.jar to Target/omod/moduleid-omod-x.y.z.jar (only contains web classes) * Create a Target/omod/moduleid-x.y.z.jar that contains both API + web classes (.omod would just be a copy with .omod extension) * mvn deploy would deploy the moduleid-x.y.z.jar containing API + web classes * (eventually) uploading an omod to the module repository would deploy to mvn as well if it hadn't already been done So, devs could either deploy an artifact via mvn deploy or just upload their omod to the module repository. -Burke On Mon, Jan 9, 2012 at 3:47 PM, Mark Goodrich <[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>> wrote: Yes... but I'm not exactly sure understand it/agree with it... I would assume that we would want to use mvn deploy to deploy the module-api and module-omod jars to maven repo. But, if I'm reading it right... we won't use mvn deploy to deploy modules to the maven repo. Instead we would simply run a mvn package and then create a ticket to add the module jar to maven repo. It is also unclear exactly what file we would use as the jar. Running a mvn package creates the following files: Target/api/addresshierarchy-api-2.2.0.jar (which only includes the api classes) Target/omod/addresshierarchy-2.2.0.jar (which appears to only include the omod classes) Target/omod/addresshierarchy-2.2.0.omod (which assumedly includes both the omod and api classes) If we want to reference a module just using <artifactId>module-name</artifactId> instead of <artifactId>module-name-api</artifactId> we would have to rename either addresshierarchy-api-2.2.0.jar or addresshierarchy-2.2.0.omod to addresshierarchy-2.2.0.jar. Mark From: [email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>> [mailto:[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>] On Behalf Of Ben Wolfe Sent: Monday, January 09, 2012 1:55 PM To: [email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>> Subject: Re: [OPENMRS-DEV] Including one mavenized module within another mavenized module Have you seen this page? https://wiki.openmrs.org/display/docs/Requiring+another+module+in+your+module Ben On Mon, Jan 9, 2012 at 9:33 PM, Mark Goodrich <[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>> wrote: Hello all- I'm having a little trouble referencing one mavenized module within another mavenized module and am looking for some feedback on what the preferred way to do this is via maven. I was able to deploy the address hierarchy module to the Openmrs maven repo via mvn deploy, and confirmed that the addresshierarchy poms and jars have been successfully added to the repo. Now I have a second module that uses a service provided by the Address Hierarchy module. I've tried linking address hierarchy as a pom dependency in the main pom and the api pom of the second module using both the following methods, but in all cases I get compile errors when building the second module because the relevant Address Hierarchy classes can't be found: <dependency> <groupId>org.openmrs.module</groupId> <artifactId>addresshierarchy</artifactId> <version>2.2.0</version> <type>pom</type> <scope>provided</scope> </dependency> <dependency> <groupId>org.openmrs.module</groupId> <artifactId>addresshierarchy-api</artifactId> <version>2.2.0</version> <type>pom</type> <scope>provided</scope> </dependency> The only way I can get it to build correctly is to reference the addresshierarchy-api jar directly: <dependency> <groupId>org.openmrs.module</groupId> <artifactId>addresshierarchy-api</artifactId> <version>2.2.0</version> <type>jar<type> <scope>provided</scope> </dependency> Is this what we want? Or is there some way to include via pom that I am missing? Thanks, Mark ________________________________ Click here to unsubscribe<mailto:[email protected]<mailto:[email protected]>?body=SIGNOFF%20openmrs-devel-l> from OpenMRS Developers' mailing list ________________________________ Click here to unsubscribe<mailto:[email protected]<mailto:[email protected]>?body=SIGNOFF%20openmrs-devel-l> from OpenMRS Developers' mailing list ________________________________ Click here to unsubscribe<mailto:[email protected]<mailto:[email protected]>?body=SIGNOFF%20openmrs-devel-l> from OpenMRS Developers' mailing list ________________________________ Click here to unsubscribe<mailto:[email protected]<mailto:[email protected]>?body=SIGNOFF%20openmrs-devel-l> from OpenMRS Developers' mailing list ________________________________ Click here to unsubscribe<mailto:[email protected]<mailto:[email protected]>?body=SIGNOFF%20openmrs-devel-l> from OpenMRS Developers' mailing list _________________________________________ To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to [email protected]<mailto:[email protected]> with "SIGNOFF openmrs-devel-l" in the body (not the subject) of your e-mail. [mailto:[email protected]<mailto:[email protected]>?body=SIGNOFF%20openmrs-devel-l] ________________________________ Click here to unsubscribe<mailto:[email protected]?body=SIGNOFF%20openmrs-devel-l> from OpenMRS Developers' mailing list _________________________________________ To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to [email protected] with "SIGNOFF openmrs-devel-l" in the body (not the subject) of your e-mail. [mailto:[email protected]?body=SIGNOFF%20openmrs-devel-l]

