Exception is thrown when dependencies are added

Jhon's Avatar

Jhon

25 Sep, 2013 09:18 PM

Hi

I am trying to generate my Flash builder project by running "gradle flashbuilder" but instead I get the following error

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/jhon/Projects/GradleTest/build.gradle' line: 13

* What went wrong:
A problem occurred evaluating root project 'GradleTest'.
> No signature of method: org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.external() is applicable for argument types: (java.util.LinkedHashMap) values: [[group:org.as3commons, name:as3commons-collections, ...]]

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 3.335 secs

### Here is my build file. Any idea what might be wrong?

Thanks

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath group: 'org.gradlefx', name: 'gradlefx', version: '0.5'
    external group: 'org.as3commons', name: 'as3commons-collections', version: '1.1', ext: 'swc'
    external group: 'org.as3commons', name: 'as3commons-eventbus', version: '1.1', ext: 'swc'
    }
}

apply plugin: 'gradlefx'
apply plugin: 'flashbuilder'

type = 'swf'
srcDirs = ['src/']
resourceDirs = ['assets/']
testDirs = ['test']
testResourceDirs = ['test/testresources']

// Option necessary to embed configuration file to cuePoint class.
additionalCompilerOptions = [
'-static-link-runtime-shared-libraries=true'
]

mainClass = 'CallToAction.as'

dependencies {
    //merged files('lib/as3corelib.swc')
merged fileTree(dir: 'lib/', include: '*.swc')
}

  1. Support Staff 1 Posted by Maxime Cowez on 25 Sep, 2013 09:58 PM

    Maxime Cowez's Avatar

    Hi Jhon,

    At first glance it looks like you've misplaced your as3commons dependencies. The buildscript.dependencies node should contain only those dependencies required to run the Gradle build script, i.e. just the GradleFx plugin artifact in this case.

    Those as3commons external dependencies should go into the project dependencies node together with the merged libraries you've already got there.

  2. 2 Posted by Jhon on 26 Sep, 2013 05:10 PM

    Jhon's Avatar

    Thanks for you prompt response. I moved as3commons to the project dependency node and now I am getting the following error :

    Thanks

    gradle compile
    :copyresources
    :compileFlex

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':compileFlex'.
    > Could not resolve all dependencies for configuration ':external'.
       > Could not find group:org.as3commons, module:as3commons-collections, version:1.1.
         Required by:
             :TestGradleProject:unspecified

    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

    BUILD FAILED

    Total time: 6.196 secs
    xinexus2:TestGradleProject

           /**
    * Build File: follow the directions in the README.txt to build
    * this plug-in from the source.
    *
    */

    buildscript {
             repositories {
            mavenCentral()
            }
        dependencies {
            classpath group: 'org.gradlefx', name: 'gradlefx', version: '0.6.4'
        }
    }

    apply plugin: 'gradlefx'
    apply plugin: 'flashbuilder'

    type = 'swf'
    srcDirs = ['src/']
    testDirs = ['test']
    testResourceDirs = ['test/testresources']
    resourceDirs = ['assets/']

    // Option necessary to embed configuration file to cuePoint class.
    additionalCompilerOptions = [
    '-static-link-runtime-shared-libraries=true'
    ]

    mainClass = 'CallToAction.as'

    dependencies {
            //merged files('lib/as3corelib.swc')
    merged fileTree(dir: 'lib/', include: '*.swc')
    external group: 'org.as3commons', name: 'as3commons-collections', version: '1.1', ext: 'swc'
    }

  3. Support Staff 3 Posted by Maxime Cowez on 27 Sep, 2013 01:58 PM

    Maxime Cowez's Avatar

    You didn't define any repositories where Gradle(Fx) is supposed to look for your dependencies. Usually you'd pull dependencies from Maven central:

    repositories {
        mavenCentral()
    }
    

    however I think as3commons is not available on Maven central. So you have three options:

    • find a public repository that has the as3commons artifact
    • publish the as3commons swc to a self-hosted repository
    • use a 'local' repository like you already did with your merged dependencies

    For option number 2 you'll have to add the URL to your self-hosted repo:

    repositories {
        mavenCentral()
        maven { url 'http://my/self-hosted/repo' }
    }
    
  4. 4 Posted by Jhon on 27 Sep, 2013 03:20 PM

    Jhon's Avatar

    Thanks Maxime. You guys have the best technical support.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac