问题
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.
回答1:
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:
- 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.
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.
来源:https://stackoverflow.com/questions/17566380/dynamically-adding-a-file-to-a-product-archive-built-by-tycho