Plugin can't coexist with Java plugin

Ian Durkan's Avatar

Ian Durkan

09 Jan, 2012 08:56 PM

I'm trying to use the gradleFX plugin to build the Flex part of a mixed Java/GWT/Flex project in an application I'm working on. I found that since the gradleFx plugin uses task names such as "build", "test", "clean", etc., gradleFx cannot be used in a project that also uses the Java plugin, Groovy plugin, etc.

It's easy enough to hack around this locally, but as a more permanent solution, consider changing the names of gradleFx's tasks to things like "buildFlex", "testFlex", "cleanFlex" etc. In the GradleFxPlugin class these tasks could be programmatically added as dependencies of the similar Java/Groovy tasks if the relevant plugins are present.

  1. Support Staff 1 Posted by Yennick Trevels on 09 Jan, 2012 09:10 PM

    Yennick Trevels's Avatar

    Hi Ian,

    I understand the problem, but I chose those names because imo a project should only be in one language (Flex, Java, Groovy). So if you have a backend project written in Java and a frontend project written in Flex, I'd create two subprojects which each apply their respective plugin (java or gradlefx plugin).
    This encourages a clean structure in your projects. Do you have a usecase where you really would want to mix up multiple languages in one project?

  2. Support Staff 2 Posted by Maxime Cowez on 27 Jan, 2012 10:27 AM

    Maxime Cowez's Avatar

    Yennick, I'm with you on your opinion that a project should only be in one language. But then I don't really understand why you chose to use the Maven project structure as the default for source folders (/src/main/actionscript), since the 'actionscript' part of that path would be redundant in single-language projects. Especially when you look at how FlashBuilder works with source folders.

    I know that this is the way the Gradle Java plugin works too, but then source folders are treated and presented differently in a Java Eclipse project than in a FlashBuilder Flex project. The most important issue being that FB expects your Application file to be in the /src folder. You simply can't compile with FB if it's not there.

    So the bottom line is that I will have to override the source folder location on every project, which can hardly be the purpose of a default value.

    (BTW: now that I'm rereading myself it feels like I'm criticising, but I'd like to clarify that I really like this project and I'm just trying to provide you with a second opinion on your decisions)

  3. Support Staff 3 Posted by Yennick Trevels on 27 Jan, 2012 11:15 AM

    Yennick Trevels's Avatar

    Hi Maxime,

    It's always good to get a second opinion or question some decisions, it improves the library and I'm glad you took the time to discuss this ;-)

    I don't think the current project structure makes the actionscript folder redundant because you have four source folders:
    /src/main/actionscript: application sources

    /src/main/resources: application resources

    /src/test/actionscript: test sources

    /src/test/resources: test resources

    This structure nicely seperates the content of your project.

    Regarding Flash Builder, it is possible to change the source folder location (at least in Flash Builder 4 it is). Intellij also gives me the choice to define my own source folder location, so I don't think this is an issue. The Flexmojos plugin uses a similar project structure and these projects can be used in Flash Builder.

    What I think is missing in GradleFx at the moment is a "create Flash Builder/Intellij project files" task which would create the ".project" and ".actionscriptProperties" files and that you could import the project into Flash Builder afterwards with all the compiler options and source folders already configured. Then you don't have to manually configure the source folders and compiler options in Flash Builder for every project.

  4. Support Staff 4 Posted by Maxime Cowez on 27 Jan, 2012 01:09 PM

    Maxime Cowez's Avatar

    OK, fair enough. I tried adjusting the main source folder in FlashBuilder and it works. But still, that kind of project configuration looks but-ugly in FB.

    Here's what a simple Java/Eclipse project looks like with that configuration:
    Imgur

    Now look at the Flex/FlashBuilder project with a similar setup:
    Imgur

    I know this is not a biggie, but still if I have to open these folders every time, I'm sure it'll start to irritate me at some time or another.

    Regarding the "create IDE project" feature: that would be very welcome. I completely deconfigured a project yesterday by trying to run the 'eclipse' plugin against an FB project :-/

    (PS: the preview didn't show my Imgur images inline so I also joined them as attachments)

  5. Support Staff 5 Posted by Yennick Trevels on 27 Jan, 2012 01:45 PM

    Yennick Trevels's Avatar

    That Flash Builder view is indeed quite annoying. One way to avoid this is by specifying the source folder as an absolute path (like C:/myproject/src/main/actionscript), then it will be shown like "[source path] actionscript" in FB.
    I know an absolute path isn't ideal when you commit those project files to svn or git, but when I can implement the "generate IDE project files" functionality, it will handle that for you and it won't be a problem because every developer will generate those project files on their own machine.

  6. Support Staff 6 Posted by Maxime Cowez on 27 Jan, 2012 03:16 PM

    Maxime Cowez's Avatar

    Sounds promising. I'll be watching you closely ;)

    In the meantime, perhaps I'll fork, learn some Groovy and add a task for building with Apparat. That shouldn't be too hard for a beginner.

    I already got it running like this (perhaps an interesting addition to your examples):

    def scala   = [ home: sdk + 'scala-2.8.2/' ]
    def apparat = [ home: sdk + 'apparat-1.0-RC9/' ]
    apparat.path = ant.path {
        fileset dir: scala.home,   includes: 'lib/*.jar'
        fileset dir: apparat.home, includes: '*.jar'
    }
    ant.taskdef resource: 'apparat/embedding/ant/antlib.xml', classpath: apparat.path
    
    compress << {
        def swf = buildDir.path + '/' + output + '.' + type
    
        ant {
            tdsi    in: swf, classpath: apparat.path
            reducer in: swf, classpath: apparat.path
        }
    }
    
  7. Support Staff 7 Posted by Maxime Cowez on 27 Jan, 2012 03:36 PM

    Maxime Cowez's Avatar

    Back on topic: I tried feeding an absolute path to FB. It automatically converts it to a relative path (FB 4.6 / Eclipse 3.7 / Win 7). Perhaps it doesn't do that if you edit the .project file manually.

    Off topic again: I made a mistake in that compress task definition. Should be:

    task compress(dependsOn: build) << { ... }
    

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