java - Maven: Running created Jar-File with depedencies -
this question has answer here:
i've written little java command line tool, want run (for example)
java -jar myjarfile.jar de.my.path.mainclass arg0 arg1 arg2
for building jar-file , managing depedencies using maven. found out, maven not include depedencies of pom-file in jar-file. so, when run jar-file, classnotfoundexceptions.. execute jar-file need libraries in classpath.
how can manage maven?
thank help!!
put maven assembly plugin in pom.xml:
<plugin> <artifactid>maven-assembly-plugin</artifactid> <executions> <execution> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> <configuration> <descriptorrefs> <descriptorref>jar-with-dependencies</descriptorref> </descriptorrefs> <archive> <manifest> <addclasspath>true</addclasspath> <mainclass>de.my.path.mainclass</mainclass> </manifest> </archive> </configuration> </plugin>
Comments
Post a Comment