Michaelsoft
Michaelsoft

Reputation: 807

Create a maven project to be used as a jar library in another project

I want that a maven project can be used as a black box jar. This is needed because second project was born its way, and I don't want to integrate its code by hand. So the best way is that this project is going to save it's data on db, but it should use a service offered by the "wrapper" project to save them.

The idea is simple, the secondary project can expose just a method to which I will pass the service that offers the save method as a parameter.

The secondary project should not have configuration files, but should rely on the father application's properties.

Any idea to do this fast and almsot good? Thanks for any suggestion.

EDIT 2013/03/07: The idea behind this is that the second project should generate a classic jar library that looks a properties file into the classpath of the host project. Something like Quartz/Spring/... you import jar and you provide the properties file.

Upvotes: 0

Views: 333

Answers (1)

Michaelsoft
Michaelsoft

Reputation: 807

I just defined some classes to load properties from the classpath, and some interfaces to make the two projects interact.

In pom.xml of the parent project I imported the child project excluding it's dependencies to avoid conflicts.

It was a pretty easy task at the end.

Upvotes: 1

Related Questions