From 3dca89f0015613ab3f287945965e9f92a6079cd8 Mon Sep 17 00:00:00 2001 From: Mark Donszelmann Date: Tue, 6 Oct 2009 14:44:29 +0200 Subject: Reformat all source files and add licenses to tests --- .../apache/maven/plugin/nar/NarAssemblyMojo.java | 143 +++++++++++---------- 1 file changed, 73 insertions(+), 70 deletions(-) (limited to 'src/main/java/org/apache/maven/plugin/nar/NarAssemblyMojo.java') diff --git a/src/main/java/org/apache/maven/plugin/nar/NarAssemblyMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarAssemblyMojo.java index ecf82ac..b6ad1b4 100644 --- a/src/main/java/org/apache/maven/plugin/nar/NarAssemblyMojo.java +++ b/src/main/java/org/apache/maven/plugin/nar/NarAssemblyMojo.java @@ -19,7 +19,6 @@ package org.apache.maven.plugin.nar; * under the License. */ - import java.io.File; import java.io.IOException; import java.util.Iterator; @@ -39,79 +38,83 @@ import org.codehaus.plexus.util.FileUtils; * @requiresDependencyResolution * @author Mark Donszelmann */ -public class NarAssemblyMojo extends AbstractDependencyMojo { +public class NarAssemblyMojo + extends AbstractDependencyMojo +{ - /** - * List of classifiers which you want to assemble. Example ppc-MacOSX-g++-static, - * x86-Windows-msvc-shared, i386-Linux-g++-executable, .... - * - * @parameter expression="" - * @required - */ - private List classifiers; + /** + * List of classifiers which you want to assemble. Example ppc-MacOSX-g++-static, x86-Windows-msvc-shared, + * i386-Linux-g++-executable, .... + * + * @parameter expression="" + * @required + */ + private List classifiers; - /** - * Copies the unpacked nar libraries and files into the projects target area - */ - public void execute() throws MojoExecutionException, MojoFailureException { - if (shouldSkip()) { - getLog() - .info( - "***********************************************************************"); - getLog() - .info( - "NAR Assembly SKIPPED since no NAR libraries were built/downloaded."); - getLog() - .info( - "***********************************************************************"); - // NOTE: continue since the standard assemble mojo fails if we do - // not create the directories... - } + /** + * Copies the unpacked nar libraries and files into the projects target area + */ + public void execute() + throws MojoExecutionException, MojoFailureException + { + if ( shouldSkip() ) + { + getLog().info( "***********************************************************************" ); + getLog().info( "NAR Assembly SKIPPED since no NAR libraries were built/downloaded." ); + getLog().info( "***********************************************************************" ); + // NOTE: continue since the standard assemble mojo fails if we do + // not create the directories... + } - for (Iterator j = classifiers.iterator(); j.hasNext();) { - String classifier = (String) j.next(); + for ( Iterator j = classifiers.iterator(); j.hasNext(); ) + { + String classifier = (String) j.next(); - List narArtifacts = getNarManager().getNarDependencies("compile"); - List dependencies = getNarManager().getAttachedNarDependencies( - narArtifacts, classifier); - // this may make some extra copies... - for (Iterator d = dependencies.iterator(); d.hasNext();) { - Artifact dependency = (Artifact) d.next(); - getLog().debug("Assemble from " + dependency); + List narArtifacts = getNarManager().getNarDependencies( "compile" ); + List dependencies = getNarManager().getAttachedNarDependencies( narArtifacts, classifier ); + // this may make some extra copies... + for ( Iterator d = dependencies.iterator(); d.hasNext(); ) + { + Artifact dependency = (Artifact) d.next(); + getLog().debug( "Assemble from " + dependency ); - // FIXME reported to maven developer list, isSnapshot - // changes behaviour - // of getBaseVersion, called in pathOf. - if (dependency.isSnapshot()) - ; + // FIXME reported to maven developer list, isSnapshot + // changes behaviour + // of getBaseVersion, called in pathOf. + if ( dependency.isSnapshot() ) + ; - File srcDir = new File(getLocalRepository().pathOf(dependency)); - srcDir = new File(getLocalRepository().getBasedir(), srcDir - .getParent()); - srcDir = new File(srcDir, "nar/"); - File dstDir = new File("target/nar/"); - try { - FileUtils.mkdir(dstDir.getPath()); - if (shouldSkip()) { - File note = new File(dstDir, "NAR_ASSEMBLY_SKIPPED"); - FileUtils - .fileWrite( - note.getPath(), - "The NAR Libraries of this distribution are missing because \n" - + "the NAR dependencies were not built/downloaded, presumably because\n" - + "the the distribution was built with the '-Dnar.skip=true' flag."); - } else { - getLog().debug("SrcDir: " + srcDir); - if (srcDir.exists()) { - FileUtils.copyDirectoryStructure(srcDir, dstDir); - } - } - } catch (IOException ioe) { - throw new MojoExecutionException( - "Failed to copy directory for dependency " - + dependency + " from "+srcDir+" to " + dstDir, ioe); - } - } - } - } + File srcDir = new File( getLocalRepository().pathOf( dependency ) ); + srcDir = new File( getLocalRepository().getBasedir(), srcDir.getParent() ); + srcDir = new File( srcDir, "nar/" ); + File dstDir = new File( "target/nar/" ); + try + { + FileUtils.mkdir( dstDir.getPath() ); + if ( shouldSkip() ) + { + File note = new File( dstDir, "NAR_ASSEMBLY_SKIPPED" ); + FileUtils.fileWrite( + note.getPath(), + "The NAR Libraries of this distribution are missing because \n" + + "the NAR dependencies were not built/downloaded, presumably because\n" + + "the the distribution was built with the '-Dnar.skip=true' flag." ); + } + else + { + getLog().debug( "SrcDir: " + srcDir ); + if ( srcDir.exists() ) + { + FileUtils.copyDirectoryStructure( srcDir, dstDir ); + } + } + } + catch ( IOException ioe ) + { + throw new MojoExecutionException( "Failed to copy directory for dependency " + dependency + + " from " + srcDir + " to " + dstDir, ioe ); + } + } + } + } } -- cgit v1.2.3