0

I've read the question How do I put all required JAR files in a library folder inside the final JAR file with Maven? and the answer

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <executions>
        <execution>
            <id>copy-dependencies</id>
            <phase>prepare-package</phase>
            <goals>
                <goal>copy-dependencies</goal>
            </goals>
            <configuration>
                <outputDirectory>${project.build.directory}/classes/lib</outputDirectory>
                <overWriteReleases>false</overWriteReleases>
                <overWriteSnapshots>false</overWriteSnapshots>
                <overWriteIfNewer>true</overWriteIfNewer>
            </configuration>
        </execution>
    </executions>
</plugin>

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <configuration>
        <archive>
            <manifest>
                <addClasspath>true</addClasspath>
                <!-- <classpathPrefix>lib</classpathPrefix> -->
                <!-- <mainClass>test.org.Cliente</mainClass> -->
            </manifest>
            <manifestEntries>
                <Class-Path>lib/</Class-Path>
            </manifestEntries>
        </archive>
    </configuration>
</plugin>

provides just what que OP is questioning.

Is it possible to do that without including dependencies declared as provided?

Community
  • 1
  • 1
Philippe Gioseffi
  • 1,488
  • 3
  • 24
  • 41

1 Answers1

0

Add <excludeScope>provided</excludeScope> under <overWriteIfNewer>true</overWriteIfNewer>

kaitoy
  • 1,545
  • 9
  • 16
  • Wouldn't it be `provided`? That's what's Eclipse suggested me after I tried your answer and worked like a charm. Edit your answer and I'll have it as the accepted one. – Philippe Gioseffi Dec 23 '16 at 19:06