2011-09-08 35 views
4

是否可以將AndroidAnnotations Maven設置調整爲Gradle? http://code.google.com/p/androidannotations/wiki/MavenEclipse 我看來不能讓它工作,我不斷收到com.sun.codemodel#codemodel;2.5-FROZEN-AA: not found將AndroidAnnotations Maven設置調整爲Gradle

到目前爲止,我有這個

description = "App" 
abbreviation = "App" 
version = '1.0.0.BUILD-SNAPSHOT' 

buildscript { 
    repositories { 
     mavenRepo name: 'gradle-android-plugin', urls: 'http://jvoegele.com/maven2/' 
     mavenRepo name: 'androidannotations', urls: 'http://repository.excilys.com/content/repositories/releases/' 
    } 

    def gradleAndroidPluginVersion = '1.0.0' 

    dependencies { 
     classpath "com.jvoegele.gradle.plugins:android-plugin:$gradleAndroidPluginVersion" 
    } 
} 

apply plugin: 'android' 
apply plugin: 'eclipse' 
apply plugin: 'idea' 

def compatibilityVersion = 1.6 
sourceCompatability = compatibilityVersion 
targetCompatibility = compatibilityVersion 

repositories { 
    mavenCentral() 
    mavenRepo urls: 'http://maven.springframework.org/snapshot' 
    mavenRepo urls: 'http://maven.springframework.org/milestone' 
} 

def roboguiceVersion = '1.1.1' 
def guiceVersion = '2.0-no_aop' 
def springAndroidVersion = '1.0.0.M4' 
def commonsHttpClientVersion = '3.1' 
def jacksonMapperVersion = '1.8.5' 
def androidAnnotationsVersion = '2.1' 

dependencies { 
    compile "org.roboguice:roboguice:$roboguiceVersion" 
    compile "com.google.inject:guice:$guiceVersion" 
    compile "org.springframework.android:spring-android-rest-template:$springAndroidVersion" 
    compile "commons-httpclient:commons-httpclient:$commonsHttpClientVersion" 
    compile "org.codehaus.jackson:jackson-mapper-asl:$jacksonMapperVersion" 
    compile "com.googlecode.androidannotations:androidannotations:$androidAnnotationsVersion" 
    compile group: 'com.googlecode.androidannotations', name: 'androidannotations', version: '2.1', classifier: 'api' 
    runtime files('lib/server-standalone.jar') 
} 

sourceSets { 
    main { 
     java { 
      srcDir 'src' 
     } 
    } 
} 

clean { 
    delete 'gen' 
} 

idea { 
    module { 
     downloadJavadoc = true 
    } 
    project { 
     javaVersion = 'Android 2.2 Platform' 
    } 
} 

androidProcessResources.dependsOn(clean) 
eclipse.dependsOn(cleanEclipse) 
idea.dependsOn(cleanIdea) 

defaultTasks 'assemble' 

回答

2

作爲第一個指針,我看不到託管Maven倉庫的聲明androidannotations庫。

你應該添加http://repository.excilys.com/content/repositories/releases作爲一個maven回購:

... 
repositories { 
    mavenCentral() 
    mavenRepo urls: 'http://maven.springframework.org/snapshot' 
    mavenRepo urls: 'http://maven.springframework.org/milestone' 
    mavenRepo urls: 'http://repository.excilys.com/content/repositories/releases' 
} 
... 

問候

2

好吧,我設法解決它

我不得不添加

repositories { 
    mavenCentral() 
    mavenRepo urls: 'http://maven.springframework.org/snapshot' 
    mavenRepo urls: 'http://maven.springframework.org/milestone' 
    mavenRepo urls: 'http://repository.excilys.com/content/repositories/releases' 
    mavenRepo urls: 'http://repository.excilys.com/content/repositories/thirdparty' 
} 

springAndroidVersion = '1.0.0.M4' 
commonsHttpClientVersion = '3.1' 
jacksonVersion = '1.8.5' 
androidAnnotationsVersion = '2.1.1' 

dependencies { 
    compile "org.springframework.android:spring-android-rest-template:$springAndroidVersion" 
    compile "commons-httpclient:commons-httpclient:$commonsHttpClientVersion" 
    compile "org.codehaus.jackson:jackson-mapper-asl:$jacksonVersion" 
    compile "com.googlecode.androidannotations:androidannotations:$androidAnnotationsVersion" 
    compile "com.googlecode.androidannotations:androidannotations:$androidAnnotationsVersion:api" 
} 
+0

只要你知道, AndroidAnnotations 2.2-RC2在Maven Central上,你不需要定製的repo!看起來你設法用Gradle構建了一個Android + AndroidAnnotations項目,這非常棒。如果您有幾分鐘的時間,如果您可以發送郵件到[email protected]並描述使用Gradle構建AA項目的步驟,那將是非常好的。無論如何,好工作! –