What is the maven-shade-plugin used for, and why would you want to relocate Java packages?

Uber JAR, in short, is a JAR containing everything. Normally in Maven, we rely on dependency management. An artifact contains only the classes/resources of itself. Maven will be responsible to find out all artifacts (JARs etc) that the project depending on when the project is built. An uber-jar is something that takes all dependencies, and … Read more

SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”. error

I can also confirm this error. Workaround: is to use external maven inside m2eclipse, instead of it’s embedded maven. That is done in three steps: 1 Install maven on local machine (the test-machine was Ubuntu 10.10) mvn –version Apache Maven 2.2.1 (rdebian-4) Java version: 1.6.0_20 Java home: /usr/lib/jvm/java-6-openjdk/jre Default locale: de_DE, platform encoding: UTF-8 OS … Read more

NoClassDefFoundError on Maven dependency

By default, Maven doesn’t bundle dependencies in the JAR file it builds, and you’re not providing them on the classpath when you’re trying to execute your JAR file at the command-line. This is why the Java VM can’t find the library class files when trying to execute your code. You could manually specify the libraries … Read more

Maven project version inheritance – do I have to specify the parent version?

Since Maven 3.5.0 you can use the ${revision} placeholder for that. The use is documented here: Maven CI Friendly Versions. In short the parent pom looks like this (quoted from the Apache documentation): <project> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.apache</groupId> <artifactId>apache</artifactId> <version>18</version> </parent> <groupId>org.apache.maven.ci</groupId> <artifactId>ci-parent</artifactId> <name>First CI Friendly</name> <version>${revision}</version> … <properties> <revision>1.0.0-SNAPSHOT</revision> </properties> <modules> <module>child1</module> .. </modules> </project> … Read more

Maven – Always download sources and javadocs

Open your settings.xml file ~/.m2/settings.xml (create it if it doesn’t exist). Add a section with the properties added. Then make sure the activeProfiles includes the new profile. <settings> <!– … other settings here … –> <profiles> <profile> <id>downloadSources</id> <properties> <downloadSources>true</downloadSources> <downloadJavadocs>true</downloadJavadocs> </properties> </profile> </profiles> <activeProfiles> <activeProfile>downloadSources</activeProfile> </activeProfiles> </settings>