diff options
Diffstat (limited to 'src/main')
4 files changed, 16 insertions, 17 deletions
diff --git a/src/main/java/org/apache/maven/plugin/nar/Library.java b/src/main/java/org/apache/maven/plugin/nar/Library.java index b5a7dee..5a41090 100644 --- a/src/main/java/org/apache/maven/plugin/nar/Library.java +++ b/src/main/java/org/apache/maven/plugin/nar/Library.java @@ -86,7 +86,7 @@ public class Library * @parameter expression="${project.build.dir}/nar/nar-generated" * @required */ - protected String narSystemDirectory = "target/nar/nar-generated"; + protected String narSystemDirectory = "nar-generated"; /** * When true and if type is "executable" run this executable. Defaults to false; 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 b6ad1b4..50ba046 100644 --- a/src/main/java/org/apache/maven/plugin/nar/NarAssemblyMojo.java +++ b/src/main/java/org/apache/maven/plugin/nar/NarAssemblyMojo.java @@ -87,7 +87,7 @@ public class NarAssemblyMojo 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/" ); + File dstDir = getTargetDirectory(); try { FileUtils.mkdir( dstDir.getPath() ); 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 13d4e18..57b3069 100644 --- a/src/main/java/org/apache/maven/plugin/nar/NarSystemMojo.java +++ b/src/main/java/org/apache/maven/plugin/nar/NarSystemMojo.java @@ -49,7 +49,7 @@ public class NarSystemMojo // get packageName if specified for JNI. String packageName = null; String narSystemName = null; - String narSystemDirectory = null; + File narSystemDirectory = null; boolean jniFound = false; for ( Iterator i = getLibraries().iterator(); !jniFound && i.hasNext(); ) { @@ -58,7 +58,7 @@ public class NarSystemMojo { packageName = library.getNarSystemPackage(); narSystemName = library.getNarSystemName(); - narSystemDirectory = library.getNarSystemDirectory(); + narSystemDirectory = new File(getTargetDirectory(), library.getNarSystemDirectory()); jniFound = true; } } @@ -66,14 +66,12 @@ public class NarSystemMojo if ( !jniFound || packageName == null) return; - File narSystemTarget = new File(getMavenProject().getBasedir(), narSystemDirectory); - // make sure destination is there - narSystemTarget.mkdirs(); + narSystemDirectory.mkdirs(); - getMavenProject().addCompileSourceRoot( narSystemTarget.getPath() ); + getMavenProject().addCompileSourceRoot( narSystemDirectory.getPath() ); - File fullDir = new File( narSystemTarget, packageName.replace( '.', '/' ) ); + File fullDir = new File( narSystemDirectory, packageName.replace( '.', '/' ) ); fullDir.mkdirs(); File narSystem = new File( fullDir, narSystemName + ".java" ); 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 bc7d487..215771d 100644 --- a/src/main/java/org/apache/maven/plugin/nar/NarTestMojo.java +++ b/src/main/java/org/apache/maven/plugin/nar/NarTestMojo.java @@ -77,15 +77,14 @@ public class NarTestMojo // run if requested if ( test.shouldRun() ) { - String name = "target/test-nar/bin/" + getAOL() + "/" + test.getName(); + String name = getTargetDirectory().getPath() + "/bin/" + getAOL() + "/" + test.getName(); getLog().info( "Running test " + name ); File workingDir = getMavenProject().getBasedir(); getLog().info( " in " + workingDir ); List args = test.getArgs(); int result = - NarUtil.runCommand( getMavenProject().getBasedir() + "/" + name, - (String[]) args.toArray( new String[args.size()] ), workingDir, + 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" @@ -100,12 +99,13 @@ public class NarTestMojo { MavenProject project = getMavenProject(); // FIXME NAR-90, we could make dure we get the final name from layout - File executable = new File(getLayout().getLibDirectory( super.getTargetDirectory(), getAOL().toString(), library.getType() ), project.getArtifactId() ); + File executable = + new File( getLayout().getLibDirectory( super.getTargetDirectory(), getAOL().toString(), + library.getType() ), project.getArtifactId() ); getLog().info( "Running executable " + executable ); List args = library.getArgs(); int result = - NarUtil.runCommand( executable.getPath(), - (String[]) args.toArray( new String[args.size()] ), null, + 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" @@ -131,8 +131,9 @@ public class NarTestMojo Library lib = (Library) i.next(); if ( lib.getType().equals( Library.SHARED ) ) { - File path = getLayout().getLibDirectory( super.getTargetDirectory(), getAOL().toString(), lib.getType() ); - getLog().debug( "Adding path to shared library: "+path ); + File path = + getLayout().getLibDirectory( super.getTargetDirectory(), getAOL().toString(), lib.getType() ); + getLog().debug( "Adding path to shared library: " + path ); sharedPaths.add( path ); } } |