summaryrefslogtreecommitdiff
path: root/src/main/java/org/apache/maven/plugin/nar/NarAssemblyMojo.java
diff options
context:
space:
mode:
authorMark Donszelmann <Mark.Donszelmann@gmail.com>2009-10-06 14:44:29 +0200
committerMark Donszelmann <Mark.Donszelmann@gmail.com>2009-10-06 14:44:29 +0200
commit3dca89f0015613ab3f287945965e9f92a6079cd8 (patch)
treea00619a63c55b74c16ac8116d04b21f322e1747b /src/main/java/org/apache/maven/plugin/nar/NarAssemblyMojo.java
parent75b9fcffc6709f9c65990f6d04d593d3bfb4743d (diff)
downloadmaven-nar-plugin-3dca89f0015613ab3f287945965e9f92a6079cd8.tar.gz
maven-nar-plugin-3dca89f0015613ab3f287945965e9f92a6079cd8.tar.bz2
maven-nar-plugin-3dca89f0015613ab3f287945965e9f92a6079cd8.tar.xz
maven-nar-plugin-3dca89f0015613ab3f287945965e9f92a6079cd8.zip
Reformat all source files and add licenses to tests
Diffstat (limited to 'src/main/java/org/apache/maven/plugin/nar/NarAssemblyMojo.java')
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarAssemblyMojo.java143
1 files changed, 73 insertions, 70 deletions
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 );
+ }
+ }
+ }
+ }
}