问题描述
可以将文件添加到使用Maven/Tycho构建的产品分发档案中:查看此链接
Adding a file to a product distribution archive built with Maven/Tycho is possible:see this link
但是如何将动态选择的文件添加到存档中?例如,这可能是一个数据文件.
But how can I add a dynamically chosen file to my archive? For example this could be a data file.
推荐答案
您链接的文章涉及如何从产品分发档案中删除文件,这可能会非常具有挑战性.将文件添加到分发归档文件要简单得多,并且不需要本文中介绍的任何低级p2黑客攻击.
The article you linked deals with removing files from a product distribution archive, which can be quite challenging. Adding files to a distribution archive is a lot simpler, and doesn't require any of the low-level p2 hacking described in the article.
为了将文件添加到产品分发档案,请将其作为根文件添加到产品所包含的功能之一中:
In order to add a file to a product distribution archive, include add it as as root files to one of the features included in your product:
- 在功能部件构建的
build.properties
中,添加一行root = file:target/rootfiles/**
- 在功能部件构建的pom.xml中添加目标,以便在构建期间将要包含在分发存档中的文件复制/添加到
target/rootfiles
文件夹中.例如. maven-resources-plugin 或 maven-dependency-plugin 可以做到这一点.
- In the
build.properties
of the feature build, add a lineroot=file:target/rootfiles/**
- Add goals in the pom.xml of the feature build so that the file(s) you want to have included in the distribution archive are copied/added to the
target/rootfiles
folder during the build. E.g. the maven-resources-plugin or the maven-dependency-plugin could do this.
将具有根文件配置的功能添加到产品中后,您放入 target/rootfiles
中的文件将最终存储在产品分发档案中.
When the feature with the root files configuration is added to the product, the files you have put into target/rootfiles
will end up in the product distribution archive.
如果对此有疑问,还可以看看此示例项目.
In case you have problems with this, you also may have a look at this example project.
这篇关于动态将文件添加到由Tycho构建的产品档案中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!