Announcement Announcement Module
No announcement yet.
Resource Files are not picked up on Gradle Based projects Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Resource Files are not picked up on Gradle Based projects

    When STS creates a .classpath file on a Gradle project, the following entries are created (in the following order),
    <classpathentry excluding="**" kind="src" output="build/resources/main" path="src/main/resources"/>
    <!-- Additional entries skipped -->
    <classpathentry excluding="**" kind="src" output="build/resources/test" path="src/test/resources"/>

    1) All actual resources (such as XML & .properties files) are excluded from the build and are unavailable for tests
    2) Resource files in Test could be overridden by resource files in the main path.

    Version of STS: 2.9.1.

    Should I open an issue in JIRA?

  • #2
    Forgot to add the workaround!
    Modify the .classpath file as follows:
    1) move the src/test/resources in front of the src/main/resources element.
    2) Remove the 'excluding="**"' from both resource elements.


    • #3
      Sorry for the late reply.

      > Should I open an issue in JIRA?

      Probably. It is possibly a bug in STS gradle support.

      Since there are a bunch of different ways to create / import projects into STS (e.g. many options in the import wizard), it is important to provide some very precise instructions on how to reproduce the problem. Ideally, provide a small sample project and exact step-by-step instructions on how to get this project into the workspace so that the problem happens.

      If you think you are able and willing to provide this amount of detail... Please *do* raise a Jira issue and I will be happy to track down the origin of the problem and fix it if is is indeed an STS problem.