0

我有一个 Geoscript 库,可以读取上传的 shapefile,然后将其转换为 WKT。这在我将库上传到 lib 目录时有效,但是当我从 Maven 中将其拉入时,我会遇到 sax 冲突。有谁知道解决方案?

这是错误

| 错误执行脚本时出错清理:加载程序约束冲突:解决覆盖方法“org.apache.tools.ant.helper.ProjectHelper2$RootHandler.setDocumentLocator(Lorg/xml/sax/Locator;)V”时类加载器(org/ 的实例当前类 org/apache/tools/ant/helper/ProjectHelper2$RootHandler 的 codehaus/groovy/grails/cli/support/GrailsRootLoader) 及其超类加载器 ( 的实例 ) 具有类型为 andler.setDocumentLocator 的不同 Class 对象(Lorg/xml/sax/Locator;)V 在签名中使用(注意:堆栈跟踪已被过滤。使用 --verbose 查看整个跟踪。)

4

1 回答 1

2

这表现为 Grails 错误,即 GRAILS-9331。您应该能够排除有问题的库,但 Grails 忽略了这一点。尚不可用的 Grails 修复程序实际上似乎无法解决此问题,它只是在加载类时忽略 org.xml。这是一个间接修复,似乎仍然错误加载了 xml-apis 库。理想的解决方法是:

       compile ('org.geoscript:geoscript-groovy:1.0-SNAPSHOT') {
           excludes "xml-apis","xml-apis-ext","xercesImpl","xalan"
       }

