How do I publish a single XSD as an artifact to a Maven repo?


(Maarten Dirkse) #1

I’d like to publish a single xsd file to a maven repository as an artifact (with accompanying pom file). Anyone have any tips on how to do that? No jars, no zips, just a pom file and an xsd. Ideally, I’d like to use the new maven-publish plugin, but can’t figure out how to apply to just a single file.


#2

You can do this easily with the new ‘maven-publish’ plugin in the latest Gradle Nightly, but not with Gradle 1.4.

In released versions, you can do this with a file artifact:

configurations {
  schema
}
artifacts {
  schema file('path-to-xsd')
}

And use ‘uploadSchema’ to upload the xsd file as a Maven module. You’ll still need to configure the ‘uploadSchema’ task: check out the chapters on artifact publishing and maven publishing in the User Guide.

Check out the chapters