How to customize a Module Repository archive

A module repository is a module that bundles a set of modules in a portable ZIP file, see: Module Repository — MicroEJ Documentation.

The content of the portable ZIP file can be customized to add files such as a Changelog, Readme, …

The Module Repository project needs to be updated as follows:

  • Create a module.ant file at the root of the module project,
  • Add the following code inside module.ant, add in the includeFilesInZip target the files that should be included in the ZIP archive:
    <project name="repo-custom" xmlns:ea="antlib:org.apache.easyant">
    
    	<ea:plugin module="phases-std" revision="0.9" />
    
    	<dirname file="${ant.file.repo-custom}" property="ant.dir.repo-custom"/>
    
    	<target name="includeFilesInZip" depends="-artifact-repository:check-base-repository-exists" extensionOf="compile">
    		<copy file="${ant.dir.repo-custom}/CHANGELOG.md" todir="${bar.merged.artifacts.repository.dir}" overwrite="true"/>
    		<copy file="${ant.dir.repo-custom}/LICENSE.txt" todir="${bar.merged.artifacts.repository.dir}" overwrite="true"/>
    		<copy file="${ant.dir.repo-custom}/README.md" todir="${bar.merged.artifacts.repository.dir}" overwrite="true"/>
    	</target>
    
    </project>
    
  • Note:
    • ${bar.merged.artifacts.repository.dir} is the root of the module repository before zipping.
    • ${ant.dir.repo-custom} points to the root of module repository projects.

Alex for MicroEJ