Index: pom.xml =================================================================== --- pom.xml (revision 1817) +++ pom.xml (working copy) @@ -47,38 +47,143 @@ David Boden dave@daveboden.com + + + Geoffrey De Smet + ge0ffrey.spam_AT_gmail.com + + Java developer + + +1 + + plugin + jnlp-report pack200-anttasks + pack200-jdk14 jnlp-servlet - plugin - pack200-jdk14 + + + + org.apache.maven + maven-project + 2.0.1 + + + org.apache.maven + maven-core + 2.0.1 + + + org.apache.maven + maven-plugin-descriptor + 2.0.1 + + + org.apache.maven + maven-settings + 2.0.1 + + + junit + junit + 3.8.1 + test + + + org.codehaus.plexus + plexus-utils + 1.0.4 + + + commons-lang + commons-lang + 2.1 + + + + org.apache.maven.plugins + maven-jar-plugin + 2.1-SNAPSHOT + + + org.codehaus.mojo + keytool-maven-plugin + [0.3,) + + + velocity + velocity + 1.4 + + + commons-lang + commons-lang + 2.1 + + + + + org.apache.maven.reporting + maven-reporting-api + 2.0 + + + org.apache.maven.reporting + maven-reporting-impl + 2.0 + + + + + jdk16 + + 1.6 + + + + org.codehaus.mojo + pack200-jdk15 + ${version} + + + + jdk15 1.5 - - - pack200-jdk15 - + + + org.codehaus.mojo + pack200-jdk15 + ${version} + + - - jdk16 + jdk14 - 1.6 + 1.4 - - - pack200-jdk15 - + + + org.codehaus.mojo + pack200-jdk14 + ${version} + + - Index: jnlp-report/src/main/java/org/codehaus/mojo/webstart/JnlpReportMojo.java =================================================================== --- jnlp-report/src/main/java/org/codehaus/mojo/webstart/JnlpReportMojo.java (revision 0) +++ jnlp-report/src/main/java/org/codehaus/mojo/webstart/JnlpReportMojo.java (revision 0) @@ -0,0 +1,183 @@ +package org.codehaus.mojo.webstart; + +import java.io.File; +import java.io.IOException; +import java.util.Locale; +import java.util.ResourceBundle; +import java.util.List; +import java.util.Iterator; + +import org.apache.maven.artifact.handler.ArtifactHandler; +import org.apache.maven.project.MavenProject; +import org.apache.maven.reporting.AbstractMavenReport; +import org.apache.maven.reporting.MavenReportException; +import org.apache.maven.plugin.MojoExecutionException; + +import org.codehaus.doxia.site.renderer.SiteRenderer; +import org.codehaus.plexus.util.FileUtils; + +/** + * @description Creates a Jnlp Report + * @goal report + * @author Geoffrey De Smet + */ +public class JnlpReportMojo + extends AbstractMavenReport +{ + /** + * Location where generated html will be created. + * + * @parameter expression="${project.build.directory}/site" + * + */ + private File outputDirectory; + + /** + * Doxia Site Renderer + * + * @parameter expression="${component.org.codehaus.doxia.site.renderer.SiteRenderer}" + * @required @readonly + */ + private SiteRenderer siteRenderer; + + /** + * Maven Project + * + * @parameter expression="${project}" + * @required @readonly + */ + private MavenProject project; + + /** + * Directory where the jnlp artifacts and jnlp sources files reside. + * + * @parameter expression="${project.build.directory}/jnlp" + * @required + */ + private File jnlpSourceDirectory; + + /** + * Directory in the site directory where the jnlp artifacts and jnlp sources files reside. + * + * @parameter expression="jnlp/launch.jnlp" + * @required + */ + private String siteJnlpFile; + + /** + * The default filename to use for the report. + * + * @parameter expression="${outputName}" default-value="jnlp-report" + * @required + */ + private String outputName; + + public void executeReport( Locale locale ) + throws MavenReportException + { + copyJnlpFiles(); + fillReport( locale ); + } + + private void copyJnlpFiles() throws MavenReportException + { + if ( ! jnlpSourceDirectory.exists() ) + { + throw new MavenReportException("jnlpSourceDirectory does not exist"); + } + try + { + File destinationDirectory = new File(outputDirectory, siteJnlpFile).getParentFile(); + List files = FileUtils.getFiles( jnlpSourceDirectory, "**/*", "" ); + for ( Iterator i = files.iterator(); i.hasNext(); ) + { + File file = (File) i.next(); + getLog().debug( "Copying " + file + " to " + destinationDirectory ); + String path = file.getAbsolutePath().substring( jnlpSourceDirectory.getAbsolutePath().length() + 1 ); + File destDir = new File( destinationDirectory, path ); + getLog().debug( "Copying " + file + " to " + destDir ); + if ( file.isDirectory() ) { + destDir.mkdirs(); + } else { + FileUtils.copyFileToDirectory( file, destDir.getParentFile() ); + } + } + } + catch ( IOException e ) + { + throw new MavenReportException("Failed to copy jnlp files", e); + } + } + + private void fillReport( Locale locale ) + { + getSink().head(); + getSink().text( getBundle(locale).getString( "report.jnlp-report.description" ) ); + getSink().head_(); + getSink().body(); + getSink().sectionTitle1(); + getSink().text(getBundle(locale).getString("report.jnlp-report.label.installation.header")); + getSink().sectionTitle1_(); + getSink().paragraph(); + getSink().text(getBundle(locale).getString("report.jnlp-report.label.installation.description")); + getSink().paragraph_(); + getSink().paragraph(); + getSink().link(siteJnlpFile); + getSink().text(getBundle(locale).getString("report.jnlp-report.label.installation.webStartMeNow")); + getSink().link_(); + getSink().paragraph_(); + getSink().paragraph(); + getSink().text(getBundle(locale).getString("report.jnlp-report.label.installation.getJava") + " "); + getSink().link("http://java.com"); + getSink().text("http://java.com"); + getSink().link_(); + getSink().paragraph_(); + getSink().sectionTitle1(); + getSink().text(getBundle(locale).getString("report.jnlp-report.label.uninstallation.header")); + getSink().sectionTitle1_(); + getSink().paragraph(); + getSink().text(getBundle(locale).getString("report.jnlp-report.label.uninstallation.description")); + getSink().paragraph_(); + getSink().body_(); + getSink().flush(); + getSink().close(); + } + + public String getName( Locale locale ) + { + return getBundle( locale ).getString( "report.jnlp-report.name" ); + } + + public String getDescription( Locale locale ) + { + return getBundle( locale ).getString( "report.jnlp-report.description" ); + } + + protected SiteRenderer getSiteRenderer( ) + { + return siteRenderer; + } + + protected MavenProject getProject( ) + { + return project; + } + + public String getOutputName( ) + { + return outputName; + } + + protected String getOutputDirectory( ) + { + return outputDirectory.getPath(); + } + + private ResourceBundle getBundle( Locale locale ) + { + return ResourceBundle.getBundle( "jnlp-report", + locale, + this.getClass( ).getClassLoader( ) ); + } + +} Index: jnlp-report/src/main/resources/jnlp-report.properties =================================================================== --- jnlp-report/src/main/resources/jnlp-report.properties (revision 0) +++ jnlp-report/src/main/resources/jnlp-report.properties (revision 0) @@ -0,0 +1,9 @@ +report.jnlp-report.name=Maven JNLP Report +report.jnlp-report.description=Report on the generated webstart application. +report.jnlp-report.label.installation.header=Installing +report.jnlp-report.label.installation.webStartMeNow=Webstart the application now +report.jnlp-report.label.installation.description=Open the link below to install the application on your computer. +report.jnlp-report.label.installation.getJava=You require Java to run this application.\ + If you do not have Java, you can get it easily at +report.jnlp-report.label.uninstallation.header=Uninstalling +report.jnlp-report.label.uninstallation.description=The application can be easily uninstalled from the sofware control panel. Index: jnlp-report/pom.xml =================================================================== --- jnlp-report/pom.xml (revision 0) +++ jnlp-report/pom.xml (revision 0) @@ -0,0 +1,26 @@ + + 4.0.0 + + org.codehaus.mojo + webstart-maven-plugin-parent + 1.0-SNAPSHOT + + + jnlp-report-maven-plugin + maven-plugin + 1.0-SNAPSHOT + Maven JNLP Report Plugin + + + + org.apache.maven.reporting + maven-reporting-api + + + org.apache.maven.reporting + maven-reporting-impl + + + Index: plugin/src/main/java/org/codehaus/mojo/webstart/JnlpMojo.java =================================================================== --- plugin/src/main/java/org/codehaus/mojo/webstart/JnlpMojo.java (revision 1817) +++ plugin/src/main/java/org/codehaus/mojo/webstart/JnlpMojo.java (working copy) @@ -58,8 +58,8 @@ * @author Jerome Lacoste * @version $Id$ * @goal jnlp - * @phase package * @requiresDependencyResolution runtime + * @execute phase="package" * @requiresProject * @inheritedByDefault true * @todo refactor the common code with javadoc plugin @@ -270,12 +270,12 @@ fileFilters.add( filter1 ); fileFilters.add( filter2 ); } - + public boolean accept( File pathname ) { for ( int i = 0; i < fileFilters.size(); i++ ) { - if ( ! ((FileFilter) fileFilters.get(i)).accept( pathname ) ) - return false; + if ( ! ((FileFilter) fileFilters.get(i)).accept( pathname ) ) + return false; } return true; } @@ -346,7 +346,7 @@ // interesting: copied files lastModified time stamp will be rounded. // We have to be sure that the startTime is before that time... // rounding to the second - 1 millis should be sufficient.. - startTime = System.currentTimeMillis() - 1000; + startTime = System.currentTimeMillis() - 1000; File workDirectory = getWorkDirectory(); getLog().debug( "using work directory " + workDirectory ); @@ -383,7 +383,7 @@ /* for( Iterator it = getNativeLibs().iterator(); it.hasNext(); ) { Artifact artifact = ; - Artifact copiedArtifact = + Artifact copiedArtifact = // similar to what we do for jars, except that we must pack them into jar instead of copying. // them @@ -398,12 +398,12 @@ jarTask.execute(); nativeLibJar.setLastModified( nativeLib.lastModified() ); - + copiedArtifact = new .... } else { getLog().debug( "Copying native lib " + artifact ); copyFileToDirectory( artifact.getFile(), applicationFolder ); - + copiedArtifact = artifact; } copiedNativeArtifacts.add( copiedArtifact ); @@ -420,7 +420,7 @@ logCollection( "Some dependencies may be skipped. Here's the list of the artifacts that should be signe d/packed: ", modifiedJnlpArtifacts ); } - + if ( sign != null ) { @@ -445,8 +445,8 @@ int signedJars = signJars( workDirectory, updatedJarFileFilter ); if ( signedJars != modifiedJnlpArtifacts.size() ) { - throw new IllegalStateException( - "the number of signed artifacts differ from the number of modified artifacts. Implementation error" + throw new IllegalStateException( + "the number of signed artifacts differ from the number of modified artifacts. Implementation error" ); } } @@ -821,7 +821,7 @@ File targetFile = new File( targetDirectory, sourceFile.getName() ); - boolean shouldCopy = ! targetFile.exists() + boolean shouldCopy = ! targetFile.exists() || targetFile.lastModified() < sourceFile.lastModified(); if ( shouldCopy ) { @@ -863,8 +863,13 @@ for ( int i = 0; i < jarFiles.length; i++ ) { signJar.setJarPath( jarFiles[i] ); +<<<<<<< .mine + // we don't change the jar name + // signJar.setSignedJar(jarFiles[i]); +======= // for some reason, it appears that the signed jar field is not null ? signJar.setSignedJar( null ); +>>>>>>> .r1817 long lastModified = jarFiles[i].lastModified(); signJar.execute(); jarFiles[i].setLastModified( lastModified ); Index: plugin/pom.xml =================================================================== --- plugin/pom.xml (revision 1817) +++ plugin/pom.xml (working copy) @@ -8,13 +8,15 @@ 1.0-SNAPSHOT - webstart-maven-plugin + webstart-maven-plugin maven-plugin 1.0-SNAPSHOT Maven Webstart Plugin 2005 http://mojo.codehaus.org/webstart-maven-plugin +<<<<<<< .mine +======= https://svn.codehaus.org/mojo/trunk/mojo/mojo-sandbox/webstart-maven-plugin/plugin @@ -34,51 +36,37 @@ +>>>>>>> .r1817 - - - David Boden - dave@daveboden.com - - - - org.apache.maven maven-project - 2.0.1 org.apache.maven maven-core - 2.0.1 org.apache.maven maven-plugin-descriptor - 2.0.1 org.apache.maven maven-settings - 2.0.1 junit junit - 3.8.1 test org.codehaus.plexus plexus-utils - 1.0.4 commons-lang commons-lang - 2.1