Grails 错误阻止了它的工作。我将排除列表和依赖项加载到 Gradle 中,并为 1.0-SNAPSHOT 生成了依赖项列表。此白名单可用于代替 'org.geoscript:geoscript-groovy:1.0-SNAPSHOT'

        compile("bouncycastle:bcmail-jdk14:138",
            "bouncycastle:bcprov-jdk14:138",
            "bouncycastle:bctsp-jdk14:138",
            "com.googlecode.json-simple:json-simple:1.1",
            "com.h2database:h2:1.1.119",
            "com.lowagie:itext:2.1.7",
            "com.miglayout:miglayout:3.7",
            "com.vividsolutions:jts:1.12",
            "commons-collections:commons-collections:3.2.1",
            "commons-dbcp:commons-dbcp:1.3",
            "commons-io:commons-io:2.0.1",
            "commons-jxpath:commons-jxpath:1.3",
            "commons-logging:commons-logging:1.1.1",
            "commons-pool:commons-pool:1.5.4",
            "hsqldb:hsqldb:1.8.0.10",
            "it.geosolutions.imageio-ext:imageio-ext-tiff:1.1.5",
            "it.geosolutions.imageio-ext:imageio-ext-utilities:1.1.5",
            "java3d:vecmath:1.3.2",
            "javax.media:jai_codec:1.1.3",
            "javax.media:jai_core:1.1.3",
            "javax.media:jai_imageio:1.1",
            "jdom:jdom:1.0",
            "jfree:eastwood:1.1.1-20090908",
            "jfree:jcommon:1.0.13",
            "jfree:jfreechart:1.0.10",
            "jgridshift:jgridshift:1.0",
            "junit:junit:4.5",
            "mysql:mysql-connector-java:5.1.17",
            "net.java.dev.jsr-275:jsr-275:1.0-beta-2",
            "net.sf.opencsv:opencsv:2.0",
            "net.sourceforge.hatbox:hatbox:1.0.b7"
    ) {
        transitive = false
    }
    compile("org.apache.avalon.framework:avalon-framework-api:4.3.1",
            "org.apache.avalon.framework:avalon-framework-impl:4.3.1",
            "org.apache.xmlgraphics:batik-anim:1.7",
            "org.apache.xmlgraphics:batik-awt-util:1.7",
            "org.apache.xmlgraphics:batik-bridge:1.7",
            "org.apache.xmlgraphics:batik-css:1.7",
            "org.apache.xmlgraphics:batik-dom:1.7",
            "org.apache.xmlgraphics:batik-ext:1.7",
            "org.apache.xmlgraphics:batik-gvt:1.7",
            "org.apache.xmlgraphics:batik-js:1.7",
            "org.apache.xmlgraphics:batik-parser:1.7",
            "org.apache.xmlgraphics:batik-script:1.7",
            "org.apache.xmlgraphics:batik-svg-dom:1.7",
            "org.apache.xmlgraphics:batik-svggen:1.7",
            "org.apache.xmlgraphics:batik-transcoder:1.7",
            "org.apache.xmlgraphics:batik-util:1.7",
            "org.apache.xmlgraphics:batik-xml:1.7",
            "org.apache.xmlgraphics:fop:0.94",
            "org.apache.xmlgraphics:xmlgraphics-commons:1.2",
            "org.bouncycastle:bcmail-jdk14:1.38",
            "org.bouncycastle:bcprov-jdk14:1.38",
            "org.bouncycastle:bctsp-jdk14:1.38",
            "org.eclipse.emf:common:2.6.0",
            "org.eclipse.emf:ecore:2.6.1",
            "org.eclipse.xsd:xsd:2.6.0",
            "org.geoscript:geocss_2.9.1:0.7.4",
            "org.geoscript:geoscript-groovy:1.0-SNAPSHOT",
            "org.geotools.jdbc:gt-jdbc-h2:8.4",
            "org.geotools.jdbc:gt-jdbc-mysql:8.4",
            "org.geotools.jdbc:gt-jdbc-postgis:8.4",
            "org.geotools.jdbc:gt-jdbc-spatialite:8.4"
    ) {
        transitive = false
    }
    compile("org.geotools.ogc:net.opengis.fes:8.4",
            "org.geotools.ogc:net.opengis.ows:8.4",
            "org.geotools.ogc:net.opengis.wfs:8.4",
            "org.geotools.ogc:org.w3.xlink:8.4",
            "org.geotools.xsd:gt-xsd-core:8.4",
            "org.geotools.xsd:gt-xsd-fes:8.4",
            "org.geotools.xsd:gt-xsd-filter:8.4",
            "org.geotools.xsd:gt-xsd-gml2:8.4",
            "org.geotools.xsd:gt-xsd-gml3:8.4",
            "org.geotools.xsd:gt-xsd-ows:8.4",
            "org.geotools.xsd:gt-xsd-wfs:8.4",
            "org.geotools:gt-api:8.4",
            "org.geotools:gt-brewer:8.4",
            "org.geotools:gt-charts:8.4",
            "org.geotools:gt-coverage:8.4",
            "org.geotools:gt-cql:8.4",
            "org.geotools:gt-data:8.4",
            "org.geotools:gt-epsg-hsql:8.4",
            "org.geotools:gt-geojson:8.4",
            "org.geotools:gt-graph:8.4",
            "org.geotools:gt-grid:8.4",
            "org.geotools:gt-jdbc:8.4",
            "org.geotools:gt-main:8.4",
            "org.geotools:gt-metadata:8.4",
            "org.geotools:gt-opengis:8.4",
            "org.geotools:gt-process-feature:8.4",
            "org.geotools:gt-process-geometry:8.4",
            "org.geotools:gt-process:8.4",
            "org.geotools:gt-property:8.4",
            "org.geotools:gt-referencing:8.4",
            "org.geotools:gt-render:8.4"
    ) {
        transitive = false
    }
    compile("org.geotools:gt-shapefile:8.4",
            "org.geotools:gt-svg:8.4",
            "org.geotools:gt-swing:8.4",
            "org.jaitools:jt-utils:1.3.0",
            "org.jaitools:jt-zonalstats:1.3.0",
            "org.json:json:20090211",
            "org.opengeo:geodb:0.7-RC2",
            "org.scala-lang:scala-library:2.9.1",
            "picocontainer:picocontainer:1.2",
            "postgresql:postgresql:8.4-701.jdbc3"
    ) {
        transitive = false
    }

非常冗长,但会在 Grails 2.1.0 中正确运行

于 2012-12-05T01:24:38.500 回答