Author: bentmann
Date: Sun Aug 9 13:44:17 2009
New Revision: 802544
URL: http://svn.apache.org/viewvc?rev=802544&view=rev
Log:
o Tweaked logging
Modified:
maven/plugins/trunk/maven-jarsigner-plugin/src/main/java/org/apache/maven/plugins/jarsigner/AbstractJarsignerMojo.java
maven/plugins/trunk/maven-jarsigner-plugin/src/main/resources/jarsigner.properties
maven/plugins/trunk/maven-jarsigner-plugin/src/main/resources/jarsigner_de.properties
Modified:
maven/plugins/trunk/maven-jarsigner-plugin/src/main/java/org/apache/maven/plugins/jarsigner/AbstractJarsignerMojo.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jarsigner-plugin/src/main/java/org/apache/maven/plugins/jarsigner/AbstractJarsignerMojo.java?rev=802544&r1=802543&r2=802544&view=diff
==============================================================================
---
maven/plugins/trunk/maven-jarsigner-plugin/src/main/java/org/apache/maven/plugins/jarsigner/AbstractJarsignerMojo.java
(original)
+++
maven/plugins/trunk/maven-jarsigner-plugin/src/main/java/org/apache/maven/plugins/jarsigner/AbstractJarsignerMojo.java
Sun Aug 9 13:44:17 2009
@@ -118,36 +118,44 @@
{
this.executable = getExecutable();
+ int processed = 0;
+
if ( this.archive != null )
{
- this.processArchive( this.archive );
+ processArchive( this.archive );
+ processed++;
}
else
{
- this.processArtifact( this.project.getArtifact() );
+ processed += processArtifact( this.project.getArtifact() ) ? 1
: 0;
- for ( Iterator it =
this.project.getAttachedArtifacts().iterator(); it.hasNext(); )
+ if ( attachments )
{
- final Artifact artifact = (Artifact) it.next();
+ for ( Iterator it =
this.project.getAttachedArtifacts().iterator(); it.hasNext(); )
+ {
+ final Artifact artifact = (Artifact) it.next();
- if ( this.attachments )
+ processed += processArtifact( artifact ) ? 1 : 0;
+ }
+ }
+ else
+ {
+ if ( verbose )
{
- this.processArtifact( artifact );
+ getLog().info( getMessage( "ignoringAttachments" ) );
}
- else if ( this.isJarFile( artifact ) )
+ else
{
- this.getLog().info( this.getMessage(
"ignoringAttachment", new Object[]
- {
- artifact.toString()
- } ) );
-
+ getLog().debug( getMessage( "ignoringAttachments" ) );
}
}
}
+
+ getLog().info( getMessage( "processed", new Integer( processed ) )
);
}
else
{
- this.getLog().info( this.getMessage( "disabled", null ) );
+ getLog().info( getMessage( "disabled", null ) );
}
}
@@ -237,11 +245,12 @@
* Processes a given artifact.
*
* @param artifact The artifact to process.
+ * @return <code>true</code> if the artifact is a JAR and was processed,
<code>false</code> otherwise.
*
* @throws NullPointerException if {...@code artifact} is {...@code null}.
* @throws MojoExecutionException if processing {...@code artifact} fails.
*/
- private void processArtifact( final Artifact artifact )
+ private boolean processArtifact( final Artifact artifact )
throws MojoExecutionException
{
if ( artifact == null )
@@ -249,46 +258,36 @@
throw new NullPointerException( "artifact" );
}
- if ( this.isJarFile( artifact ) )
+ boolean processed = false;
+
+ if ( isJarFile( artifact ) )
{
if ( this.verbose )
{
- this.getLog().info( this.getMessage( "processing", new Object[]
- {
- artifact.toString()
- } ) );
-
+ getLog().info( getMessage( "processing", artifact ) );
}
- else if ( this.getLog().isDebugEnabled() )
+ else if ( getLog().isDebugEnabled() )
{
- this.getLog().debug( this.getMessage( "processing", new
Object[]
- {
- artifact.toString()
- } ) );
-
+ getLog().debug( getMessage( "processing", artifact ) );
}
- this.processArchive( artifact.getFile() );
+ processArchive( artifact.getFile() );
+
+ processed = true;
}
else
{
if ( this.verbose )
{
- this.getLog().info( this.getMessage( "unsupported", new
Object[]
- {
- artifact.toString()
- } ) );
-
+ getLog().info( getMessage( "unsupported", artifact ) );
}
- else if ( this.getLog().isDebugEnabled() )
+ else if ( getLog().isDebugEnabled() )
{
- this.getLog().debug( this.getMessage( "unsupported", new
Object[]
- {
- artifact.toString()
- } ) );
-
+ getLog().debug( getMessage( "unsupported", artifact ) );
}
}
+
+ return processed;
}
/**
@@ -328,17 +327,13 @@
commandLine.addArguments( this.arguments );
}
- commandLine = this.getCommandline( archive, commandLine );
+ commandLine = getCommandline( archive, commandLine );
try
{
- if ( this.getLog().isDebugEnabled() )
+ if ( getLog().isDebugEnabled() )
{
- this.getLog().debug( this.getMessage( "command", new Object[]
- {
- this.getCommandlineInfo( commandLine )
- } ) );
-
+ getLog().debug( getMessage( "command", getCommandlineInfo(
commandLine ) ) );
}
final int result = CommandLineUtils.executeCommandLine(
commandLine,
@@ -377,20 +372,14 @@
if ( result != 0 )
{
- throw new MojoExecutionException( this.getMessage( "failure",
new Object[]
- {
- this.getCommandlineInfo( commandLine ), new Integer(
result )
- } ) );
-
+ throw new MojoExecutionException( getMessage( "failure",
getCommandlineInfo( commandLine ),
+ new Integer(
result ) ) );
}
}
catch ( CommandLineException e )
{
- throw new MojoExecutionException( this.getMessage(
"commandLineException", new Object[]
- {
- this.getCommandlineInfo( commandLine )
- } ), e );
-
+ throw new MojoExecutionException( getMessage(
"commandLineException", getCommandlineInfo( commandLine ) ),
+ e );
}
}
@@ -489,4 +478,19 @@
return new MessageFormat( ResourceBundle.getBundle( "jarsigner"
).getString( key ) ).format( args );
}
+ private String getMessage( final String key )
+ {
+ return getMessage( key, null );
+ }
+
+ private String getMessage( final String key, final Object arg )
+ {
+ return getMessage( key, new Object[] { arg } );
+ }
+
+ private String getMessage( final String key, final Object arg1, final
Object arg2 )
+ {
+ return getMessage( key, new Object[] { arg1, arg2 } );
+ }
+
}
Modified:
maven/plugins/trunk/maven-jarsigner-plugin/src/main/resources/jarsigner.properties
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jarsigner-plugin/src/main/resources/jarsigner.properties?rev=802544&r1=802543&r2=802544&view=diff
==============================================================================
---
maven/plugins/trunk/maven-jarsigner-plugin/src/main/resources/jarsigner.properties
(original)
+++
maven/plugins/trunk/maven-jarsigner-plugin/src/main/resources/jarsigner.properties
Sun Aug 9 13:44:17 2009
@@ -15,11 +15,11 @@
# specific language governing permissions and limitations
# under the License.
-disabled=Disabled
-ignoringAttachment=Forcibly ignoring project attachment {0}
-unsupported=Unsupported artifact {0} ignored
-processing=Processing {0}
-command=''{0}''
-commandLineException=Failed executing ''{0}''
-failure=Failed executing ''{0}'' - exitcode {1,number}
-archive=Processing archive ''{0}''.
+disabled = Disabled
+ignoringAttachments = Forcibly ignoring attached artifacts
+unsupported = Unsupported artifact {0} ignored
+processing = Processing {0}
+processed = {0} archive(s) processed
+command = ''{0}''
+commandLineException = Failed executing ''{0}''
+failure = Failed executing ''{0}'' - exitcode {1,number}
Modified:
maven/plugins/trunk/maven-jarsigner-plugin/src/main/resources/jarsigner_de.properties
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jarsigner-plugin/src/main/resources/jarsigner_de.properties?rev=802544&r1=802543&r2=802544&view=diff
==============================================================================
---
maven/plugins/trunk/maven-jarsigner-plugin/src/main/resources/jarsigner_de.properties
(original)
+++
maven/plugins/trunk/maven-jarsigner-plugin/src/main/resources/jarsigner_de.properties
Sun Aug 9 13:44:17 2009
@@ -15,11 +15,11 @@
# specific language governing permissions and limitations
# under the License.
-disabled=Deaktiviert
-ignoringAttachment=Verarbeitung von Projektanhang {0} unterdr\u00FCckt
-unsupported=Nicht unterst\u00FCtztes Artefakt {0} ignoriert
-processing=Verarbeitet {0}
-command=''{0}''
-commandLineException=Ausf\u00FChrung von ''{0}'' gescheitert
-failure=Ausf\u00FChrung von ''{0}'' fehlgeschlagen ({1,number})
-archive=Verarbeitet Archiv ''{0}''.
+disabled = Deaktiviert
+ignoringAttachments = Verarbeitung von angeh\u00E4ngten Artefakten
unterdr\u00FCckt
+unsupported = Nicht unterst\u00FCtztes Artefakt {0} ignoriert
+processing = Verarbeite {0}
+processed = {0} Archiv(e) verarbeitet
+command = ''{0}''
+commandLineException = Ausf\u00FChrung von ''{0}'' gescheitert
+failure = Ausf\u00FChrung von ''{0}'' fehlgeschlagen - Ergebniscode
({1,number})