Maven plugin and resources


(Timo Mika Gläßer) #1

Maven-plugin does not seem to package src/main/resources into the created jar with the latest gradle-1.0 M6. can anybody help?


(Peter Niederwieser) #2

The Maven plugin isn’t involved here; it’s only needed for publishing to Maven repositories.

Can you be more specific about your problem? Can you show your build script or provide a sample project? Did you do a clean build after switching to M6? It’s most certainly not a general problem but something specific to your situation.


(Timo Mika Gläßer) #3

Hey Peter, I have actually figured that one out. I had a filter in another step that kept removing files from the list to be copied. Where it was I did not assume it had an effect on the Maven build… how ever: is there a straightforward way to build a src distribution fir maven?


(Peter Niederwieser) #4

Where it was I did not assume it had an effect on the Maven build

Not sure what you mean by that. When you use Gradle, everything is built with Gradle, no matter if and where you publish it to (e.g. a Maven repo).

is there a straightforward way to build a src distribution fir maven?

You mean a source Jar? If you add a source Jar task in the usual (Gradle) way, the source Jar should be published to the Maven repo automatically.


(Timo Mika Gläßer) #5

ok, well i’ll figure it out. thanks!


(Timo Mika Gläßer) #6

i can’t close this… but i have my question resolved :slight_smile:


(Peter Niederwieser) #7

You can generate a sources Jar like so:

apply plugin: "java"
  ...
  task sourcesJar(type: Jar) {
  from sourceSets.main.java
}