The jasperreports-fonts-maven-plugin will process a set of TrueType and Type-1 fonts (usually of the extensions: .ttf, .TTF, .fon, .FON)
The jasperreports-fonts-maven-plugin:process-fonts goal is bound to the process-resources phase since it processes font resource files and outputs a result depending on the goal configuration.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <plugins> ... <plugin> <groupId>com.yinzara</groupId> <artifactId>jasperreports-fonts-maven-plugin</artifactId> <version>${jasperreports-fonts-maven-plugin-version}</version> <executions> <execution> <id>jasperreports-fonts-process-fonts</id> <phase>process-resources</phase> <goals> <goal>process-resources</goal> </goals> <configuration> </configuration> </execution> </executions> </plugin> ... </plugins> ... </project>
Then simply run:
mvn process-resources
and the output will be in your target folder named $project.build.finalName-fonts.jar.
You can also remove the executions element above and then execute it manually:
mvn jasperreports-fonts-maven-plugin:process-fonts
The plugin can be run standalone.
For configuration parameters see Goals
So given you'd like to package all fonts in the C:\Windows\Fonts directory
mvn com.yinzara:jasperreports-fonts-maven-plugin:process-fonts -DjarName=my-fonts -DpackageFonts=true -DsrcPath=C:\Windows\Fonts
mvn com.yinzara:jasperreports-fonts-maven-plugin:process-fonts -DjarName=my-fonts -DsrcPath=C:\Windows\Fonts +-------+ This will output a file named 'my-fonts.jar' in the 'target' folder that is ready for deployment. The "packageFonts" property is the must important. By default this is false which will cause your fonts to be referenced by their absolute path on the PC running the command. If you plan on running the Jasper library or JasperReports Server on the same PC running the command, you can omit the "deploymentPath" property otherwise you should set this to the path where you will copy all processed font files on the PC running Jasper. Setting this value to "." will assume the font files will be installed in the root of the classpath when running Jasper. If you set "packageFonts" to true, all font files will be copied into the resultant jar file and this can be installed directly on the system running Jasper. However, if you do not have rights to distribute these fonts, be careful about violating licenses. Settings.xml - plugin groups To make the plugin commands shorter, add the following element to your Maven settings.xml in your $M2_HOME/conf (Linux) or %M2_HOME%/conf (Windows) folder. +-------+ <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> ... <pluginGroups> <pluginGroup>com.yinzara</pluginGroup> </pluginGroups> ... </settings> +-------+ Then you can run: +-------+ mvn jasperreports-fonts:process-fonts ... +-------+ Ant Usage You will need to setup the <<<maven-ant-tasks>>> located at {{http://maven.apache.org/ant-tasks/examples/mvn.html}} For configuration parameters see {{{./plugin-info.html}Goals}} You can then use the following configuration in a build script: +-------+ <build> ... <target ... ... <artifact:mvn> <arg value="com.yinzara:jasperreports-fonts-maven-plugin:process-fonts"/> <arg value="-DpackageFonts=true"/> <arg value="-DsrcPath=${path.to.fonts.directory}"/> <arg value="-DoutputPath=${path.to.output.directory}"/> <arg value="-DjarName=my-fonts.jar"/> </artifact:mvn> ... </target> ... </build> +-------+