首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将com.vividsolutions.jts迁移到org.locationtech.jts仍在抱怨缺少com.vividsolutions包

将com.vividsolutions.jts迁移到org.locationtech.jts仍在抱怨缺少com.vividsolutions包
EN

Stack Overflow用户
提问于 2022-01-11 00:50:13
回答 1查看 806关注 0票数 0

我正在尝试升级使用com.vividsolutions.jts的java应用程序的依赖项。我从pom.xml中删除了对这个库的所有引用,并将它们替换为来自org.locationtech.jts的引用。

我已经更新了所有的导入,以使用org.locationtech版本。但是,在我的函数中,我仍然收到一个与未导入的com.vividsolutions对象相关的错误。

代码语言:javascript
复制
import org.locationtech.spatial4j.context.jts.JtsSpatialContext;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.GeometryFactory;
import org.locationtech.jts.geom.LinearRing;

import org.locationtech.spatial4j.shape.jts.JtsGeometry;


// ... other stuff

public static myFunc() {
    GeometryFactory gf = new GeometryFactory();
    LinearRing linear = gf.createLinearRing(coordinates);
    JtsGeometry poly = new JtsGeometry(fact.createPolygon(linear), JtsSpatialContext.GEO, true, true);
}

下面是上面代码的最后一行所得到的错误:[ERROR] cannot access com.vividsolutions.jts.geom.Geometry [ERROR] class file for com.vividsolutions.jts.geom.Geometry not found

我显然是从org.locationtech的新库导入了org.locationtech,但是它仍然认为应该使用旧的库。

旧库不再存在于依赖树或代码中,因为以下内容不返回任何内容:

代码语言:javascript
复制
mvn dependency:tree | grep vivid
rg vivid

知道我在这里遗漏了什么吗?或者我应该如何解决这个问题?

EN

回答 1

Stack Overflow用户

发布于 2022-01-12 00:27:37

我不太确定为什么包含了生动的解决方案库。但是,我能够通过将这两种方法都包括在pom.xml中来解决我的问题

代码语言:javascript
复制
    <dependency>
        <groupId>org.locationtech.jts</groupId>
        <artifactId>jts-core</artifactId>
        <version>1.18.2</version>
    </dependency>
    <dependency>
        <groupId>org.locationtech.spatial4j</groupId>
        <artifactId>spatial4j</artifactId>
        <version>0.8</version>
    </dependency>

最初,我在pom.xml文件中没有第二个依赖项。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70660454

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档