summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorMark Donszelmann <Mark.Donszelmann@gmail.com>2009-11-16 23:05:54 +0100
committerMark Donszelmann <Mark.Donszelmann@gmail.com>2009-11-16 23:05:54 +0100
commitbb9f382d1024e60f672b9c484031f40772a54a4b (patch)
tree32ca1fa8894b54aca1e0fbed596e4f7b1f0adaca /src/main
parent9da8be3cb31159c4d44d72f98de663c8350ff770 (diff)
downloadmaven-nar-plugin-bb9f382d1024e60f672b9c484031f40772a54a4b.tar.gz
maven-nar-plugin-bb9f382d1024e60f672b9c484031f40772a54a4b.tar.bz2
maven-nar-plugin-bb9f382d1024e60f672b9c484031f40772a54a4b.tar.xz
maven-nar-plugin-bb9f382d1024e60f672b9c484031f40772a54a4b.zip
Reformat
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/AbstractCompileMojo.java14
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/AbstractNarLayout.java2
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/AbstractResourcesMojo.java2
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/Compiler.java16
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/Javah.java4
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/Linker.java10
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarCompileMojo.java8
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarGnuConfigureMojo.java4
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarGnuMakeMojo.java4
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarGnuProcess.java2
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarGnuResources.java2
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarInfo.java2
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarIntegrationTestMojo.java22
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarJavahMojo.java2
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarManager.java19
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarPackageMojo.java2
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarResourcesMojo.java4
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarSystemMojo.java4
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarTestCompileMojo.java2
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarTestMojo.java8
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarUnpackMojo.java2
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarUtil.java16
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/Test.java2
23 files changed, 143 insertions, 10 deletions
diff --git a/src/main/java/org/apache/maven/plugin/nar/AbstractCompileMojo.java b/src/main/java/org/apache/maven/plugin/nar/AbstractCompileMojo.java
index 5a541ad..98a4640 100644
--- a/src/main/java/org/apache/maven/plugin/nar/AbstractCompileMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/AbstractCompileMojo.java
@@ -159,7 +159,9 @@ public abstract class AbstractCompileMojo
protected C getC()
{
if ( c == null )
+ {
c = new C();
+ }
c.setAbstractCompileMojo( this );
return c;
}
@@ -167,7 +169,9 @@ public abstract class AbstractCompileMojo
protected Cpp getCpp()
{
if ( cpp == null )
+ {
cpp = new Cpp();
+ }
cpp.setAbstractCompileMojo( this );
return cpp;
}
@@ -175,7 +179,9 @@ public abstract class AbstractCompileMojo
protected Fortran getFortran()
{
if ( fortran == null )
+ {
fortran = new Fortran();
+ }
fortran.setAbstractCompileMojo( this );
return fortran;
}
@@ -214,21 +220,27 @@ public abstract class AbstractCompileMojo
protected List getLibraries()
{
if ( libraries == null )
+ {
libraries = Collections.EMPTY_LIST;
+ }
return libraries;
}
protected List getTests()
{
if ( tests == null )
+ {
tests = Collections.EMPTY_LIST;
+ }
return tests;
}
protected Javah getJavah()
{
if ( javah == null )
+ {
javah = new Javah();
+ }
javah.setAbstractCompileMojo( this );
return javah;
}
@@ -236,7 +248,9 @@ public abstract class AbstractCompileMojo
protected Java getJava()
{
if ( java == null )
+ {
java = new Java();
+ }
java.setAbstractCompileMojo( this );
return java;
}
diff --git a/src/main/java/org/apache/maven/plugin/nar/AbstractNarLayout.java b/src/main/java/org/apache/maven/plugin/nar/AbstractNarLayout.java
index 7dc2f65..b5a5706 100644
--- a/src/main/java/org/apache/maven/plugin/nar/AbstractNarLayout.java
+++ b/src/main/java/org/apache/maven/plugin/nar/AbstractNarLayout.java
@@ -46,7 +46,9 @@ public abstract class AbstractNarLayout
new File( project.getBuild().getDirectory(), project.getBuild().getFinalName() + "-" + classifier + "."
+ NarConstants.NAR_EXTENSION );
if ( narFile.exists() )
+ {
narFile.delete();
+ }
Archiver archiver = new ZipArchiver();
try
{
diff --git a/src/main/java/org/apache/maven/plugin/nar/AbstractResourcesMojo.java b/src/main/java/org/apache/maven/plugin/nar/AbstractResourcesMojo.java
index b41714c..b889203 100644
--- a/src/main/java/org/apache/maven/plugin/nar/AbstractResourcesMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/AbstractResourcesMojo.java
@@ -160,7 +160,7 @@ public abstract class AbstractResourcesMojo
File jar = (File) i.next();
getLog().debug( "Unpacking jar " + jar );
UnArchiver unArchiver;
- unArchiver = archiverManager.getUnArchiver( AbstractNarMojo.NAR_ROLE_HINT );
+ unArchiver = archiverManager.getUnArchiver( NarConstants.NAR_ROLE_HINT );
unArchiver.setSourceFile( jar );
unArchiver.setDestDirectory( classesDirectory );
unArchiver.extract();
diff --git a/src/main/java/org/apache/maven/plugin/nar/Compiler.java b/src/main/java/org/apache/maven/plugin/nar/Compiler.java
index 0351808..4a79440 100644
--- a/src/main/java/org/apache/maven/plugin/nar/Compiler.java
+++ b/src/main/java/org/apache/maven/plugin/nar/Compiler.java
@@ -242,36 +242,50 @@ public abstract class Compiler
if ( type.equals( "test" ) )
{
if ( testSourceDirectory == null )
+ {
testSourceDirectory = new File( baseDir, "/src/test" );
+ }
if ( testSourceDirectory.exists() )
+ {
sourceDirectories.add( testSourceDirectory );
+ }
for ( Iterator i = mojo.getMavenProject().getTestCompileSourceRoots().iterator(); i.hasNext(); )
{
File extraTestSourceDirectory = new File( (String) i.next() );
if ( extraTestSourceDirectory.exists() )
+ {
sourceDirectories.add( extraTestSourceDirectory );
+ }
}
}
else
{
if ( sourceDirectory == null )
+ {
sourceDirectory = new File( baseDir, "src/main" );
+ }
if ( sourceDirectory.exists() )
+ {
sourceDirectories.add( sourceDirectory );
+ }
for ( Iterator i = mojo.getMavenProject().getCompileSourceRoots().iterator(); i.hasNext(); )
{
File extraSourceDirectory = new File( (String) i.next() );
if ( extraSourceDirectory.exists() )
+ {
sourceDirectories.add( extraSourceDirectory );
+ }
}
}
if (mojo.getLog().isDebugEnabled()) {
for ( Iterator i = sourceDirectories.iterator(); i.hasNext(); )
+ {
mojo.getLog().debug( "Added to sourceDirectory: " + ((File)i.next()).getPath() );
}
+ }
return sourceDirectories;
}
@@ -364,7 +378,9 @@ public abstract class Compiler
// adjust default values
if ( name == null )
+ {
name = NarUtil.getDefaults().getProperty( getPrefix() + "compiler" );
+ }
if ( name == null )
{
throw new MojoFailureException( "NAR: Please specify <Name> as part of <Cpp>, <C> or <Fortran> for "
diff --git a/src/main/java/org/apache/maven/plugin/nar/Javah.java b/src/main/java/org/apache/maven/plugin/nar/Javah.java
index e727bcb..079357e 100644
--- a/src/main/java/org/apache/maven/plugin/nar/Javah.java
+++ b/src/main/java/org/apache/maven/plugin/nar/Javah.java
@@ -227,7 +227,9 @@ public class Javah
for ( int j = 0; j < method.length; j++ )
{
if ( method[j].isNative() )
+ {
files.add( clazz.getClassName() );
+ }
}
}
@@ -290,7 +292,7 @@ public class Javah
{
for ( Iterator i = classes.iterator(); i.hasNext(); )
{
- args.add( (String) i.next() );
+ args.add( i.next() );
}
}
diff --git a/src/main/java/org/apache/maven/plugin/nar/Linker.java b/src/main/java/org/apache/maven/plugin/nar/Linker.java
index 385bdf2..a21c3c0 100644
--- a/src/main/java/org/apache/maven/plugin/nar/Linker.java
+++ b/src/main/java/org/apache/maven/plugin/nar/Linker.java
@@ -176,7 +176,9 @@ public class Linker
throws MojoFailureException, MojoExecutionException
{
if ( name == null )
+ {
throw new MojoFailureException( "Cannot deduce linker version if name is null" );
+ }
String version = null;
@@ -248,7 +250,9 @@ public class Linker
{
File dir = (File) i.next();
if ( dir.exists() )
+ {
defs.addAll( FileUtils.getFiles( dir, "**/*.def", null ) );
+ }
}
}
catch ( IOException e )
@@ -261,7 +265,9 @@ public class Linker
{
File dir = (File) i.next();
if ( dir.exists() )
+ {
defs.addAll( FileUtils.getFiles( dir, "**/*.def", null ) );
+ }
}
}
catch ( IOException e )
@@ -274,7 +280,9 @@ public class Linker
{
File dir = (File) i.next();
if ( dir.exists() )
+ {
defs.addAll( FileUtils.getFiles( dir, "**/*.def", null ) );
+ }
}
}
catch ( IOException e )
@@ -284,7 +292,7 @@ public class Linker
for ( Iterator i = defs.iterator(); i.hasNext(); )
{
LinkerArgument arg = new LinkerArgument();
- arg.setValue( "/def:" + (File) i.next() );
+ arg.setValue( "/def:" + i.next() );
linker.addConfiguredLinkerArg( arg );
}
}
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarCompileMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarCompileMojo.java
index 8664d96..f8b8e81 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarCompileMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarCompileMojo.java
@@ -58,7 +58,9 @@ public class NarCompileMojo
throws MojoExecutionException, MojoFailureException
{
if ( shouldSkip() )
+ {
return;
+ }
// make sure destination is there
getTargetDirectory().mkdirs();
@@ -103,8 +105,10 @@ public class NarCompileMojo
{
File dir = (File) i.next();
if ( dir.exists() )
+ {
files.addAll( FileUtils.getFiles( dir, StringUtils.join( compiler.getIncludes().iterator(), "," ),
null ) );
+ }
}
return files;
}
@@ -191,7 +195,9 @@ public class NarCompileMojo
// add javah include path
File jniDirectory = getJavah().getJniDirectory();
if ( jniDirectory.exists() )
+ {
task.createIncludePath().setPath( jniDirectory.getPath() );
+ }
// add java include paths
getJava().addIncludePaths( task, type );
@@ -345,7 +351,9 @@ public class NarCompileMojo
NarUtil.runCommand( "mt.exe", new String[] { "/manifest", manifest,
"/outputresource:" + dll + ";#2" }, null, null, getLog() );
if ( result != 0 )
+ {
throw new MojoFailureException( "MT.EXE failed with exit code: " + result );
+ }
}
}
}
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarGnuConfigureMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarGnuConfigureMojo.java
index f1462de..c2ad204 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarGnuConfigureMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarGnuConfigureMojo.java
@@ -59,10 +59,14 @@ public class NarGnuConfigureMojo
throws MojoExecutionException, MojoFailureException
{
if ( shouldSkip() )
+ {
return;
+ }
if ( !useGnu() )
+ {
return;
+ }
File targetDir = getGnuAOLSourceDirectory();
if ( gnuSourceDirectory.exists() )
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarGnuMakeMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarGnuMakeMojo.java
index 1500c60..08dd305 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarGnuMakeMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarGnuMakeMojo.java
@@ -39,10 +39,14 @@ public class NarGnuMakeMojo
throws MojoExecutionException, MojoFailureException
{
if ( shouldSkip() )
+ {
return;
+ }
if ( !useGnu() )
+ {
return;
+ }
File srcDir = getGnuAOLSourceDirectory();
if ( srcDir.exists() )
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarGnuProcess.java b/src/main/java/org/apache/maven/plugin/nar/NarGnuProcess.java
index 0a6aea4..b0de375 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarGnuProcess.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarGnuProcess.java
@@ -39,7 +39,9 @@ public class NarGnuProcess
throws MojoExecutionException, MojoFailureException
{
if ( shouldSkip() )
+ {
return;
+ }
File srcDir = getGnuAOLTargetDirectory();
if ( srcDir.exists() )
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarGnuResources.java b/src/main/java/org/apache/maven/plugin/nar/NarGnuResources.java
index ca914c6..133203a 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarGnuResources.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarGnuResources.java
@@ -39,7 +39,9 @@ public class NarGnuResources
throws MojoExecutionException, MojoFailureException
{
if ( shouldSkip() )
+ {
return;
+ }
if ( gnuSourceDirectory.exists() )
{
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarInfo.java b/src/main/java/org/apache/maven/plugin/nar/NarInfo.java
index 6a71a35..813bcd7 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarInfo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarInfo.java
@@ -193,7 +193,9 @@ public class NarInfo
public String getProperty( AOL aol, String key, String defaultValue )
{
if ( key == null )
+ {
return defaultValue;
+ }
String value = info.getProperty( key, defaultValue );
value = aol == null ? value : info.getProperty( aol.toString() + "." + key, value );
log.debug( "getProperty(" + aol + ", " + key + ", " + defaultValue + ") = " + value );
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarIntegrationTestMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarIntegrationTestMojo.java
index b81de03..d8b9858 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarIntegrationTestMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarIntegrationTestMojo.java
@@ -97,7 +97,9 @@ public class NarIntegrationTestMojo
{
Library lib = (Library) i.next();
if ( lib.getType().equals( Library.JNI ) )
+ {
return true;
+ }
}
return false;
}
@@ -591,13 +593,19 @@ public class NarIntegrationTestMojo
System.setProperties( originalSystemProperties );
}
- if ( result == 0 ) return;
+ if ( result == 0 )
+ {
+ return;
+ }
String msg;
if ( result == SurefireBooter.NO_TESTS_EXIT_CODE )
{
- if ( ( failIfNoTests == null ) || !failIfNoTests.booleanValue() ) return;
+ if ( ( failIfNoTests == null ) || !failIfNoTests.booleanValue() )
+ {
+ return;
+ }
// TODO: i18n
throw new MojoFailureException( "No tests were executed! (Set -DfailIfNoTests=false to ignore this error.)" );
} else {
@@ -919,7 +927,9 @@ public class NarIntegrationTestMojo
// DUNS
if ( project.getPackaging().equals( "nar" ) || ( getNarManager().getNarDependencies( "test" ).size() > 0 ) )
+ {
forkMode = "pertest";
+ }
fork.setForkMode( forkMode );
@@ -966,7 +976,9 @@ public class NarIntegrationTestMojo
// BEGINDUNS
if ( argLine == null )
+ {
argLine = "";
+ }
StringBuffer javaLibraryPath = new StringBuffer();
if ( testJNIModule() )
@@ -977,7 +989,9 @@ public class NarIntegrationTestMojo
{
getLog().debug( "Adding library directory to java.library.path: " + jniLibraryPathEntry );
if ( javaLibraryPath.length() > 0 )
+ {
javaLibraryPath.append( File.pathSeparator );
+ }
javaLibraryPath.append( jniLibraryPathEntry );
}
@@ -986,7 +1000,9 @@ public class NarIntegrationTestMojo
{
getLog().debug( "Adding library directory to java.library.path: " + sharedLibraryPathEntry );
if ( javaLibraryPath.length() > 0 )
+ {
javaLibraryPath.append( File.pathSeparator );
+ }
javaLibraryPath.append( sharedLibraryPathEntry );
}
@@ -1019,7 +1035,9 @@ public class NarIntegrationTestMojo
{
getLog().debug( "Adding dependency directory to java.library.path: " + depLibPathEntry );
if ( javaLibraryPath.length() > 0 )
+ {
javaLibraryPath.append( File.pathSeparator );
+ }
javaLibraryPath.append( depLibPathEntry );
}
}
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarJavahMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarJavahMojo.java
index 474eb8b..24c7d6c 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarJavahMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarJavahMojo.java
@@ -53,7 +53,9 @@ public class NarJavahMojo
throws MojoExecutionException, MojoFailureException
{
if ( shouldSkip() )
+ {
return;
+ }
getJavah().execute();
}
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarManager.java b/src/main/java/org/apache/maven/plugin/nar/NarManager.java
index 39cd096..e0b4ccb 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarManager.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarManager.java
@@ -112,7 +112,9 @@ public class NarManager
{
List artifactList = getAttachedNarDependencies( dependency, defaultAOL, narTypes[j] );
if ( artifactList != null )
+ {
attachedNarDependencies.put( narTypes[j], artifactList );
+ }
}
}
return attachedNarDependencies;
@@ -211,7 +213,9 @@ public class NarManager
{
log.debug( " Checking: " + nars[j] );
if ( nars[j].equals( "" ) )
+ {
continue;
+ }
String[] nar = nars[j].split( ":", 5 );
if ( nar.length >= 4 )
{
@@ -255,7 +259,10 @@ public class NarManager
dependency.isSnapshot();
File file = new File( repository.getBasedir(), repository.pathOf( dependency ) );
- if (!file.exists()) return null;
+ if (!file.exists())
+ {
+ return null;
+ }
JarFile jar = null;
try
@@ -264,7 +271,9 @@ public class NarManager
NarInfo info =
new NarInfo( dependency.getGroupId(), dependency.getArtifactId(), dependency.getVersion(), log );
if ( !info.exists( jar ) )
+ {
return null;
+ }
info.read( jar );
return info;
}
@@ -322,7 +331,7 @@ public class NarManager
log.debug( "Download called with classifier: " + classifier + " for NarDependencies {" );
for ( Iterator i = dependencies.iterator(); i.hasNext(); )
{
- log.debug( " - " + ( (Artifact) i.next() ) );
+ log.debug( " - " + ( i.next() ) );
}
log.debug( "}" );
@@ -354,7 +363,7 @@ public class NarManager
log.debug( "Unpack called for OS: " + os + ", classifier: " + classifier + " for NarArtifacts {" );
for ( Iterator i = narArtifacts.iterator(); i.hasNext(); )
{
- log.debug( " - " + ( (NarArtifact) i.next() ) );
+ log.debug( " - " + ( i.next() ) );
}
log.debug( "}" );
// FIXME, kludge to get to download the -noarch, based on classifier
@@ -366,7 +375,7 @@ public class NarManager
File file = getNarFile( dependency );
File narLocation = new File( file.getParentFile(), "nar" );
File flagFile =
- new File( narLocation, FileUtils.basename( file.getPath(), "." + AbstractNarMojo.NAR_EXTENSION )
+ new File( narLocation, FileUtils.basename( file.getPath(), "." + NarConstants.NAR_EXTENSION )
+ ".flag" );
boolean process = false;
@@ -426,7 +435,7 @@ public class NarManager
try
{
UnArchiver unArchiver;
- unArchiver = manager.getUnArchiver( AbstractNarMojo.NAR_ROLE_HINT );
+ unArchiver = manager.getUnArchiver( NarConstants.NAR_ROLE_HINT );
unArchiver.setSourceFile( file );
unArchiver.setDestDirectory( location );
unArchiver.extract();
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarPackageMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarPackageMojo.java
index 49f129e..2bd0d41 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarPackageMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarPackageMojo.java
@@ -49,7 +49,9 @@ public class NarPackageMojo
throws MojoExecutionException, MojoFailureException
{
if ( shouldSkip() )
+ {
return;
+ }
// Avoid that -DupdateReleaseInfo copies to a .nar file
getMavenProject().getArtifact().setArtifactHandler( new NarArtifactHandler() );
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarResourcesMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarResourcesMojo.java
index 2c2a9b1..1f2d5ae 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarResourcesMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarResourcesMojo.java
@@ -58,7 +58,9 @@ public class NarResourcesMojo
throws MojoExecutionException, MojoFailureException
{
if ( shouldSkip() )
+ {
return;
+ }
// scan resourceDirectory for AOLs
File aolDir = new File( resourceDirectory, "aol" );
@@ -69,7 +71,9 @@ public class NarResourcesMojo
{
// copy only resources of current AOL
if ( resourcesCopyAOL && ( !aol[i].equals( getAOL().toString() ) ) )
+ {
continue;
+ }
boolean ignore = false;
for ( Iterator j = FileUtils.getDefaultExcludesAsList().iterator(); j.hasNext(); )
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarSystemMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarSystemMojo.java
index 57b3069..47e969f 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarSystemMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarSystemMojo.java
@@ -44,7 +44,9 @@ public class NarSystemMojo
throws MojoExecutionException, MojoFailureException
{
if ( shouldSkip() )
+ {
return;
+ }
// get packageName if specified for JNI.
String packageName = null;
@@ -64,7 +66,9 @@ public class NarSystemMojo
}
if ( !jniFound || packageName == null)
+ {
return;
+ }
// make sure destination is there
narSystemDirectory.mkdirs();
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarTestCompileMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarTestCompileMojo.java
index 34514d1..96b369f 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarTestCompileMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarTestCompileMojo.java
@@ -53,7 +53,9 @@ public class NarTestCompileMojo
throws MojoExecutionException, MojoFailureException
{
if ( shouldSkip() )
+ {
return;
+ }
// make sure destination is there
getTargetDirectory().mkdirs();
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarTestMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarTestMojo.java
index d0aecee..b9ecafc 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarTestMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarTestMojo.java
@@ -57,7 +57,9 @@ public class NarTestMojo
throws MojoExecutionException, MojoFailureException
{
if ( shouldSkip() )
+ {
return;
+ }
// run all tests
for ( Iterator i = getTests().iterator(); i.hasNext(); )
@@ -87,8 +89,10 @@ public class NarTestMojo
NarUtil.runCommand( name, (String[]) args.toArray( new String[args.size()] ), workingDir,
generateEnvironment( test, getLog() ), getLog() );
if ( result != 0 )
+ {
throw new MojoFailureException( "Test " + name + " failed with exit code: " + result + " 0x"
+ Integer.toHexString( result ) );
+ }
}
}
@@ -108,8 +112,10 @@ public class NarTestMojo
NarUtil.runCommand( executable.getPath(), (String[]) args.toArray( new String[args.size()] ), null,
generateEnvironment( library, getLog() ), getLog() );
if ( result != 0 )
+ {
throw new MojoFailureException( "Test " + executable + " failed with exit code: " + result + " 0x"
+ Integer.toHexString( result ) );
+ }
}
}
@@ -167,7 +173,9 @@ public class NarTestMojo
{
sharedPath += ( (File) i.next() ).getPath();
if ( i.hasNext() )
+ {
sharedPath += File.pathSeparator;
+ }
}
String sharedEnv = NarUtil.addLibraryPathToEnv( sharedPath, null, getOS() );
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarUnpackMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarUnpackMojo.java
index 091e102..6f1da03 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarUnpackMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarUnpackMojo.java
@@ -59,7 +59,9 @@ public class NarUnpackMojo
throws MojoExecutionException, MojoFailureException
{
if ( shouldSkip() )
+ {
return;
+ }
List narArtifacts = getNarManager().getNarDependencies( "compile" );
if ( classifiers == null )
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarUtil.java b/src/main/java/org/apache/maven/plugin/nar/NarUtil.java
index 049cdde..a18c97c 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarUtil.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarUtil.java
@@ -57,7 +57,9 @@ public class NarUtil
defaults = PropertyUtils.loadProperties( NarUtil.class.getResourceAsStream( "aol.properties" ) );
}
if ( defaults == null )
+ {
throw new MojoFailureException( "NAR: Could not load default properties file: 'aol.properties'." );
+ }
return defaults;
}
@@ -70,11 +72,17 @@ public class NarUtil
os = System.getProperty( "os.name" );
String name = os.toLowerCase();
if ( name.startsWith( "windows" ) )
+ {
os = OS.WINDOWS;
+ }
if ( name.startsWith( "linux" ) )
+ {
os = OS.LINUX;
+ }
if ( name.equals( "mac os x" ) )
+ {
os = OS.MACOSX;
+ }
}
return os;
}
@@ -141,7 +149,9 @@ public class NarUtil
throws MojoExecutionException, MojoFailureException
{
if ( !file.exists() )
+ {
return;
+ }
if ( file.isDirectory() )
{
@@ -246,7 +256,9 @@ public class NarUtil
{
int slashEIndex = s.indexOf( "\\E" );
if ( slashEIndex == -1 )
+ {
return "\\Q" + s + "\\E";
+ }
StringBuffer sb = new StringBuffer( s.length() * 2 );
sb.append( "\\Q" );
@@ -267,7 +279,9 @@ public class NarUtil
private static String quoteReplacement( String s )
{
if ( ( s.indexOf( '\\' ) == -1 ) && ( s.indexOf( '$' ) == -1 ) )
+ {
return s;
+ }
StringBuffer sb = new StringBuffer();
for ( int i = 0; i < s.length(); i++ )
{
@@ -462,7 +476,9 @@ public class NarUtil
{
String[] nameValue = env[i].split( "=", 2 );
if ( nameValue.length < 2 )
+ {
throw new MojoFailureException( " Misformed env: '" + env[i] + "'" );
+ }
dbg.println( " '" + nameValue[0] + "=" + nameValue[1] + "'" );
cmdLine.addEnvironment( nameValue[0], nameValue[1] );
}
diff --git a/src/main/java/org/apache/maven/plugin/nar/Test.java b/src/main/java/org/apache/maven/plugin/nar/Test.java
index e943c6b..139867f 100644
--- a/src/main/java/org/apache/maven/plugin/nar/Test.java
+++ b/src/main/java/org/apache/maven/plugin/nar/Test.java
@@ -66,7 +66,9 @@ public class Test
throws MojoFailureException
{
if ( name == null )
+ {
throw new MojoFailureException( "NAR: Please specify <Name> as part of <Test>" );
+ }
return name;
}