Arjit
Arjit

Reputation: 565

Splash screen in Java maven project

I am trying to get a splash screen in my project. In eclipses I have found a solution to put VM arguments -splash:src/main/resources/images/cover.png But where do i put this arguments while running a project through maven command line.

Upvotes: 3

Views: 2832

Answers (2)

Moose Morals
Moose Morals

Reputation: 1648

Use the maven-jar-plugin to add the splash screen to your manifest:

<build>
  ...
  <plugins>
    ...
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-jar-plugin</artifactId>
      <version>2.6</version>
      <configuration>
        <archive>
          <manifestEntries>
            <SplashScreen-Image>images/cover.png</SplashScreen-Image>
          </manifestEntries>
        </archive>
      </configuration>
    </plugin>
    ...
  </plugins>
  ...
</build>

Upvotes: 5

Hauke Ingmar Schmidt
Hauke Ingmar Schmidt

Reputation: 11607

exec:java runs the application in the same Java process as Maven so a JVM splash screen is not possible.

If you use exec:exec you can start a separate Java process and provide arguments to this in the plugin configuration, e.g.:

<build><plugins>
<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <configuration>
        <executable>java</executable>
        <arguments>
            <argument>-splash:src/main/resources/images/cover.png</argument>
            <argument>-classpath</argument>
            <classpath />
            <argument>com.company.MainClass</argument>
        </arguments>
    </configuration>
</plugin>
</plugins></build>

Upvotes: 1

Related Questions