How to configure Maven build for Java project with external dependencies?

build, jar, java, maven

Solution

I don't see here any problem. Just create maven pom.xml with `<packaging>jar</packaging>` By default it should not pack into your jar all dependent libraries.

<plugin>
  <artifactId>maven-dependency-plugin</artifactId>
  <executions>
    <execution>
      <phase>install</phase>
      <goals>
        <goal>copy-dependencies</goal>
      </goals>
      <configuration>
        <outputDirectory>${project.build.directory}/lib</outputDirectory>
      </configuration>
    </execution>
  </executions>
</plugin>

Problem

I'm trying to create automated solution for building with maven. My vision is to have a Maven build, which creates JAR file from my project and then just copies all the dependencies as JARs to some sub-directory in "target" folder. I do not want to use Shade or Assembly (so I do not want to extract the content of other JARs and include it in one "super-JAR", because the project is more complicated and it breaks when I'm including all the JARs in one file). How can I do such build POM?

Original source