无法在 OS X 上与 JavaCV 中的 Maven 一起初始化 class org.bytedeco.javacpp.avutil

Could not initialize class org.bytedeco.javacpp.avutil on OS X along with Maven in JavaCV

我已将以下依赖项添加到我的 maven 项目中。

<dependency>
        <groupId>org.bytedeco</groupId>
        <artifactId>javacpp</artifactId>
        <version>0.10</version>
    </dependency>
    <dependency>
        <groupId>org.bytedeco</groupId>
        <artifactId>javacv</artifactId>
        <version>0.10</version>
    </dependency>
    <dependency>
        <groupId>org.bytedeco.javacpp-presets</groupId>
        <artifactId>opencv</artifactId>
        <version>2.4.10-0.10</version>
    </dependency>
    <dependency>
        <groupId>org.bytedeco.javacpp-presets</groupId>
        <artifactId>ffmpeg</artifactId>
        <version>2.5.1-0.10</version>
    </dependency>
    <dependency>
        <groupId>org.bytedeco.javacpp-presets</groupId>
        <artifactId>flycapture</artifactId>
        <version>2.7.3.13-0.10</version>
    </dependency>
    <dependency>
        <groupId>org.bytedeco.javacpp-presets</groupId>
        <artifactId>libdc1394</artifactId>
        <version>2.2.2-0.10</version>
    </dependency>
    <dependency>
        <groupId>org.bytedeco.javacpp-presets</groupId>
        <artifactId>libfreenect</artifactId>
        <version>0.5.1-0.10</version>
    </dependency>
    <dependency>
        <groupId>org.bytedeco.javacpp-presets</groupId>
        <artifactId>videoinput</artifactId>
        <version>0.200-0.10</version>
    </dependency>
    <dependency>
        <groupId>org.bytedeco.javacpp-presets</groupId>
        <artifactId>artoolkitplus</artifactId>
        <version>2.3.1-0.10</version>
    </dependency>
    <dependency>
        <groupId>org.bytedeco.javacpp-presets</groupId>
        <artifactId>flandmark</artifactId>
        <version>1.07-0.10</version>
    </dependency>
    <dependency>
        <groupId>org.bytedeco.javacpp-presets</groupId>
        <artifactId>fftw</artifactId>
        <version>3.3.4-0.10</version>
    </dependency>
    <dependency>
        <groupId>org.bytedeco.javacpp-presets</groupId>
        <artifactId>gsl</artifactId>
        <version>1.16-0.10</version>
    </dependency>
    <dependency>
        <groupId>org.bytedeco.javacpp-presets</groupId>
        <artifactId>llvm</artifactId>
        <version>3.5.0-0.10</version>
    </dependency>
    <dependency>
        <groupId>org.bytedeco.javacpp-presets</groupId>
        <artifactId>leptonica</artifactId>
        <version>1.71-0.10</version>
    </dependency>
    <dependency>
        <groupId>org.bytedeco.javacpp-presets</groupId>
        <artifactId>tesseract</artifactId>
        <version>3.03-rc1-0.10</version>
    </dependency>

并运行提到的代码 here。我使用 FFmpegFrameGrabber 而不是 OpenCVFrameGra

我收到以下错误。

Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class org.bytedeco.javacpp.avutil
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:274)
at org.bytedeco.javacpp.Loader.load(Loader.java:385)
at org.bytedeco.javacpp.Loader.load(Loader.java:353)
at org.bytedeco.javacpp.avformat$AVFormatContext.<clinit>(avformat.java:2249)
at org.bytedeco.javacv.FFmpegFrameGrabber.startUnsafe(FFmpegFrameGrabber.java:346)
at org.bytedeco.javacv.FFmpegFrameGrabber.start(FFmpegFrameGrabber.java:340)

有什么想法吗?我在 OS X Yosemite 和 JDK 1.7.

正如 Samuel Audet 提到的,这个问题在使用 "platform.dependencies" 属性 后得到了解决。例如:

 $ mvn package exec:java -Dplatform.dependencies -Dexec.mainClass=Demo