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

Plugin is not picking up add-test-sources correctly from the build-helper plugin

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 0.10.2
    • Fix Version/s: None
    • Component/s: Project Configuration
    • Labels:
      None
    • Environment:
      Windows XP, Eclipse 3.5.2, Java 6 build 16, Maven 2.2.1, Build-Helper Maven Plugin v1.5, M2E Plugin v0.10.2.20100623-1649
    • Global Rank:
      819

      Description

      The plugin correctly adds the source folders to the Eclipse project when they are added via the "add-source" goal of the build-helper, i.e., this works:

      ...
      <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>build-helper-maven-plugin</artifactId>
      <version>1.5</version>
      <executions>
      <execution>
      <id>add-source</id>
      <phase>generate-sources</phase>
      <goals>
      <goal>add-source</goal>
      </goals>
      <configuration>
      <sources>
      <source>src/specs/java</source>
      </sources>
      </configuration>
      </execution>
      </executions>
      ...

      however, when adding test sources, the plugin does NOT add the source folder to the project, i.e., this doesn't work:

      ...
      <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>build-helper-maven-plugin</artifactId>
      <version>1.5</version>
      <executions>
      <execution>
      <id>add-test-source</id>
      <phase>generate-test-sources</phase>
      <goals>
      <goal>add-test-source</goal>
      </goals>
      <configuration>
      <sources>
      <source>src/specs/java</source>
      </sources>
      </configuration>
      </execution>
      </executions>
      ...

      Workarounds:

      Right now, the only workaround I have is to add the source folder manually to the Eclipse project. However, if I run "Update Project Configuration" the source folder gets removed and I have to add the folder again.

      Thanks for your help with this issue.

        Activity

        Hide
        Spencer Kormos added a comment -

        This is most likely not a bug, just a lack of understanding of the maven eclipse plugin.

        In Eclipse (I have 3.6, but should be valid for 3.5):
        1. Window -> Preferences -> Maven
        2. Under "Goals to run when updating project configuration:" change "process-resources" to "process-test-resources".

        The "process-resources" phase comes before the "generate-test-sources" phase, which is why when you refresh the project or clean it, the associated "add-test-source" goal doesn't get executed by the "build-helper" plugin.

        http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html

        If this presents a problem, an earlier maven lifecycle phase can be specified instead of "generate-test-sources" for the build-helper plugin. I've had success with "validate".

        Show
        Spencer Kormos added a comment - This is most likely not a bug, just a lack of understanding of the maven eclipse plugin. In Eclipse (I have 3.6, but should be valid for 3.5): 1. Window -> Preferences -> Maven 2. Under "Goals to run when updating project configuration:" change "process-resources" to "process-test-resources". The "process-resources" phase comes before the "generate-test-sources" phase, which is why when you refresh the project or clean it, the associated "add-test-source" goal doesn't get executed by the "build-helper" plugin. http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html If this presents a problem, an earlier maven lifecycle phase can be specified instead of "generate-test-sources" for the build-helper plugin. I've had success with "validate".
        Hide
        Camilo Gonzalez added a comment -

        Thanks for that Spencer, I wasn't aware of that option.

        I'll give it a try then.

        Show
        Camilo Gonzalez added a comment - Thanks for that Spencer, I wasn't aware of that option. I'll give it a try then.

          People

          • Assignee:
            Unassigned
            Reporter:
            Camilo Gonzalez
            Last Updated By:
            Camilo Gonzalez
          • Votes:
            4 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Date of First Response: