编译项目时发生类重复错误-Grails 2.3.11

时间:2018-09-27 16:19:27

标签: grails

我将一个项目从一个旧的grails版本更新到2.3.11,我仍在逐步解决每个依赖项,现在发现了以下错误:

| Error Compilation error: startup failed:
Compile error during compilation with javac.
C:\Users\DEV005\.grails\2.3.11\projects\AtivasWeb\plugins\multi-tenant-core-1.0.
3\src\java\grails\plugin\multitenant\core\CurrentTenant.java:6: error: duplicate
 class: grails.plugin.multitenant.core.CurrentTenant
public interface CurrentTenant {
       ^
C:\Users\DEV005\.grails\2.3.11\projects\AtivasWeb\plugins\multi-tenant-core-1.0.
3\src\java\grails\plugin\multitenant\core\CurrentTenantThreadLocal.java:3: error
: package com.infusion.util.event does not exist
import com.infusion.util.event.EventBroker;
                              ^
C:\Users\DEV005\.grails\2.3.11\projects\AtivasWeb\plugins\multi-tenant-core-1.0.
3\src\java\grails\plugin\multitenant\core\CurrentTenantThreadLocal.java:20: erro
r: cannot find symbol
    private EventBroker eventBroker;
            ^
  symbol:   class EventBroker
  location: class CurrentTenantThreadLocal
C:\Users\DEV005\.grails\2.3.11\projects\AtivasWeb\plugins\multi-tenant-core-1.0.
3\src\java\grails\plugin\multitenant\core\CurrentTenantThreadLocal.java:62: erro
r: cannot find symbol
    public void setEventBroker(EventBroker eventBroker)
                               ^
  symbol:   class EventBroker
  location: class CurrentTenantThreadLocal
C:\Users\DEV005\.grails\2.3.11\projects\AtivasWeb\plugins\multi-tenant-core-1.0.
3\src\java\grails\plugin\multitenant\core\datasource\TenantDataSourcePostProcess
or.java:12: error: package org.apache.commons.dbcp does not exist
import org.apache.commons.dbcp.BasicDataSource;
                              ^
C:\Users\DEV005\.grails\2.3.11\projects\AtivasWeb\plugins\multi-tenant-core-1.0.
3\src\java\grails\plugin\multitenant\core\datasource\TenantPooledDataSource.java
:4: error: package org.apache.commons.dbcp does not exist
import org.apache.commons.dbcp.BasicDataSource;
                              ^
C:\Users\DEV005\.grails\2.3.11\projects\AtivasWeb\plugins\multi-tenant-core-1.0.
3\src\java\grails\plugin\multitenant\core\datasource\TenantPooledDataSource.java
:13: error: cannot find symbol
public class TenantPooledDataSource extends BasicDataSource implements TenantDat
aSource {
                                            ^
  symbol: class BasicDataSource
C:\Users\DEV005\.grails\2.3.11\projects\AtivasWeb\plugins\multi-tenant-core-1.0.
3\src\java\grails\plugin\multitenant\core\CurrentTenantThreadLocal.java:12: erro
r: CurrentTenantThreadLocal is not abstract and does not override abstract metho
d isSet() in CurrentTenant
public class CurrentTenantThreadLocal implements CurrentTenant
       ^
C:\Users\DEV005\.grails\2.3.11\projects\AtivasWeb\plugins\multi-tenant-core-1.0.
3\src\java\grails\plugin\multitenant\core\datasource\TenantDataSourcePostProcess
or.java:30: error: cannot find symbol
        } else if (BasicDataSource.class.getName().equals(beanDefinition.getBean
ClassName())) {
                   ^
  symbol:   class BasicDataSource
  location: class TenantDataSourcePostProcessor
C:\Users\DEV005\.grails\2.3.11\projects\AtivasWeb\plugins\multi-tenant-core-1.0.
3\src\java\grails\plugin\multitenant\core\datasource\TenantPooledDataSource.java
:13: error: TenantPooledDataSource is not abstract and does not override abstrac
t method getUrl() in TenantDataSource
public class TenantPooledDataSource extends BasicDataSource implements TenantDat
aSource {
       ^
C:\Users\DEV005\.grails\2.3.11\projects\AtivasWeb\plugins\multi-tenant-core-1.0.
3\src\java\grails\plugin\multitenant\core\datasource\TenantPooledDataSource.java
:55: error: cannot find symbol
            this.url = dataSourceUrl;
                ^
  symbol: variable url
C:\Users\DEV005\.grails\2.3.11\projects\AtivasWeb\plugins\multi-tenant-core-1.0.
3\src\java\grails\plugin\multitenant\core\datasource\TenantPooledDataSource.java
:57: error: cannot find symbol
        return super.createDataSource();
               ^
  symbol:   variable super
  location: class TenantPooledDataSource
C:\Users\DEV005\.grails\2.3.11\projects\AtivasWeb\plugins\multi-tenant-core-1.0.
3\src\java\grails\plugin\multitenant\core\datasource\TenantPooledDataSource.java
:51: error: method does not override or implement a method from a supertype
    @Override
    ^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Users\DEV005\.grails\2.3.11\projects\AtivasWeb\plugins\cxf-1.1.4\src\ja
va\org\grails\cxf\artefact\DefaultGrailsEndpointClass.java uses unchecked or uns
afe operations.
Note: Recompile with -Xlint:unchecked for details.
13 errors


1 error

在多租户核心插件中似乎出现了错误,在此处出现了如何复制插件类的错误,这是我的BuildConfig:

grails.project.class.dir = "target/classes"
grails.project.test.class.dir = "target/test-classes"
grails.project.test.reports.dir = "target/test-reports"
//grails.project.war.file = "target/${appName}-${appVersion}.war"
grails.project.dependency.resolution = {
    // inherit Grails' default dependencies
    inherits("global") {
        // uncomment to disable ehcache
        // excludes 'ehcache'
    }
    log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
    repositories {
        grailsPlugins()
        grailsHome()
        grailsCentral()

        // uncomment the below to enable remote dependency resolution
        // from public Maven repositories
        mavenLocal()
        mavenCentral()
        //mavenRepo "http://snapshots.repository.codehaus.org"
        //mavenRepo "http://repository.codehaus.org"
        //mavenRepo "http://download.java.net/maven/2/"
        //mavenRepo "http://repository.jboss.com/maven2/"
    }
    dependencies {
        // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.

        // runtime 'mysql:mysql-connector-java:5.1.13'
        // https://mvnrepository.com/artifact/org.gagravarr/vorbis-java-core
        compile group: 'org.gagravarr', name: 'vorbis-java-core', version: '0.8'
    }
    plugins {
        //build ":tomcat:7.0.52.1"
        build ":tomcat:7.0.70"
        runtime ":hibernate:3.6.10.9"

        compile ':scaffolding:2.0.3'

        runtime ":jquery:1.8.3"
        compile ':cache:1.1.1'

        runtime ':resources:1.2.8'

        compile ":cache-headers:1.1.5"
        runtime ":cached-resources:1.0"
        runtime ":zipped-resources:1.0"
        runtime ":yui-minify-resources:0.1.5"

        // framework dependencies
        compile ":mail:1.0.1"
        compile ":fields:1.4"
        compile ":runtime-logging:0.4"
        compile ":burning-image:0.5.1"
        compile ":twitter-bootstrap:2.3.2"
        compile ":spring-security-core:2.0-RC4"
        compile ":spring-security-rest:1.4.0.RC5", {
            excludes: 'spring-security-core'
        }

        // multitenancy
        compile ":multi-tenant-single-db:0.8.3"

        // events to implement app hooks
        compile ":platform-core:1.0.RC6"

        // Para fazer upload de imagens
        compile ":attachmentable:0.3.0"

        // calendários para campos do tipo Date
        compile ":calendar:1.2.1"

        // exportar dados para Excel
        compile ":excel-export:0.1.9", {
            excludes: 'xerces'
        }

        // Jasper Reports
        compile ":jasper:1.11.0"

        // Export CSV
        compile ":csv:0.3.1"

        // Tests
        test ":cucumber:0.6.2"

        // Profiling
        compile ":profiler:0.5"

        //webservice SOAP
        compile ":cxf:1.1.4"
        compile ":cxf-client:2.0.3"

        //cron job
        compile ":quartz:1.0.2"

        compile ":multi-tenant-core:1.0.3"

    }
}

有人知道我在做什么错吗?缺少什么,或者我添加最多的插件是什么?

1 个答案:

答案 0 :(得分:1)

我检查了第一个错误:duplicate class: grails.plugin.multitenant.core.CurrentTenant

因此,该类似乎位于grails-multi-tenant-single-db中:https://github.com/multi-tenant/grails-multi-tenant-single-db/blob/385950fd6f9f12a55eebb62105e0326e50cc6fdc/src/java/grails/plugin/multitenant/core/CurrentTenant.java 在grails-multi-tenant-core中:https://github.com/multi-tenant/grails-multi-tenant-core/blob/190bed38faa2b81074c7ce514e44e20243657e5e/src/java/grails/plugin/multitenant/core/CurrentTenant.java

,您尝试同时使用这两个插件。