Search code examples
javamavenjarehcache

How can I build a single jar for ehcache?


Using echache 2.7.5, I tried

mvn -Dmaven.test.skip=true package

but it makes many jars:

./terracotta/bootstrap/target/ehcache-terracotta-bootstrap-2.7.5.jar
./management-ehcache/target/management-ehcache-2.7.5.jar
./ehcache-core/target/ehcache-core-2.7.5.jar
./ehcache-core/target/classes/net/sf/ehcache/pool/sizeof/sizeof-agent.jar
./ehcache-scheduled-refresh/target/ehcache-scheduled-refresh-2.7.5.jar
./ehcache/target/ehcache-2.7.5.jar
./management-ehcache-impl/ehcache-rest-agent/target/ehcache-rest-agent-2.7.5.jar
./management-ehcache-impl/ehcache-rest-agent/target/original-ehcache-rest-agent-2.7.5.jar
./management-ehcache-impl/management-ehcache-impl/target/management-ehcache-impl-2.7.5.jar

and

./ehcache/target/ehcache-2.7.5.jar

doesn't contain any class files.

How do I target a single jar?


Solution

  • The Ehcache build uses a profile to build its shaded jar. The profile is named fullmode and needs to be activated: -Pfullmode.

    The default is devmode which does not do the shading but instead produces pom files with proper transitive dependencies. The logic behind that is faster build times for devs who want to test changes of internal components and not have to rebuild the full jar each time.