zDev - M2E - OSS
  1. zDev - M2E - OSS
  2. MNGECLIPSE-1061

Support for defining properties for runtime environment of builds launched from M2Eclipse

    Details

    • Type: User Story User Story
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 0.9.6
    • Fix Version/s: None
    • Component/s: Maven Launcher
    • Labels:
      None
    • Global Rank:
      1313

      Description

      It would be very useful to provide configurability for the Maven Project Builder with an UI (currently, when clicking on Maven Project Builder in the project's Builders, one can see that the "Edit" button is disabled). It should let the user configure the goals run when the project build is invoked and more importantly, setting of runtime properties.

      E.g. ability to set maven.test.skip to true (http://maven.apache.org/plugins/maven-surefire-plugin/examples/skipping-test.html) would be very useful in M2Eclipse since errors triggered by tests are likely to interrupt the build.

      Currently this can be worked around by providing a separate settings.xml in M2Eclipse configuration, and in that settings.xml creating a different default profile that has the needed properties set. This is very obscure and labour intensive, though.

        Activity

        Hide
        Eugene Kuleshov added a comment -

        Aleksander, Maven builder does not really run tests, unless you explicitly specify "test" (or corresponding surefire plugin goal) in the Maven preference page for given project, so I don't quite understand the issue.

        On the other hand, you already can specify custom properties, as well as skip tests when launching maven using "Run as.../Maven" shortcut.

        Show
        Eugene Kuleshov added a comment - Aleksander, Maven builder does not really run tests, unless you explicitly specify "test" (or corresponding surefire plugin goal) in the Maven preference page for given project, so I don't quite understand the issue. On the other hand, you already can specify custom properties, as well as skip tests when launching maven using "Run as.../Maven" shortcut.
        Hide
        Aleksander Adamowski added a comment -

        What about the phase "process-test-resources"? I have a plugin execution bound to that phase and that plugin gets executed by M2Eclipse when it automatically decides to build the project (e.g. when I save changes to a pom.xml). I didn't explicitly list it in the Maven preference page.

        The "Run as... Maven" shortcut might be useful for a workaround, but it seems M2Eclipse still launches its own hardcoded build when e.g. a pom.xml is saved or dependency added to a module.

        Show
        Aleksander Adamowski added a comment - What about the phase "process-test-resources"? I have a plugin execution bound to that phase and that plugin gets executed by M2Eclipse when it automatically decides to build the project (e.g. when I save changes to a pom.xml). I didn't explicitly list it in the Maven preference page. The "Run as... Maven" shortcut might be useful for a workaround, but it seems M2Eclipse still launches its own hardcoded build when e.g. a pom.xml is saved or dependency added to a module.
        Hide
        Aleksander Adamowski added a comment -

        Also, the "maven.test.skip" is just an example for how useful it would be to be able to define arbitrary properties for Maven builds.

        It could be used for numerous other tasks, like parameterizing builds etc.

        Show
        Aleksander Adamowski added a comment - Also, the "maven.test.skip" is just an example for how useful it would be to be able to define arbitrary properties for Maven builds. It could be used for numerous other tasks, like parameterizing builds etc.
        Hide
        Eugene Kuleshov added a comment -

        What about "process-test-resources"? That phase runs before running tests, so example with "maven.test.skip" is not relevant. Basically Maven builder is not supposed to run tests, unless you specify goals like test or package in the project properties.

        As a workaround you can put your property declaration into profile and activate such profile in project settings or in Maven launch config used by Run as... / Maven.

        Right now m2eclipse does not allow to specify activation for a global profiles (need separate jira for that), but you can activate one declared in settings.xml based on the presence of some system property, which you could put into eclipse.ini

        Show
        Eugene Kuleshov added a comment - What about "process-test-resources"? That phase runs before running tests, so example with "maven.test.skip" is not relevant. Basically Maven builder is not supposed to run tests, unless you specify goals like test or package in the project properties. As a workaround you can put your property declaration into profile and activate such profile in project settings or in Maven launch config used by Run as... / Maven. Right now m2eclipse does not allow to specify activation for a global profiles (need separate jira for that), but you can activate one declared in settings.xml based on the presence of some system property, which you could put into eclipse.ini
        Hide
        Aleksander Adamowski added a comment -

        > Basically Maven builder is not supposed to run tests, unless you specify goals like test or package in the project properties.

        Actually I did some more digging and found out that by default M2Eclipse has the phase "process-test-resources" specified by default in project properties in "Maven" > "Maven project configuration" > "Goals to invoke after project clean".

        I've solved my specific problem by changing it to "generate-test-resources" in that particular project.

        However, I suggest leaving this bug open as the generic ability to define properties for the standard maven build would have lots of potential uses.

        Show
        Aleksander Adamowski added a comment - > Basically Maven builder is not supposed to run tests, unless you specify goals like test or package in the project properties. Actually I did some more digging and found out that by default M2Eclipse has the phase "process-test-resources" specified by default in project properties in "Maven" > "Maven project configuration" > "Goals to invoke after project clean". I've solved my specific problem by changing it to "generate-test-resources" in that particular project. However, I suggest leaving this bug open as the generic ability to define properties for the standard maven build would have lots of potential uses.

          People

          • Assignee:
            Unassigned
            Reporter:
            Aleksander Adamowski
            Last Updated By:
            Brian Fox
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Date of First Response: