Uploaded image for project: 'Flume'
  1. Flume
  2. FLUME-2009

Flume project throws error when imported into Eclipse IDE (Juno)

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.3.1
    • Fix Version/s: 1.4.0
    • Component/s: Build
    • Labels:
      None

      Description

      It happens because Eclipse's M2E (maven integration) does not know what to do when certain plugins are executed. The forthcoming patch fixes the problem.

      1. FLUME-2009.patch
        6 kB
        Thiruvalluvan M. G.

        Activity

        Hide
        thiru_mg Thiruvalluvan M. G. added a comment -

        Since the change is only to the <pluginManagement> Maven when invoked from command line ignores it. The changes affect only when Eclipse is used. Otherwise it is a no-op.

        Show
        thiru_mg Thiruvalluvan M. G. added a comment - Since the change is only to the <pluginManagement> Maven when invoked from command line ignores it. The changes affect only when Eclipse is used. Otherwise it is a no-op.
        Hide
        mpercy Mike Percy added a comment -

        Thiruvalluvan M. G.: Thanks for the patch!

        So does this make the Eclipse build after M2E import work for you out of the box? I don't normally use Eclipse but I tried importing the module with this patch and it cannot find the classes that are generated by avro-maven-plugin. I wonder if this is sufficient. Maybe I am missing some M2E connector or something?

        I see a bunch of the following build errors in Eclipse when I import Flume with this patch:

        AvroFlumeEvent cannot be resolved to a type
        AvroSourceProtocol cannot be resolved to a type
        Callback cannot be resolved to a type
        FlumeOGEventAvroServer cannot be resolved to a type
        Priority cannot be resolved to a type
        Status cannot be resolved to a type

        Show
        mpercy Mike Percy added a comment - Thiruvalluvan M. G. : Thanks for the patch! So does this make the Eclipse build after M2E import work for you out of the box? I don't normally use Eclipse but I tried importing the module with this patch and it cannot find the classes that are generated by avro-maven-plugin. I wonder if this is sufficient. Maybe I am missing some M2E connector or something? I see a bunch of the following build errors in Eclipse when I import Flume with this patch: AvroFlumeEvent cannot be resolved to a type AvroSourceProtocol cannot be resolved to a type Callback cannot be resolved to a type FlumeOGEventAvroServer cannot be resolved to a type Priority cannot be resolved to a type Status cannot be resolved to a type
        Hide
        thiru_mg Thiruvalluvan M. G. added a comment -

        You have to manually add the source folder(s) for generated classes to the project. I'm sorry I missed to document it.

        To do this, for each (sub) project in the project preferences (or properties in some platforms), select "Java Build Path" and within that "Source" tab. Then click on the "Add folder" and add the folder where the code is generated, which is invariably a folder under "target/generated-sources". This needs to be done once for the workspace. After this you can delete the projects from the workspace and reimport any number of times. You don't have to repeat this step.

        The reason why this cannot be automated is this: Maven plugins that generate code automatically add the directory where the code is generated to the source path in to the in-memory Project option. That is, the in-memory version of POM gets modified on the fly in the "generate-sources" phase, which gets used in the later phases. But, M2e looks at the static pom.xml and imports the source paths. So the dynamic folders do not show up there.

        Show
        thiru_mg Thiruvalluvan M. G. added a comment - You have to manually add the source folder(s) for generated classes to the project. I'm sorry I missed to document it. To do this, for each (sub) project in the project preferences (or properties in some platforms), select "Java Build Path" and within that "Source" tab. Then click on the "Add folder" and add the folder where the code is generated, which is invariably a folder under "target/generated-sources". This needs to be done once for the workspace. After this you can delete the projects from the workspace and reimport any number of times. You don't have to repeat this step. The reason why this cannot be automated is this: Maven plugins that generate code automatically add the directory where the code is generated to the source path in to the in-memory Project option. That is, the in-memory version of POM gets modified on the fly in the "generate-sources" phase, which gets used in the later phases. But, M2e looks at the static pom.xml and imports the source paths. So the dynamic folders do not show up there.
        Hide
        thiru_mg Thiruvalluvan M. G. added a comment -

        Is it possible for someone to review this?

        Thanks

        Thiru

        Show
        thiru_mg Thiruvalluvan M. G. added a comment - Is it possible for someone to review this? Thanks Thiru
        Hide
        ejsarge Edward Sargisson added a comment -

        I think you should get rid of the open-ended version spec [1.2,) as it occasionally screws things up by bringing in snapshots or non-working code. Otherwise, to my eyes, it looks good.

        Show
        ejsarge Edward Sargisson added a comment - I think you should get rid of the open-ended version spec [1.2,) as it occasionally screws things up by bringing in snapshots or non-working code. Otherwise, to my eyes, it looks good.
        Hide
        thiru_mg Thiruvalluvan M. G. added a comment -

        I think you should get rid of the open-ended version spec [1.2,) as it occasionally screws things up by bringing in snapshots or non-working code

        Thanks for looking at it.

        It does not introduce a dependency. It is in the <pluginManagement> and is in the configuration for the plugin me2. That is, it is not the version range for the plugin itself; The consumer of the version range is not Maven but rather me2. What it says is something like this: "If you use paranamer plugin version 1.7 or above (the actual version is specified in the plugins section againt paranamer plugin) m2e should ignore the plugin when importing this project into Eclipse".

        In fact, m2e plugin encourages use of version ranges instead of version for its argument; there is no "version" parameter, there is only "versionRange" parameter.

        As I mentioned earlier, the entire change of this patch is a no-op everywhere outside Eclipse.

        Show
        thiru_mg Thiruvalluvan M. G. added a comment - I think you should get rid of the open-ended version spec [1.2,) as it occasionally screws things up by bringing in snapshots or non-working code Thanks for looking at it. It does not introduce a dependency. It is in the <pluginManagement> and is in the configuration for the plugin me2. That is, it is not the version range for the plugin itself; The consumer of the version range is not Maven but rather me2. What it says is something like this: "If you use paranamer plugin version 1.7 or above (the actual version is specified in the plugins section againt paranamer plugin) m2e should ignore the plugin when importing this project into Eclipse". In fact, m2e plugin encourages use of version ranges instead of version for its argument; there is no "version" parameter, there is only "versionRange" parameter. As I mentioned earlier, the entire change of this patch is a no-op everywhere outside Eclipse.
        Hide
        hshreedharan Hari Shreedharan added a comment -

        +1. Generates the code, on adding the directory - it works fine.

        Show
        hshreedharan Hari Shreedharan added a comment - +1. Generates the code, on adding the directory - it works fine.
        Hide
        hshreedharan Hari Shreedharan added a comment -

        Patch committed, rev: 3efb93f280d603aee4bbcf23ee130826af1c213c. Thanks Thiruvalluvan!

        Show
        hshreedharan Hari Shreedharan added a comment - Patch committed, rev: 3efb93f280d603aee4bbcf23ee130826af1c213c. Thanks Thiruvalluvan!
        Hide
        hudson Hudson added a comment -

        Integrated in flume-trunk #406 (See https://builds.apache.org/job/flume-trunk/406/)
        FLUME-2009. Flume project throws error when imported into Eclipse IDE (Revision 3efb93f280d603aee4bbcf23ee130826af1c213c)

        Result = UNSTABLE
        hshreedharan : http://git-wip-us.apache.org/repos/asf/flume/repo?p=flume.git&a=commit&h=3efb93f280d603aee4bbcf23ee130826af1c213c
        Files :

        • flume-ng-sdk/pom.xml
        • flume-ng-legacy-sources/flume-avro-source/pom.xml
        • flume-ng-core/pom.xml
        Show
        hudson Hudson added a comment - Integrated in flume-trunk #406 (See https://builds.apache.org/job/flume-trunk/406/ ) FLUME-2009 . Flume project throws error when imported into Eclipse IDE (Revision 3efb93f280d603aee4bbcf23ee130826af1c213c) Result = UNSTABLE hshreedharan : http://git-wip-us.apache.org/repos/asf/flume/repo?p=flume.git&a=commit&h=3efb93f280d603aee4bbcf23ee130826af1c213c Files : flume-ng-sdk/pom.xml flume-ng-legacy-sources/flume-avro-source/pom.xml flume-ng-core/pom.xml

          People

          • Assignee:
            thiru_mg Thiruvalluvan M. G.
            Reporter:
            thiru_mg Thiruvalluvan M. G.
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development