Maven plugin for winsw.
WinSW is an executable binary, which can be used to wrap and manage a custom process as a Windows service.
The Maven plugin for WinSW lets you download the WinSW executable and generate XML configuration file as part of the Maven build process.
Using the Maven plugin, you specify the WinSW configuration in your POM. The format of this configuration is very similar to the standard WinSW XML format.
<configurationFile>
<id>myapp</id>
<name>My App</name>
<description>My App Description</description>
<executable>java</executable>
<arguments>-jar ${build.finalName}.jar</arguments>
</configurationFile>
WinSW plugin also provides the ability to modify file information and add an icon.
<rcFile>
<icon>myapp.ico</icon>
<fileInfo>
<fileVersion>1.2.3.4</fileVersion>
<productVersion>1.2.3.4</productVersion>
<comments>My App Description</comments>
<companyName>John Doe</companyName>
<copyright>© 2019 John Doe All Rights Reserved</copyright>
</fileInfo>
</rcFile>
As an example, you can use the following
<plugin>
<groupId>com.github.nikolaybespalov</groupId>
<artifactId>winsw-maven-plugin</artifactId>
<version>${winsw.maven.plugin.version}</version>
<executions>
<execution>
<id>process-winsw-stuff</id>
<phase>prepare-package</phase>
<goals>
<goal>winsw</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
<winswVersion>2.9.0</winswVersion>
<!-- you can also provide a classifier for net4 and other builds, default is bin <winswClassifier>net4</winswClassifier> -->
<!-- or use exists WinSW Executable File <executableFilePath>...</executableFilePath> -->
<executableFileName>${project.build.finalName}.exe</executableFileName>
<configurationFileName>${project.build.finalName}.xml</configurationFileName>
<configurationFile>
<id>${project.artifactId}</id>
<name>${project.name}</name>
<description>${project.description}</description>
<executable>java</executable>
<arguments>-jar ${build.finalName}.jar</arguments>
</configurationFile>
<!-- or use exists WinSW Configuration File <configurationFilePath>...</configurationFilePath> -->
<rcFile>
<icon>${project.basedir}/${project.name}.ico</icon>
<fileInfo>
<fileVersion>${project.version}</fileVersion>
<productVersion>${project.version}</productVersion>
<comments>${project.description}</comments>
<companyName>${organization.name}</companyName>
<copyright>© ${inceptionYear} ${organization.name} All Rights Reserved</copyright>
</fileInfo>
</rcFile>
</configuration>
</execution>
</executions>
</plugin>
If you have any questions, please register a ticket!
Enjoy!