Uploading omod files to the module repo via maven?

1 view
Skip to first unread message

Darius Jazayeri

unread,
Jun 12, 2012, 10:36:24 PM6/12/12
to dev
Hi All,

I've finally got the combination of git + maven running quite smoothly to where I can pretty easily just do "mvn release:prepare" and "mvn release:perform" whenever I want to release a new module version.

That's wonderful, but the annoying bit is still having to manually upload the omod to modules.openmrs.org.

Does anyone know how much work it would be to write sume maven configuration or custom code so that when we do a "mvn release:perform" (or more likely a "mvn deploy") it uploads the omod to the module repository, in addition to putting the maven artifacts in nexus?

-Darius

Ben Wolfe

unread,
Jun 12, 2012, 10:40:39 PM6/12/12
to d...@openmrs.org
I'd rather we put something into the module repository that watches for tags and automatically builds and pulls in the omod.  Easier to write, and encourages good convention of making sure every released module has a tagged code version.

Ben

-- OpenMRS Developers: http://go.openmrs.org/dev
Post: d...@openmrs.org
Unsubscribe: dev+uns...@openmrs.org

Darius Jazayeri

unread,
Jun 12, 2012, 10:47:46 PM6/12/12
to d...@openmrs.org
The maven release plugin does enforce that convention.

If I do "mvn release:prepare" + "mvn release:perform", this:
  • runs all the unit tests
  • increments my version number to the next -SNAPSHOT version
  • tags the version I just released
  • commits it (though I still have to push to github)
  • deploys the poms, jars, and source jars to nexus
Also, it does this when I say so, and not whenever the repo-watching process might run.

Having the module repo checkout the code and build it feels a bit bit backwards to me...

-Darius

Michael Downey

unread,
Jun 12, 2012, 11:03:47 PM6/12/12
to d...@openmrs.org
Hi,


On Tue, Jun 12, 2012 at 10:47 PM, Darius Jazayeri <dar...@openmrs.org> wrote:
Having the module repo checkout the code and build it feels a bit bit backwards to me...

+1

The developer should have control of if and when modules are published, IMHO.

Michael

Ben Wolfe

unread,
Jun 13, 2012, 11:10:49 AM6/13/12
to d...@openmrs.org
Ok, I suppose there is a 1% use-case where someone tags their code but don't want a new module released. 

We could have the module repository watching the nexus repo.  If the omod is getting pushed up to nexus, it could just pull it over and host it there.

Ben

-- OpenMRS Developers: http://go.openmrs.org/dev
Post: d...@openmrs.org
Unsubscribe: dev+uns...@openmrs.org

Darius Jazayeri

unread,
Jun 13, 2012, 6:21:47 PM6/13/12
to d...@openmrs.org

I am fine with either approach as long as it's automatic.

You say adding this to the module report would be easy. Does anyone know if doing a custom post in deploy via maven (perhaps using antrun) is also easy?

-Darius (by phone)

Saptarshi Purkayastha

unread,
Jun 13, 2012, 8:08:07 PM6/13/12
to d...@openmrs.org
mvn deploy allows deployment over FTP (or even SSH) and uses wagon to deploy the built artifact.
Thus, if the module repository has a FTP account, it can be used to upload the artifact.

Although <distributionManagement> will allow only one repo, you can have multiple profiles and have these can have their own repo

---
Regards,
Saptarshi PURKAYASTHA

My Tech Blog:  http://sunnytalkstech.blogspot.com
You Live by CHOICE, Not by CHANCE

Ben Wolfe

unread,
Jun 14, 2012, 9:22:02 AM6/14/12
to d...@openmrs.org
That sounds promising!

So the tasks would be:
1) code up ftp upload ability to module repo
2) Add another profile section to your pom.xml
3) ?? Where to put the repo credentials?
4) ?? How to call it in maven when you want to release? (or can it hook into the release:prepare step?)

Ben

Darius Jazayeri

unread,
Jun 14, 2012, 9:26:42 PM6/14/12
to d...@openmrs.org
For (4) I think we just need to hook into the deploy stage. (But I don't know for sure.)

I would tend to prefer that we make this happen without needing to run twice in different profiles, even if that means using something like ant-run to upload the omod, instead of wagon as we're supposed to.

Though perhaps we can make it such that when you activate that profile it runs both the main distributionManagement section and the profile one. That would be fine.

-Darius

Rafal Korytkowski

unread,
Jun 17, 2012, 10:39:36 AM6/17/12
to d...@openmrs.org
Ben, the credentials can be put in profile/.m2/settings.xml (same as
for svn/git/maven repo) or be given as command line parameters.

-Rafał
Reply all
Reply to author
Forward
0 new messages