Question

When building a jnlp with the maven-webstart-plugin, I found that the runtime dependencies weren't being included in the jnlp.

I'm using a template like this:

<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="$jnlpspec" codebase="${url}/${appName}" href="${outputFile}">
    <information>
        <title>${appName}</title>
        <vendor>$project.Organization.Name</vendor>
        <homepage href="${url}/${appName}"/>
        <offline-allowed/>
    </information>
    <security>
        <all-permissions/>
    </security>
    <resources>
        <j2se version="$j2seVersion"/>
        $dependencies
    </resources>
    <application-desc main-class="${main}" />
</jnlp>

How can I include the runtime dependencies? Well, I can include them all individually:

<plugin>
    <groupId>org.codehaus.mojo.webstart</groupId>
    <artifactId>webstart-maven-plugin</artifactId>
    <configuration>
      <dependencies>
        <includes>
          <include>groupId:artifactId</include>
          ...
        </includes>
      </dependencies>
      ...
    </configuration>
  </plugin>

...but ideally, I don't want to have to remember to change this every time I add a runtime dependency to my project.

Is there a way to instruct the plugin to include all runtime dependencies?

Était-ce utile?

La solution

So it turns out that the default is to include all compile and runtime dependencies.

What was going on?

Well, I'm also using ant to deploy the jnlp onto a server, and in the ant file, $dependencies was being set using mvn:dependencies without the scope being specified as runtime. So adding the scope changes the $dependencies fileset which is incorporated into the jnlp file.

Autres conseils

I use a parent pom configuration where one of the modules is the web start project. I like to keep this as minimal as possible. I have compile dependencies only to a logging library, the main application module (another module in the same parent pom structure), and jar files including native binaries. In addition to these compile dependencies, I have some test dependencies and a system dependency to a local javaws.jar file.

It seems that the maven webstart plugin includes any runtime dependencies from modules which is included to the web start project as a compile dependency. It might be a solution for you to split up your project in a similar manner.

Regarding the native binaries. I had to modify the velocity template somewhat to get these dependencies as nativelib instead of jar resources.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top