private void checkJnlpFileConfiguration ( JnlpFile jnlpFile ) throws MojoExecutionException { if ( StringUtils . isBlank ( jnlpFile . getOutputFilename ( ) ) ) { throw new MojoExecutionException ( "Configuration error: An outputFilename must be specified for each jnlpFile element" ) ; } if ( StringUtils . isNotBlank ( jnlpFile . getTemplateFilename ( ) ) ) { getLog ( ) . warn ( "jnlpFile.templateFilename is deprecated (since 1.0-beta-5), use now the jnlpFile.inputTemplate instead." ) ; jnlpFile . setInputTemplate ( jnlpFile . getTemplateFilename ( ) ) ; } // if ( StringUtils.isBlank( jnlpFile.getInputTemplate() ) ) // { // verboseLog( // "No templateFilename found for " + jnlpFile.getOutputFilename() + ". Will use the default template." ); // } // else // { // File templateFile = new File( getTemplateDirectory(), jnlpFile.getInputTemplate() ); // // if ( !templateFile.isFile() ) // { // throw new MojoExecutionException( // "The specified JNLP template does not exist: [" + templateFile + "]" ); // } // } List < JarResource > jnlpJarResources = jnlpFile . getJarResources ( ) ; if ( CollectionUtils . isEmpty ( jnlpJarResources ) ) { throw new MojoExecutionException ( "Configuration error: A non-empty <jarResources> element must be specified in the plugin " + "configuration for the JNLP file named [" + jnlpFile . getOutputFilename ( ) + "]" ) ; } // --- // find out the jar resource with a main class (can only get one) // --- JarResource mainJarResource = null ; for ( JarResource jarResource : jnlpJarResources ) { checkMandatoryJarResourceFields ( jarResource ) ; if ( jarResource . getMainClass ( ) != null ) { if ( mainJarResource != null ) { // alreay found throw new MojoExecutionException ( "Configuration error: More than one <jarResource> element has been declared " + "with a <mainClass> element in the configuration for JNLP file [" + jnlpFile . getOutputFilename ( ) + "]" ) ; } jnlpFile . setMainClass ( jarResource . getMainClass ( ) ) ; mainJarResource = jarResource ; } } if ( mainJarResource == null ) { throw new MojoExecutionException ( "Configuration error: Exactly one <jarResource> element must " + "be declared with a <mainClass> element in the configuration for JNLP file [" + jnlpFile . getOutputFilename ( ) + "]" ) ; } }
Checks the validity of a single jnlpFile configuration element .