Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bundling different java classes in a single jar files in a single jar

Tags:

basically what I have is an application server running liferay portal. and we also have custom portlets that have shared custom libraries as well as third party ones. for instance dwr-3.0, several drools jar files, spring-webmvc, spring, etc.

the problem is that is a nightmare for server administration, because when there is a deploy somebody always forgets what version was in the server etc.

We use maven 2, and what I was thinking is to do something like a maven project that pulls the dependencies (using dependencyManagement) from the parent pom and the default goal is something like "unjar all the dependencies and jar them in a unique jar". that way we would have a unique jar with a standard version that is deployed along with the rest of the files instead of having to deploy.

Do you guys know how can I do that if it is at all possible? I have been playing around with maven-assembly-plugin without much success. If assembly is the way to go, do you have an example to give me a kickstart?

Thanks in advance

like image 877
feniix Avatar asked Jan 26 '10 23:01

feniix


1 Answers

Another alternative is the maven-shade-plugin or even jarjar. I've used both, together with package renaming without any problems.

like image 134
gpampara Avatar answered Oct 11 '22 16:10

gpampara