summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorMark Donszelmann <Mark.Donszelmann@gmail.com>2009-11-04 10:46:47 +0100
committerMark Donszelmann <Mark.Donszelmann@gmail.com>2009-11-04 10:46:47 +0100
commit9e80bf8629df3b01238778088b5444024036929a (patch)
treebd994c2ca9732944297cdc44969173da26d6443d /src/main
parent1f8cf28443f4d8b93534b8871bed6ac7b1c551d0 (diff)
downloadmaven-nar-plugin-9e80bf8629df3b01238778088b5444024036929a.tar.gz
maven-nar-plugin-9e80bf8629df3b01238778088b5444024036929a.tar.bz2
maven-nar-plugin-9e80bf8629df3b01238778088b5444024036929a.tar.xz
maven-nar-plugin-9e80bf8629df3b01238778088b5444024036929a.zip
Fixed NAR-101
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/Compiler.java34
1 files changed, 29 insertions, 5 deletions
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 13be6f3..9d4cb09 100644
--- a/src/main/java/org/apache/maven/plugin/nar/Compiler.java
+++ b/src/main/java/org/apache/maven/plugin/nar/Compiler.java
@@ -237,22 +237,46 @@ public abstract class Compiler
private List/* <File> */getSourceDirectories( String type )
{
List sourceDirectories = new ArrayList();
+ File baseDir = mojo.getMavenProject().getBasedir();
if ( type.equals( "test" ) )
{
if ( testSourceDirectory == null )
- testSourceDirectory = new File( mojo.getMavenProject().getBasedir(), "/src/test" );
- sourceDirectories.add( testSourceDirectory );
+ 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( mojo.getMavenProject().getBasedir(), "src/main" );
- sourceDirectories.add( sourceDirectory );
+ 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 );
+ }
}
// FIXME, see NAR-69
- sourceDirectories.add( new File( mojo.getMavenProject().getBasedir(), "target/swig" ) );
+ File swigDir = new File( baseDir, "target/swig" );
+ if ( swigDir.exists() )
+ sourceDirectories.add( swigDir );
+
+ if (mojo.getLog().isDebugEnabled()) {
+ for ( Iterator i = sourceDirectories.iterator(); i.hasNext(); )
+ mojo.getLog().debug( "Added to sourceDirectory: " + ((File)i.next()).getPath() );
+ }
return sourceDirectories;
}