Question

My boss told me to work with the Maven Web Start plugin to generate a JNLP and a signed JAR.

The problem is no matter how I try I couldn't make a JAR containing my dependencies.

I'm always facing a ClassDefNotFound Exception

pom.xml

<repositories>
    <repository>
        <releases />
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
        <id>mygrid-repository</id>
        <name>myGrid Repository</name>
        <url>http://www.mygrid.org.uk/maven/repository</url>
    </repository>
    <repository>
        <id>com.springsource.repository.bundles.external</id>
        <name>SpringSource Enterprise Bundle Repository - External Bundle Releases</name>
        <url>http://repository.springsource.com/maven/bundles/external</url>
    </repository>
</repositories>

<build>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo.webstart</groupId>
            <artifactId>webstart-maven-plugin</artifactId>
            <version>1.0-alpha-2</version>

            <executions>
                <execution>
                    <id>package</id>
                    <phase>package</phase>
                    <goals>
                        <goal>jnlp</goal>
                    </goals>
                </execution>
            </executions>

            <configuration>
                <jnlp>
                    <outputFile>ctScan.jnlp</outputFile>
                    <mainClass>com.test.testScan.App</mainClass>
                </jnlp>

                <libPath>lib</libPath>
                <outputJarVersions>true</outputJarVersions>
                <includes>
                    <include>commons-logging:commons-logging</include>
                    <include>commons-cli:commons-cli</include>
                </includes>
                <sign>
                    <keystore>../../ctKeystore</keystore>
                    <keypass>CreativeKeypass</keypass>
                    <storepass>CreativeKeypass</storepass>
                    <alias>CreativeScan</alias>

                    <dnameCn>Mohcine Wannas</dnameCn>
                    <dnameOu>DARD</dnameOu>
                    <dnameO>Creative technologies</dnameO>
                    <dnameL>Rabat</dnameL>
                    <dnameSt>Rabat</dnameSt>
                    <dnameC>ma</dnameC>

                    <verify>true</verify>
                </sign>

                <pack200>false</pack200>
                <gzip>true</gzip>
                <outputJarVersions>false</outputJarVersions>
                <verbose>true</verbose>

            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <configuration>
                <archive>
                    <manifest>
                        <addClasspath>true</addClasspath>
                        <classpathPrefix>lib/</classpathPrefix>
                        <mainClass>com.test.testScan.App</mainClass>
                    </manifest>
                </archive>
            </configuration>
        </plugin>
    </plugins>
</build>

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>uk.co.mmscomputing</groupId>
        <artifactId>device</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>net.htmlparser.jericho</groupId>
        <artifactId>jericho-html</artifactId>
        <version>3.3</version>
    </dependency>
    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>itextpdf</artifactId>
        <version>0.0</version>
    </dependency>
    <dependency>
        <groupId>net.java.dev.jai-imageio</groupId>
        <artifactId>jai-imageio-core-standalone</artifactId>
        <version>1.2-pre-dr-b04-2011-07-04</version>
    </dependency>
    <dependency>
        <groupId>javax.media.jai</groupId>
        <artifactId>com.springsource.javax.media.jai.codec</artifactId>
        <version>1.1.3</version>
    </dependency>
</dependencies>

build output

please add your build output here (and possibily the directory structure created and its content, notably the content of the lib/ folder, if it went that far)

No correct solution

OTHER TIPS

The webstart-maven-plugin doesn't create a JAR with the dependencies, it creates a JAR along with the JARs of dependencies in the lib/ folder.

If you want to package everything in one JAR, you'd need to use the maven-shade-plugin.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top