Reputation: 39
I have two queries:
1) I have build a maven project and when I am tying to deploy jar on server it shows some error related to driver not found. Then I decompiled my jar and found that dependent database jar jconn jar is not in that. But I have that jar in my code and I am using following in my pom.xml to get that dependent jar with my jar but still it is not able to get dependent jar. Somewhere, I read on stackoverflow to add following to my pom.xml
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>./</classpathPrefix>
<mainClass>com.launcher.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
Still it is giving the same thing and jconn jar was not in jar when decompiled. Please help.
2) I have some some key value pair in a property file and values are in comma separated form. I want to take all values of that key in a list. how can i do that. Please help
Upvotes: 1
Views: 66
Reputation: 2293
To include other jars to your own ( it's called uber jar) you could use maven shade plugin
Example from their doc:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
It will create two jars. Original one with only yours content and uber with all other jars. It's possible to filter content, that will be included. For more examples please check:
https://maven.apache.org/plugins/maven-shade-plugin/
https://maven.apache.org/plugins/maven-shade-plugin/examples/includes-excludes.html
Upvotes: 1