Quantcast

copy resources in source dir to buildDir

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

copy resources in source dir to buildDir

Juergen Donnerstag
Hi,

I'm trying to migrate an existing (maven) app to gradle and it's my
first experience with gradle. It's probably an easy question (sorry
for that).

We have *.txt files next to our sources (*.java) and we need these
*.txt files in our output folder (next to *.classes). Not only in the
jar. And that is because we need the txt files for junit tests as
well. By default gradle doesn't seem to copy these files. Any hint or
example how to achieve it?

-Juergen

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: copy resources in source dir to buildDir

Wolfgang Schell
Hi Jürgen,

you'll probably want to try the Groovy or Gradle user lists.

Anyway, Gradle uses the same layout as Maven, where resource files are placed in src/main/resources, not src/main/resources. So you can either move all resource files (i.e. your *.txt files) to src/main/resources or add the following snippet to your build.gradle, which tells Gradle to look for resources in your main source directory:

sourceSets {
    main {
        resources {
            srcDir 'src/main/java'
        }
    }
}


HTH,

Wolfgang
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: copy resources in source dir to buildDir

Wolfgang Schell
Wolfgang Schell wrote
where resource files are placed in src/main/resources, not src/main/resources.
That should read where resource files are placed in src/main/resources, not src/main/java.
Loading...