Hi,
I'm using the webstart-maven-plugin (1.0-beta-1-SNAPSHOT) to create a
WAR file with 2 jnlp files. The creation works but I've problems with
the content of the generated jnlp-files:
The jar-entries (<jar href="xxxx.jar" />) misses the version in the
filename of the jar, e.g. log4j.jar instead of log4j-1.2.14.jar. Instead
the version of the jar file is entered in a separate attribute
version="1.12.14".
When I try to load the JNLP files from Jetty or Tomcat I always get an
error.
I've changed the JnlpDownloadServletMojo.java to add the version to the
filename and not to output the version of the jar in the JNLP file and
this works for me. However I'd like to know how the current
implementation (with the output of the version and the filename without
the version) works ;-)
See the changes to JnlpDownloadServletMojo.java below that works for me.
Thanks,
Andi
--- C:\Documents and Settings\chakuht0\Local
Settings\Temp\JnlpDownloadServletMojo.java-revBASE.svn000.tmp.java
2008-02-19 11:47:52.000000000 +-0100
+++
D:\virt\Java_Projects\webstart-maven-plugin\src\main\java\org\codehaus\m
ojo\webstart\JnlpDownloadServletMojo.java 2008-02-19 07:57:32.000000000
+-0100
@@ -398,12 +399,13 @@
{
//for each configured JarResource, create and resolve the
corresponding artifact and
//check it for the mainClass if specified
for ( Iterator itr = jarResources.iterator();
itr.hasNext(); )
{
JarResource jarResource = (JarResource) itr.next();
+ jarResource.setOutputJarVersion( /*true*/ false ); // kuz
Artifact artifact = createArtifact(jarResource);
getArtifactResolver().resolve( artifact,
getRemoteRepositories(), getLocalRepository() );
jarResource.setArtifact( artifact );
checkForMainClass( jarResource );
jarResourceArtifacts.add( artifact );
}
@@ -558,13 +560,13 @@
// we should really improve the way we collect the
jarResources
if ( !jarResourceArtifacts.contains( resolvedArtifact ) )
{
JarResource newJarResource = new
JarResource(resolvedArtifact);
if ( !jarResources.contains( newJarResource ) )
{
- newJarResource.setOutputJarVersion( true );
+ newJarResource.setOutputJarVersion( /*true*/ false
); // kuz
jarResources.add( newJarResource );
}
}
}
@@ -685,12 +687,17 @@
*/
private String buildHrefValue( Artifact artifact )
{
StringBuffer sbuf = new StringBuffer();
sbuf.append( artifact.getArtifactId() );
+ if ( StringUtils.isNotEmpty( artifact.getVersion() ) )
+ {
+ sbuf.append( "-" ).append( artifact.getVersion() );
+ }
+
if ( StringUtils.isNotEmpty( artifact.getClassifier() ) )
{
sbuf.append( "-" ).append( artifact.getClassifier() );
}
sbuf.append( "." ).append(
artifact.getArtifactHandler().getExtension() );