maven - how to add my external jar file to class path -


i new maven environment, need ones help. added external jar file (directoryhelper.jar) in lib folder below in pom.xml

<dependency>       <groupid>com.test.directoryhelper</groupid>       <artifactid>directoryhelper</artifactid>       <version>1.0</version>       <scope>system</scope>       <systempath>${basedir}/lib/directoryhelper.jar</systempath>       </dependency> 

compilation successful, during run time getting java.lang.noclassdeffounderror.

how add directoryhelper.jar class path.

maven out of box come jar file (default packaging). jar file contains (main) artifacts of project. if take , run it, dependencies missing -- design.

typically maven artifacts reused in combination pom @ point of use it's know dependencies are. edit: if you're using apks , installing them on phone, there may mechanisms deal dependencies, i'm answering merely maven standpoint.

if want create jar with dependencies have tell maven so, that's not default. ways of having maven (probably not exhaustive):

  • maven assembly plugin, jar-with-dependencies predefined descriptor:

    <plugin>     <artifactid>maven-assembly-plugin</artifactid>     <version>2.4</version>     <configuration>         <descriptorrefs>             <descriptorref>jar-with-dependencies</descriptorref>         </descriptorrefs>     </configuration> ... 
  • maven shade plugin


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -