Is it possible to pack one text file as a text file in maven repo?

I have one configuration file that I would like to include as a dependency in maven pom.xml. I want to support multiple versions of this and appear in the classpath. I understand that I can wrap it in a jar, but others on my team would like to easily check its contents. Looking at the types allowed in pom.xml, I only see things like pom, jar, war, ear, ... Mostly just archives. So I'm wondering what pom.xml might look like for packing a single file. I would visualize maven artifacts when checking the server as 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 does pom.xml look like?

+4
source share
2 answers

I would pack the configuration file into a jar and use the Dependency plugin for dependency:unpack jar during the generate-resources phase (see Example of unpacking specific artifacts ). This will make it easy to execute its version, easily add it as a dependency, and easy to check.

+3
source

See this discussion, in particular, on how to use the maven-install plugin to determine which artifact to install:

fooobar.com/questions/66720 / ...

+1
source

Source: https://habr.com/ru/post/1305258/


All Articles