错误多模块gradle构建'意外的节点Android包装'

时间:2015-06-03 15:56:52

标签: intellij-idea gradle android-gradle build.gradle

当我尝试构建项目时,这是我的 Excpetion

Error:Internal error: (java.lang.AssertionError) Unexpected node Android Packaging; nodes=[Module 'app' production, Module 'gps-trackman' production, Module 'gps-trackman.v1' production, Module 'app' tests, Resources for 'app' production, Resources for 'gps-trackman' production, Resources for 'app' tests, Artifact 'app', Artifact 'gps-trackman:war', Artifact 'gps-trackman:war exploded', gradle-resources-production:gps-trackman.v1, gradle-resources-test:gps-trackman.v1, Android Gradle Build Target]
java.lang.AssertionError: Unexpected node Android Packaging; nodes=[Module 'app' production, Module 'gps-trackman' production, Module 'gps-trackman.v1' production, Module 'app' tests, Resources for 'app' production, Resources for 'gps-trackman' production, Resources for 'app' tests, Artifact 'app', Artifact 'gps-trackman:war', Artifact 'gps-trackman:war exploded', gradle-resources-production:gps-trackman.v1, gradle-resources-test:gps-trackman.v1, Android Gradle Build Target]
    at com.intellij.util.graph.GraphGenerator.buildOuts(GraphGenerator.java:55)
    at com.intellij.util.graph.GraphGenerator.<init>(GraphGenerator.java:36)
    at com.intellij.util.graph.GraphGenerator.create(GraphGenerator.java:40)
    at org.jetbrains.jps.builders.impl.BuildTargetIndexImpl.initializeChunks(BuildTargetIndexImpl.java:87)
    at org.jetbrains.jps.builders.impl.BuildTargetIndexImpl.getSortedTargetChunks(BuildTargetIndexImpl.java:51)
    at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:661)
    at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:370)
    at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:191)
    at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:137)
    at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:293)
    at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:124)
    at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler$1.run(BuildMain.java:242)
    at org.jetbrains.jps.service.impl.SharedThreadPoolImpl$1.run(SharedThreadPoolImpl.java:41)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

我有一个IntelliJ根项目,它是空的,只包含两个模块,不包含任何源代码,名为

  

“GPS-trackman.v1

并且根项目的build.gradle如下所示:

buildscript {
    repositories {
        jcenter()
     //   mavencentral()
    }

}

allprojects {
    repositories {
        jcenter()
    }
}

我有一个名为

的android模块
  

'应用'

并且'app'的build.gradle看起来像这样:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
    }

    defaultConfig {
        applicationId "com.pekam"
        minSdkVersion 17
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            debuggable true
        }
    }
}

dependencies {
    compile('org.springframework.android:spring-android-rest-template:1.+') {
        exclude group: 'org.springframework', module: 'spring-core'
    }
    compile('org.springframework.android:spring-android-auth:1.+') {
        exclude group: 'org.springframework', module: 'spring-core'
    }
    compile('org.springframework.android:spring-android-core:1.+') {
        exclude group: 'org.springframework', module: 'spring-core'
    }
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:22.2.0'
    compile 'com.google.android.gms:play-services:7.5.0'
    compile 'com.google.code.gson:gson:2.3.1'
    compile 'com.fasterxml.jackson.core:jackson-databind:2.4.4'
    compile files('libs/slf4j-android-1.6.1-RC1.jar')
    compile 'javax.persistence:persistence-api:1.0'
    compile files('libs/ent.jar')
}

和一个名为

的spring-boot模块
  

'GPS-养路'

并且'gps-trackman'的build.gradle看起来像这样:

apply plugin: 'java'
apply plugin: 'maven'

group = 'com.pekam'
version = '0.0.1-SNAPSHOT'

description = """demo"""

sourceCompatibility = 1.5
targetCompatibility = 1.5



repositories {

     maven { url "http://repo.maven.apache.org/maven2" }
}
dependencies {
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-aop', version:'1.2.3.RELEASE'
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version:'1.2.3.RELEASE'
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-rest', version:'1.2.3.RELEASE'
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-jdbc', version:'1.2.3.RELEASE'
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-security', version:'1.2.3.RELEASE'
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version:'1.2.3.RELEASE'
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-ws', version:'1.2.3.RELEASE'
    compile group: 'org.springframework.boot', name: 'spring-boot-legacy', version:'1.0.1.RELEASE'
    compile group: 'com.google.appengine', name: 'appengine-api-1.0-sdk', version:'1.9.19'
    compile group: 'javax.servlet', name: 'servlet-api', version:'2.5'
    compile group: 'junit', name: 'junit', version:'4.11'
    runtime group: 'com.h2database', name: 'h2', version:'1.4.185'
    runtime group: 'org.hsqldb', name: 'hsqldb', version:'2.3.2'
    runtime group: 'mysql', name: 'mysql-connector-java', version:'5.1.34'
    testCompile(group: 'org.springframework.boot', name: 'spring-boot-starter-test', version:'1.2.3.RELEASE') {
exclude(module: 'commons-logging')
    }
}

0 个答案:

没有答案