Skip to content

Groovy main/test folders not added as source folders #191

@reckart

Description

@reckart

I have been using a maven-build-helper-based approach to add src/main/groovy and src/test/groovy to Eclipse-based builds since a long time. Now suddenly that does not work anymore.

I strongly suspect the fix for #186 to be the cause of this problem.

Here is the configuration that I use in the POM:

  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.12</version>
        <executions>
          <execution>
            <id>add-source</id>
            <phase>process-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>src/main/groovy</source>
              </sources>
            </configuration>
          </execution>
          <execution>
            <id>add-test-source</id>
            <phase>generate-test-sources</phase>
            <goals>
              <goal>add-test-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>src/test/groovy</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

I can see that the paths are added in the m2e log:

8/2/16, 2:04:52 PM GMT+2: [INFO] Update started
8/2/16, 2:04:52 PM GMT+2: [INFO] Using org.eclipse.m2e.jdt.JarLifecycleMapping lifecycle mapping for MavenProject: PROJECT:SUBMODULE:0.0.1-SNAPSHOT @ /ABSOLUTE-PATH/SUBMODULE/pom.xml.
8/2/16, 2:04:53 PM GMT+2: [INFO] Source directory: /ABSOLUTE-PATH/SUBMODULE/src/main/groovy added.
8/2/16, 2:04:53 PM GMT+2: [INFO] Test Source directory: /ABSOLUTE-PATH/SUBMODULE/src/test/groovy added.
8/2/16, 2:04:53 PM GMT+2: [INFO] Adding source folder /SUBMODULE/src/main/java
8/2/16, 2:04:53 PM GMT+2: [INFO] Adding source folder /SUBMODULE/src/main/groovy
8/2/16, 2:04:53 PM GMT+2: [INFO] Adding resource folder /SUBMODULE/src/main/resources
8/2/16, 2:04:53 PM GMT+2: [INFO] Adding source folder /SUBMODULE/src/test/java
8/2/16, 2:04:53 PM GMT+2: [INFO] Adding source folder /SUBMODULE/src/test/groovy
8/2/16, 2:04:53 PM GMT+2: [INFO] Adding resource folder /SUBMODULE/src/test/resources
8/2/16, 2:04:53 PM GMT+2: [INFO] Update completed: 1 sec
8/2/16, 2:04:53 PM GMT+2: [INFO] Source directory: /ABSOLUTE-PATH/SUBMODULE/src/main/groovy added.
8/2/16, 2:04:53 PM GMT+2: [INFO] Using 'UTF-8' encoding to copy filtered resources.
8/2/16, 2:04:53 PM GMT+2: [INFO] Copying 0 resource
8/2/16, 2:04:53 PM GMT+2: [INFO] Using 'UTF-8' encoding to copy filtered resources.
8/2/16, 2:04:53 PM GMT+2: [INFO] Copying 5 resources
8/2/16, 2:04:53 PM GMT+2: [INFO] Test Source directory: /ABSOLUTE-PATH/SUBMODULE/src/test/groovy added.
8/2/16, 2:04:53 PM GMT+2: [INFO] Using 'UTF-8' encoding to copy filtered resources.
8/2/16, 2:04:53 PM GMT+2: [INFO] Copying 6 resources

Even if I add the folders manually as source folders, this is undone the next time I update the project or make a change to the POM. Adding any other folder this way, e.g. src/main/lala works without any problem.

Update: The problem seems to affect only nested Groovy project in a multi-module build. Looks like the logic that checks if groovy source folders exists may have problem with nested modules.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions