summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Donszelmann <Mark.Donszelmann@gmail.com>2009-10-15 11:25:40 +0200
committerMark Donszelmann <Mark.Donszelmann@gmail.com>2009-10-15 11:25:40 +0200
commit49bf7a7f6574b9a7ed2733c51e51dbf42aa38e9e (patch)
tree91edbfb6d7867f6df71c8fc942a78c11b1448d97
parentd1c2f7dff3869526df12ec7b3e285a2144713d29 (diff)
downloadmaven-nar-plugin-49bf7a7f6574b9a7ed2733c51e51dbf42aa38e9e.tar.gz
maven-nar-plugin-49bf7a7f6574b9a7ed2733c51e51dbf42aa38e9e.tar.bz2
maven-nar-plugin-49bf7a7f6574b9a7ed2733c51e51dbf42aa38e9e.tar.xz
maven-nar-plugin-49bf7a7f6574b9a7ed2733c51e51dbf42aa38e9e.zip
Fixed NAR-2
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/AbstractCompileMojo.java15
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/Java.java4
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarInfo.java15
3 files changed, 19 insertions, 15 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 e949a40..ab43ddf 100644
--- a/src/main/java/org/apache/maven/plugin/nar/AbstractCompileMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/AbstractCompileMojo.java
@@ -23,6 +23,7 @@ import java.io.File;
import java.util.Collections;
import java.util.List;
+import org.apache.maven.plugin.MojoExecutionException;
import org.apache.tools.ant.Project;
/**
@@ -170,32 +171,32 @@ public abstract class AbstractCompileMojo
return fortran;
}
- protected int getMaxCores( AOL aol )
+ protected int getMaxCores( AOL aol ) throws MojoExecutionException
{
return getNarInfo().getProperty( aol, "maxCores", maxCores );
}
- protected boolean useLibtool( AOL aol )
+ protected boolean useLibtool( AOL aol ) throws MojoExecutionException
{
return getNarInfo().getProperty( aol, "libtool", libtool );
}
- protected boolean failOnError( AOL aol )
+ protected boolean failOnError( AOL aol ) throws MojoExecutionException
{
return getNarInfo().getProperty( aol, "failOnError", failOnError );
}
- protected String getRuntime( AOL aol )
+ protected String getRuntime( AOL aol ) throws MojoExecutionException
{
return getNarInfo().getProperty( aol, "runtime", runtime );
}
- protected String getOutput( AOL aol )
+ protected String getOutput( AOL aol ) throws MojoExecutionException
{
return getNarInfo().getProperty( aol, "output", output );
}
- protected File getJavaHome( AOL aol )
+ protected File getJavaHome( AOL aol ) throws MojoExecutionException
{
// FIXME should be easier by specifying default...
return getNarInfo().getProperty( aol, "javaHome", NarUtil.getJavaHome( javaHome, getOS() ) );
@@ -241,7 +242,7 @@ public abstract class AbstractCompileMojo
return dependencyLibOrder;
}
- protected NarInfo getNarInfo()
+ protected NarInfo getNarInfo() throws MojoExecutionException
{
if ( narInfo == null )
{
diff --git a/src/main/java/org/apache/maven/plugin/nar/Java.java b/src/main/java/org/apache/maven/plugin/nar/Java.java
index 98e48f2..ad35bd6 100644
--- a/src/main/java/org/apache/maven/plugin/nar/Java.java
+++ b/src/main/java/org/apache/maven/plugin/nar/Java.java
@@ -29,7 +29,9 @@ import net.sf.antcontrib.cpptasks.types.CommandLineArgument;
import net.sf.antcontrib.cpptasks.types.LibrarySet;
import net.sf.antcontrib.cpptasks.types.LinkerArgument;
+import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
+import org.apache.tools.ant.BuildException;
/**
* Java specifications for NAR
@@ -90,7 +92,7 @@ public class Java
}
public void addIncludePaths( CCTask task, String outType )
- throws MojoFailureException
+ throws MojoFailureException, BuildException, MojoExecutionException
{
if ( include || mojo.getJavah().getJniDirectory().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 a6d2861..6a71a35 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarInfo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarInfo.java
@@ -21,6 +21,7 @@ package org.apache.maven.plugin.nar;
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Iterator;
@@ -28,6 +29,7 @@ import java.util.Properties;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
+import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.logging.Log;
/**
@@ -44,7 +46,7 @@ public class NarInfo
private Log log;
- public NarInfo( String groupId, String artifactId, String version, Log log )
+ public NarInfo( String groupId, String artifactId, String version, Log log ) throws MojoExecutionException
{
this.groupId = groupId;
this.artifactId = artifactId;
@@ -54,20 +56,19 @@ public class NarInfo
// Fill with general properties.nar file
File propertiesDir = new File( "src/main/resources/META-INF/nar/" + groupId + "/" + artifactId );
- if ( !propertiesDir.exists() )
- {
- propertiesDir.mkdirs();
- }
File propertiesFile = new File( propertiesDir, NarInfo.NAR_PROPERTIES );
try
{
info.load( new FileInputStream( propertiesFile ) );
}
- catch ( IOException ioe )
+ catch ( FileNotFoundException e )
{
// ignored
}
-
+ catch ( IOException e )
+ {
+ throw new MojoExecutionException( "Problem loading "+propertiesFile, e );
+ }
}
public String toString()