summaryrefslogtreecommitdiff
path: root/src/main/java/org/apache
diff options
context:
space:
mode:
authorVolker Schumacher <volker@antenna500.local>2010-01-28 11:12:59 +0800
committerMark Donszelmann <Mark.Donszelmann@gmail.com>2010-01-28 16:20:37 +0800
commit961b66693792efe0f1d3d28c7f844e94728c3057 (patch)
tree71e3e500bfd79d3b3b414ad42727392977d94bf3 /src/main/java/org/apache
parent1db77c806e33a1f89519457317decea24c1ae054 (diff)
downloadmaven-nar-plugin-961b66693792efe0f1d3d28c7f844e94728c3057.tar.gz
maven-nar-plugin-961b66693792efe0f1d3d28c7f844e94728c3057.tar.bz2
maven-nar-plugin-961b66693792efe0f1d3d28c7f844e94728c3057.tar.xz
maven-nar-plugin-961b66693792efe0f1d3d28c7f844e94728c3057.zip
fixed loading of custom nar.properties
Diffstat (limited to 'src/main/java/org/apache')
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/AbstractCompileMojo.java14
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarInfo.java30
2 files changed, 29 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 876f152..cf3e2a0 100644
--- a/src/main/java/org/apache/maven/plugin/nar/AbstractCompileMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/AbstractCompileMojo.java
@@ -267,9 +267,17 @@ public abstract class AbstractCompileMojo
{
if ( narInfo == null )
{
- narInfo =
- new NarInfo( getMavenProject().getGroupId(), getMavenProject().getArtifactId(),
- getMavenProject().getVersion(), getLog() );
+ String groupId = getMavenProject().getGroupId();
+ String artifactId = getMavenProject().getArtifactId();
+
+ File propertiesDir = new File( getMavenProject().getBasedir(), "src/main/resources/META-INF/nar/" + groupId + "/" + artifactId );
+ File propertiesFile = new File( propertiesDir, NarInfo.NAR_PROPERTIES );
+
+ narInfo = new NarInfo(
+ groupId, artifactId,
+ getMavenProject().getVersion(),
+ getLog(),
+ propertiesFile );
}
return narInfo;
}
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 504d44e..9337ea3 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarInfo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarInfo.java
@@ -48,6 +48,11 @@ public class NarInfo
public NarInfo( String groupId, String artifactId, String version, Log log ) throws MojoExecutionException
{
+ this( groupId, artifactId, version, log, null );
+ }
+
+ public NarInfo( String groupId, String artifactId, String version, Log log, File propertiesFile ) throws MojoExecutionException
+ {
this.groupId = groupId;
this.artifactId = artifactId;
this.version = version;
@@ -55,19 +60,20 @@ public class NarInfo
info = new Properties();
// Fill with general properties.nar file
- File propertiesDir = new File( "src/main/resources/META-INF/nar/" + groupId + "/" + artifactId );
- File propertiesFile = new File( propertiesDir, NarInfo.NAR_PROPERTIES );
- try
- {
- info.load( new FileInputStream( propertiesFile ) );
- }
- catch ( FileNotFoundException e )
- {
- // ignored
- }
- catch ( IOException e )
+ if( propertiesFile != null )
{
- throw new MojoExecutionException( "Problem loading "+propertiesFile, e );
+ try
+ {
+ info.load( new FileInputStream( propertiesFile ) );
+ }
+ catch ( FileNotFoundException e )
+ {
+ // ignored
+ }
+ catch ( IOException e )
+ {
+ throw new MojoExecutionException( "Problem loading "+propertiesFile, e );
+ }
}
}