Pregunta

I have a Maven project and I have integrated the webstart-maven-plugin. The jnlp gets generated and I would like to test it by deploying it into to jetty but haven't found any jetty goals to achieve that. Is there an automated way to test the jnlp?

¿Fue útil?

Solución

I have been using webstart-maven-plugin for a while until I realized it just fills a jnlp template and copies jar files.

Now, I'm using a static jnlp (stored in src/main/webapp/applet) and maven-dependency-plugin to copy the jar(s):

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
                <execution>
                    <id>applet-copy</id>
                    <phase>process-resources</phase>
                    <goals>
                        <goal>copy</goal>
                    </goals>
                    <configuration>
                        <artifactItems>
                            <artifactItem>
                                <groupId>applet.group.id</groupId>
                                <artifactId>applet-artifact-id</artifactId>
                                <version>x.y.z</version>
                                <type>jar</type>
                                <destFileName>applet.jar</destFileName>
                            </artifactItem>
                        </artifactItems>
                        <outputDirectory>${project.build.directory}/web-resources/applet</outputDirectory>
                    </configuration>
                </execution>
            </executions>
        </plugin>

It actually copies the applet into target/web-resources/applet. Then I just need to add this directory as web resource in the jetty-maven-plugin:

        <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>8.1.9.v20130131</version>
            <configuration>
                <stopKey>STOP</stopKey>
                <stopPort>9999</stopPort>
                <scanIntervalSeconds>5</scanIntervalSeconds>
                <webAppConfig>
                    <contextPath>/${project.artifactId}</contextPath>
                    <resourceBases>
                        <resourceBase>${project.build.directory}/web-resources</resourceBase>
                    </resourceBases>
                </webAppConfig>
            </configuration>
        </plugin>

And add it into the war:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.2</version>
            <configuration>
                <webResources>
                    <resource>
                        <directory>${project.build.directory}/web-resources</directory>
                    </resource>
                </webResources>
            </configuration>
        </plugin>

Hope it helps.

By the way, you can find more information about jetty-maven-plugin configuration on this page.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top