【问题标题】:Compiler or runtime Install4J properties/variables编译器或运行时 Install4J 属性/变量
【发布时间】:2017-10-20 10:10:25
【问题描述】:

作为评估的一部分,将此查询也放在这里,以防其他人也发现了问题并解决了问题。

我的问题是如何在运行maven 构建时从命令行将参数传递给install4jc 编译器,例如我现在有这样的事情:

mvn clean package -Dinstall4j.home=$INSTALL4J_HOME -Dinstall4j.compiler=$INSTALL4J_COMPILER -Dxxxx.install4j.project.file=$XXXXX_INSTALL4J_PROJECT_FILE

但我得到了这个错误:

[INFO] Loading config file
/path/to/installer-file
[INFO] install4j: compilation failed. Reason:
null------------------------------------------------------------------------------

[INFO]
[INFO] The private key is encrypted. To avoid manual intervention, set
the
[INFO] "--mac-keystore-password" command line option or the
[INFO]
"macKeystorePassword" ant task attribute.
[INFO]
------------------------------------------------------------------------------
[INFO]
Enter the password for the macOS key store:
[INFO]
------------------------------------------------------------------------
[INFO]
BUILD FAILURE

我更关心通过 maven 传递密码,我知道如何使用 -D 选项通过 install4jc 命令行传递密码。

是否有可以传递此密码的compiler.runtime. 属性(请参阅https://resources.ej-technologies.com/install4j/help/doc/steps/general/variables.html)。 windows keystore password 同样适用。

【问题讨论】:

  • 我猜你正在使用来自sonatype 的maven 插件,是吗?在那里,您可以在配置部分预定义 maven 插件的属性,并通过命令行覆盖属性以使用-Dinstall4j.winKeystorePassword=xyz 进行开发或安全目的。

标签: windows macos maven command-line install4j


【解决方案1】:

您可以为此任务使用 Maven-Profiles。

假设你想使用属性“Hokus.Pokus”,你可以在你的

中定义一个配置文件
~/.m2/settings.xml

如下:

    <profile>
        <id>MagicSecret</id>
        <properties>
            <Hokus.Pokus>Secret</Hokus.Pokus>
        </properties>
    </profile>

您需要将此部分放在“部分”下

 <profiles>

现在您需要在运行项目时激活此配置文件

mvn -PMagicSecret clean validate compile package ...

这样您就可以在 pom.xml 项目中的任何地方使用该属性。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-05
    • 2021-01-25
    • 2014-04-11
    • 1970-01-01
    • 2019-01-22
    • 1970-01-01
    相关资源
    最近更新 更多