1

我正在寻找一种方法来将我的“构建者”条目设置为MANIFEST.MF与我的用户名不同的东西。我可以在构建时使用,-Duser.name=<whatIwant>但我想让它默认为我的系统用户名之外的其他内容。我也不想在我的项目中这样做,因为我们在一个团队中工作,我相信每个人都不想成为我。

我也尝试将它设置在我的.m2/settings.xml但由于某种原因我无法正确读取它。我创建了一个名为 work 的配置文件,<properties><user.name>whatIWant</user.name></properties>但它仍然使用系统名称(是的,我记得将 work 设置为始终处于活动状态)。

谢谢

4

2 回答 2

2

像这样设置它:

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.3.1</version>
        <configuration>
            ...
                <manifestEntries>
                        <Built-By>${your.builtby.variable}</Built-By>
                </manifestEntries>
            </archive>
        </configuration>
        ...
    </plugin>
于 2012-08-16T13:37:44.510 回答
0

I have same problem here (add system properties in setting.xml does not work) but the bottom line is I cannot update the pom.xml file, so above answer does not work for me.

Very simple solution is to add this variable to JAVA_TOOL_OPTIONS system environment. For any java command, this variable will be included.

Linux

export JAVA_TOOL_OPTIONS="-Duser.name=whatIWant"

Window

set JAVA_TOOL_OPTIONS="-Duser.name=whatIWant"

You may want to set this permanently (in .bashrc or window system env)

Hope this help for others.

于 2018-06-12T05:06:43.230 回答