Maven project with maven-shade-plugin doesn't deploy to SpringSource Server correctly

494 views Asked by At

We assemble a war file from several Maven based projects. One of the projects uses maven-shade-plugin to include additional library inside its target jar file. Let's call it x.jar for the sake of this discussion.

When maven builds the war file it contains the correct x.jar file with packaged additional library inside.

We use Spring Source of the latest version (3.4.0) to deploy it to the server configured in Spring Source. Server is Sprint TC Server 2.0.3.

As soon as the project gets deployed to the server (which is Sprint TC Server 2.0), the jar file (x.jar) somehow gets replaced with incorrect small one without packaged library inside.

This smaller x.jar doesn't exist anywhere in the file system before the deployment, so it looks like Spring Source compiles it on its own.

As a result we can't deploy our system in Spring Source. Do you, guys, the reason or a workaround for our problem?

----------- UPDATE -----------

We've conducted a test. We've broken maven pom.xml file before we deployed it and as a result Spring Source deployed the original files without recompiling it. It resulted in a correct deployment.

This test shows that Spring Source rebuilds jars silently upon deploying them to servers.

Is there a way to stop it or to make it work properly?

1

There are 1 answers

0
Nikola Yovchev On

My suggestion, unfortunately, is to not use the shade plugin, but rather a clever combination between assembly, dependency and jar plugins, kinda like the guy in the answer here:

Invalid or corrupt JAR File built by Maven shade plugin

If you have any trouble configuring it, let me know.

And if you have the error logs of the server, it would be nice to post them as well.