1

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

1
  • You want the shade plugin, not the assembly plugin Commented Nov 13, 2017 at 2:21

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.