2

Before redirecting me to one of the numerous other posts concerning this (like this or this), know that I have already tried that.

What I want to do is simple: I have a folder called generated-sources on the same level as src and I want maven to automatically add it to the source directories.

Here is the snippet as it can also be seen in the questions I linked above:

         <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <version>1.8</version>
            <executions>
                <execution>
                    <id>add-source</id>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>add-source</goal>
                    </goals>
                    <configuration>
                        <sources>
                            <source>generated-sources/enums/</source>
                        </sources>
                    </configuration>
                </execution>
            </executions>
        </plugin>

When I run it, it actually displays the lines

[INFO] --- build-helper-maven-plugin:1.8:add-source (add-source) @ gui ---
[INFO] Source directory: C:\development\gdg\gui\generated-sources\enums added.

Thing is, even if I do this, the source directories don't appear in the Project Explorer and I can't use them as dependencies either.

Note: I am currently using a m2e Connector Plugin and already tried using the <pluginManagement> tag. I also already reloaded the Project, yet to no avail.

I am probably just being incredibly stupid again, so thanks for any help. ~Crowley

Community
  • 1
  • 1
Crowley Astray
  • 172
  • 1
  • 14

1 Answers1

3

Try a Maven > Update Project ..., besides reloading the project.

If that doesn't help, you can always manually add sources to a project: under a project's Properties, in Java Build Path, Sources tab, use the Add Folder button to select your folder.

Radu
  • 2,022
  • 3
  • 17
  • 28
  • I can't believe that I tried this for so long and never even bothered clicking Update Project. (It works now) Thank you kindly. – Crowley Astray Jul 18 '16 at 08:06