5

I have a single configuration file which I would like to include as a dependency in a maven pom.xml. I want to keep around several versions of this, and have it appear in the classpath. I realize I could wrap it in a jar, but others in my team would like to easily inspect its contents. Looking at the types allowed in the pom.xml, I only see things like pom, jar, war, ear, ... Basically just archives of some sort. So I'm wondering what the pom.xml might look like to package a single file. I would imaging the maven artifacts on inspecting the server to be something like

myconfig-0.0.1.cfg
myconfig-0.0.1.cfg.md5
myconfig-0.0.1.cfg.sha1
myconfig-0.0.1.pom
myconfig-0.0.1.pom.md5
myconfig-0.0.1.pom.sha1

So is this possible? What would the pom.xml look like?

Robert Munteanu
  • 67,031
  • 36
  • 206
  • 278
Nym
  • 126
  • 1
  • 6

2 Answers2

3

I would wrap the configuration file in a jar and use the Dependency plugin to dependency:unpack the jar during the generate-resources phase (see the Unpacking specific artifacts example). This would allow to version it easily, to add it as dependency easily, and to inspect it easily.

Pascal Thivent
  • 562,542
  • 136
  • 1,062
  • 1,124
1

See this discussion, specifically on using the maven-install plugin to define an installable artifact:

https://stackoverflow.com/a/4245890/2491903

Community
  • 1
  • 1