Pat McG
Pat McG

Reputation: 706

How can I get Maven to produce a single text file as its artifact?

I have a small Maven project whose only purpose is to generate a single text file. It reads some input and generates an SQL script. I want to keep that SQL script as the only artifact produced by the Maven project.

Using the maven-assembly-plugin, the project is now producing a zip file containing the SQL script. Ideally, I would like to keep only the script itself as the artifact instead of having to wrap it inside a zip file. The zip archiving is unnecesssary in this case since there is only one small file. Plus I'd like to be able to open the SQL script in Jenkins from the browser.

Is there a way to produce a single, flat file as a Maven artifact, for example db-update-2.0.1.0-20130711.151737-24.sql?

Upvotes: 2

Views: 1335

Answers (1)

Robert Scholte
Robert Scholte

Reputation: 12345

If you want this to be the main-artifact, you need to have a packaging type for sql. That would mean defining a lifecycle for this packaging type, etc. so probably a bit too much for 1 simple file. The simple solution would be to use packaging type 'pom' and use the attach-artifact goal to attach it. And yes, that means you'll have to specify a classifier. This guide explains how to configure your pom.xml.

Upvotes: 3

Related Questions