The first way: Package the dependencies into a jar package.
<Build> <Plugins> <plugin> <Artifactid>Maven-compiler-plugin</Artifactid> <Configuration> <Source>1.7</Source> <Target>1.7</Target> <encoding>${project.build.sourceencoding}</encoding> </Configuration> </plugin> <plugin> <Artifactid>Maven-assembly-plugin</Artifactid> <Configuration> <Descriptorrefs> <Descriptorref>Jar-with-dependencies</Descriptorref> </Descriptorrefs> <Archive> <Manifest> <MainClass>Com.xx.kafka.GWProducer</MainClass> </Manifest> </Archive> </Configuration> <executions> <Execution> <ID>make-assembly</ID> <!--This was used for inheritance merges - <Phase>Package</Phase> <!--bind to the packaging phase - <Goals> <goal>Single</goal> </Goals> </Execution> </executions> </plugin> </Plugins> </Build>
The second way: separate the dependent packages into the Lib folder
MAVEN Packaging in Eclipse