Maven-camel build issue

I have a simple app using netbeans for development and maven for building and that's it. My application is using camel, spring XML. I wanted to create an executable jar with dependencies, so I am using the maven-assembly plugin with jar-with-deps descriptor. The Jar is built ok, but I think that since all dependencies are unpacked and some of them have the same resources in the same paths as others, they overwrite each other. I verified this by browsing the jar with winrar and I found multiple occurrences of the same file in many places. I think this is not resolvable with some simple maven configuration because I cannot stop a dependency requiring a resource in a specific path that is also being used by another dependency. BTW the app works fine inside netbeans.Also I have seen several phenomena of my application classes. It's weirder, but I can't figure out why.

In general, I want to know if:

  • Is there any simple solution that finds such conflicts and at least reports them if not fixes them? (And How)

  • Can I tell the archiver (in maven) not to deploy the depot, but just include the jars in the parent jar and then just include the jars in the manifest class path and how? Will this solve the problem or will it have the same result?

  • Why are there also multiple occurrences of my application classes in the same path?

To give you a picture of the problem, the current summary bar when viewed with WinRAR has 3 instances of "log4j.properties" in the root path and 7 instances of "spring.schemas" in meta-info / path, to name a few.

0


source to share


1 answer


I don't think it is possible to .zip all .jars into one .jar. Many of these .jars have resources in the .jar file (log4j.properties, spring XML files) that are in the same folder, so a collision will occur.



Better to provide start scripts that can launch your application by setting the classpath. And I remember either in JDK1.5 or this 1.6, you can set the folder as a classpath and it will include all the jars from that folder.

+1


source







All Articles