1

I have a project managed by maven and few JARs in local lib directory.

 <dependency>
     <groupId>opencv</groupId>
     <artifactId>org.opencv</artifactId>
     <version>1.0</version>
     <scope>system</scope>
     <systemPath>${project.basedir}/lib/opencv-249.jar</systemPath>         
 </dependency>

I need this jar will be included in resulting jar-with-dependencies file.

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>2.4.3</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
            </configuration>
          </execution>
        </executions>
      </plugin>

Unfortunately maven seems to omit this dependency and is missing in the resulting file.

Radim Burget
  • 1,456
  • 2
  • 20
  • 39
  • Local lib directory is simply wrong in general in Maven. Upload those jar's into a repository manager and than handlie it via dependency. Maven Shade Plugin has scope filtering for `Requires dependency resolution of artifacts in scope: runtime.`. – khmarbaise Jul 03 '16 at 09:55
  • You are being hit by `system`; `maven-shade-plugin` won't include it and this is by design. You can refer to http://stackoverflow.com/questions/2229757/maven-add-a-dependency-to-a-jar-by-relative-path to see how to depend on a local JAR. But the definite way to go is using a repository manager (like Nexus or Artifactory). See the linked question. – Tunaki Jul 03 '16 at 12:30

0 Answers0