Wiered" [错误]错误' jar:file ..." "无法解析为某种类型"在gwt gradle

时间:2016-10-26 11:18:06

标签: gwt gradle

我有一系列相互依赖的GWT项目,所有链编译都很好,但最后一个元素似乎无法从生成的依赖jar中读取java类:

我在错误中检查了jar,.java和.class文件确实存在于它们应该是的位置:编译器找到包含所需类的jar

令人惊讶
  

ShopAdmin-1.0.jar

但它没有读过它(许多类都是这种情况,请参阅 the compilation output

 [ERROR] Errors in 'jar:file:/C:/Users/Zied%20Hamdi/git/VuMe/ShopAdmin/build/libs/ShopAdmin-1.0.jar!/fr/onevu/vume/shopadmin/ShopAdmin.java'
            [ERROR] fr.onevu.vume.shopadmin.ShopAdminClientFactory cannot be resolved to a type

你可以看到

  

ShopAdminClientFactory.java与ShopAdmin.java位于同一个包中

 R‚pertoire de c:\temp\ShopAdmin-1.0\fr\onevu\vume\shopadmin

25/10/2016  22:00    <REP>          .
25/10/2016  22:00    <REP>          ..
25/10/2016  22:00    <REP>          activity
25/10/2016  22:00    <REP>          activitymappers
25/10/2016  21:43               856 ContentManager$1.class
25/10/2016  21:43             1ÿ836 ContentManager.class
23/09/2016  19:29               988 ContentManager.java
25/10/2016  22:00    <REP>          i18n
25/10/2016  22:00    <REP>          request
25/10/2016  21:43             1ÿ225 ShopAdmin$1.class
25/10/2016  21:43             1ÿ112 ShopAdmin$2.class
25/10/2016  21:43             6ÿ486 ShopAdmin.class
23/09/2016  19:29             5ÿ439 ShopAdmin.java
25/10/2016  21:43             1ÿ488 ShopAdminActivityManager$1.class
25/10/2016  21:43             2ÿ907 ShopAdminActivityManager.class
27/09/2016  12:59             1ÿ962 ShopAdminActivityManager.java
25/10/2016  21:43             4ÿ466 ShopAdminClientFactory.class
23/09/2016  19:29             2ÿ838 ShopAdminClientFactory.java
25/10/2016  21:43            11ÿ472 ShopAdminClientFactoryImpl.class
23/09/2016  19:29             7ÿ249 ShopAdminClientFactoryImpl.java
25/10/2016  21:43             1ÿ638 ShopAdminEnvironment$1.class
25/10/2016  21:43             7ÿ853 ShopAdminEnvironment.class
23/09/2016  19:29             4ÿ060 ShopAdminEnvironment.java
25/10/2016  21:43             1ÿ476 ShopAdminFacade.class
23/09/2016  19:29               794 ShopAdminFacade.java
25/10/2016  21:43             1ÿ426 ShopAdminPlaceController.class
23/09/2016  19:29             1ÿ024 ShopAdminPlaceController.java
25/10/2016  22:00    <REP>          view
              21 fichier(s)           68ÿ595 octets

 R‚pertoire de c:\temp\ShopAdmin-1.0\fr\onevu\vume\shopadmin\activity

此外,项目Customer(正在编译)不包含ShopAdmin.java,此文件位于依赖项目中(Customer依赖于所有其他项目)。奇怪的是,在编译客户时,错误是关于一个不在客户中的类,而是与其直接相关的ShopAdmin(客户始终是商店管理员)。

/**
 * app engine conf found on https://cloud.google.com/appengine/docs/java/tools/gradle
 */

group = 'fr.onevu.vume'
version = '1.0'

apply plugin: 'war'
apply plugin: 'java'
apply plugin: 'gwt'
apply plugin: 'eclipse'
apply plugin: 'jetty'
apply plugin: 'com.google.cloud.tools.appengine'  // App Engine tasks


//Java version compatibility to use when compiling Java source.
sourceCompatibility = 1.7
//Java version to generate classes for.
targetCompatibility = 1.7

buildscript {
    repositories {
        jcenter() //repository where to fetch gwt gradle plugin
    }
    dependencies {
        classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.6'
        classpath 'com.google.cloud.tools:appengine-gradle-plugin:+'    // latest App Engine Gradle tasks
    }
}

// central repository to load the GWT library
repositories {
    maven {
        url 'https://maven-central.storage.googleapis.com'             // Google's mirror of Maven Central
        //   url 'https://oss.sonatype.org/content/repositories/snapshots' // SNAPSHOT Repository (if needed)
    }

    jcenter()
    mavenCentral()
}

dependencies {
  // https://mvnrepository.com/artifact/com.google.appengine/gradle-appengine-plugin
    compile group: 'com.google.appengine', name: 'gradle-appengine-plugin', version: '1.9.42'
    compile project(':VuMetest')

    // needed for Maps API
    compile group: 'com.google.gwt.google-apis', name: 'gwt-ajaxloader', version: '1.0.0'
    // https://mvnrepository.com/artifact/com.google.gwt/gwt-user
    compile group: 'com.google.gwt', name: 'gwt-user', version: '2.7.0'

    compile fileTree(dir: 'libs', include: '*.jar')
}


gwt {
    gwtVersion='2.7.0'
    modules 'fr.onevu.vume.ShopAdmin'

    logLevel = 'ERROR'

    minHeapSize = "1024M";
    maxHeapSize = "2048M";

    superDev {
        noPrecompile=true
    }

    // The following is only needed if you don't use the Google Plugin for Eclipse.
    eclipse{
        addGwtContainer=true // Default set to true
    }

    //Specify the deployment Port
    jettyRunWar.httpPort = 8089
}

jar {
  manifest {
    attributes 'Implementation-Title': 'IntoGwt', 'Implementation-Version': version
  }
  from project.sourceSets.main.allJava
  from('src/main/java') {
    include '**/*.xml'
    include '**/*.css'
    include '**/*.png'
    include '**/*.properties'
    exclude '**JUnit**'
  }

}

但是生成的jar文件包含了所有内容:uncompresses jar包含应该在那里的类:

有什么想法吗?

最好的reagrds, Zied

1 个答案:

答案 0 :(得分:0)

确定!

这是我的错,我没有必要手动解决依赖关系一段时间。这只是一个类路径问题(手动添加一个jar,因为它在maven上不可用)

我只需要遵循未解析的符号原因链,直到找到对// https://mvnrepository.com/artifact/com.google.gwt.google-apis/gwt-ajaxloader的依赖关系 编译组:'com.google.gwt.google-apis',名称:'gwt-ajaxloader',版本:'1.1.0'未添加