【问题标题】:Can I package a single text file as a text file in a maven repo?我可以将单个文本文件打包为 Maven 存储库中的文本文件吗?
【发布时间】:2010-03-26 20:58:44
【问题描述】:

我有一个配置文件,我想将其作为依赖项包含在 maven pom.xml 中。我想保留几个版本,并让它出现在类路径中。我意识到我可以把它包在一个罐子里,但我团队中的其他人想轻松检查它的内容。查看 pom.xml 中允许的类型,我只看到诸如 pom、jar、war、ear 之类的东西……基本上只是某种档案。所以我想知道 pom.xml 打包单个文件会是什么样子。我会在检查服务器时将 maven 工件成像为类似

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

那么这可能吗? pom.xml 会是什么样子?

【问题讨论】:

    标签: maven-2 maven-plugin


    【解决方案1】:

    我会将配置文件包装在一个 jar 中,并在 generate-resources 阶段使用Dependency 插件来dependency:unpack jar(请参阅@987654323 @ 例子)。这将允许轻松对其进行版本控制,轻松将其添加为依赖项,并轻松检查它。

    【讨论】:

      【解决方案2】:

      查看此讨论,特别是关于使用 maven-install 插件定义可安装工件:

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2021-08-19
        • 2023-03-10
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多