How to set name of author in a maven project?
Asked Answered
C

2

13

packaged maven project contains META-INF/manifest.mf file and in field "Built-by" is login name of current user. Where or what to set name of author, so maven will use this instead of login name?

Chinoiserie answered 9/6, 2010 at 9:1 Comment(1)
+1 (mostly for choosing the name chupacabras ) :-)Plaster
D
13

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>
Demagogue answered 30/9, 2014 at 2:42 Comment(0)
S
9

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).

Speleology answered 18/6, 2013 at 19:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.