开发者

How to set name of author in a maven project?

开发者 https://www.devze.com 2023-01-02 15:55 出处:网络
packaged maven project contains META-INF/manifest.mf file and in field \"Built-by\" is login name of curr开发者_如何学Pythonent user.

packaged maven project contains META-INF/manifest.mf file and in field "Built-by" is login name of curr开发者_如何学Pythonent user. Where or what to set name of author, so maven will use this instead of login name?


This can be overwritten in your pom.xml by adding a manifestEntries section e.g.:

<project ...>
...
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>3.0.0</version>
        <configuration>
          <archive>
            <index>true</index>
            <manifest>
              <addClasspath>true</addClasspath>
            </manifest>
            <manifestEntries>
              <Built-By>${user.name}</Built-By>
            </manifestEntries>
          </archive>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>


When invoked from command line, the following will work:

mvn -Duser.name=<username> clean install

In NetBeans 7.4 you can set up the user name globally in the following way: Tools -> Options -> Java -> Maven, Selecting "Execution" category on the left and setting

Global Execution Options:

-Duser.name=<username>

Alternatively it can be done by setting according property in project-specific build action settings (Project Properties -> Actions -> e.g. Build project).

0

精彩评论

暂无评论...
验证码 换一张
取 消