我正在使用 maven 的 launch4j 插件从现有 jar 构建 .exe 文件。 我想创建 .exe 文件,该文件将自动需要管理员角色才能运行它。可以通过插件来实现吗?我无法找到一些信息是否确实可以通过 launch4j maven 插件实现。
谢谢, 安德烈
最佳答案
似乎需要使用 list 文件,其中指定由 maven4j 插件构建的这个 .exe 文件应该需要管理员角色才能打开它。就 launch4j 插件而言,这意味着添加特殊标签,其中应指定 list 文件的路径
所以配置如下:
<configuration>
<headerType>gui</headerType>
<outfile>target/${maser.app.jar.name}64.exe</outfile>
<jar>target/${maser.app.jar.name}.jar</jar>
<manifest>src/main/resources/${maser.app.jar.name}64.exe.manifest</manifest>
<jre>
<path>bin/${jre64.path}/</path>
<opts>
<opt>-Djava.library.path="dll"</opt>
</opts>
</jre>
<versionInfo>
...
</versionInfo>
</configuration>
list 文件如下所示:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
关于java - launch4j maven 插件 - 配置 .exe 以需要管理员角色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38750826/