欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

error: object MultivariateNormalDistribution is not a member of package

程序员文章站 2022-07-13 22:22:52
...

完整报错如下:

RunRisk.scala:11: error: object MultivariateNormalDistribution is not a member of package org.apache.commons.math3.distribution
[INFO] import org.apache.commons.math3.distribution.MultivariateNormalDistribution
[INFO]        ^
[ERROR] src/main/scala/RunRisk.scala:185: error: not found: type MultivariateNormalDistribution
[INFO]     val multivariateNormal = new MultivariateNormalDistribution(rand, factorMeans,
[INFO]                                  ^
[ERROR] two errors found
org/apache/commons/commons-math3/3.4.1

 

上述报错的原因是commons-math3版本太低导致的。

解决方案:

pom.xml中commons-math3修改为:
 

<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-math3</artifactId>
    <version>3.6.1</version>
</dependency>