PR: MNG-897

Fixing abstract scripted mojo descriptor extractor to properly construct script resource directories. Also, cleaned up the usage integration test. Ant support works now, but we need to decide what version this should be released under. It will involve re-releasing the plugin-plugin, to take advantage of the new maven-plugin-tools-api, I think.



git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@329948 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2005-11-01 01:25:19 +00:00
parent 3889f9ac96
commit 896baf2832
3 changed files with 11 additions and 8 deletions

View File

@ -25,6 +25,7 @@
</dependencies>
<build>
<scriptSourceDirectory>src/main/scripts</scriptSourceDirectory>
<plugins>
<plugin>
<artifactId>maven-plugin-plugin</artifactId>

View File

@ -32,14 +32,14 @@
</dependency>
</dependencies>
<!-- configuration>
<configuration>
<name>Hani</name>
</configuration -->
</configuration>
<executions>
<execution>
<id>test</id>
<phase>install</phase>
<phase>package</phase>
<goals>
<goal>test</goal>
</goals>

View File

@ -31,13 +31,13 @@ public abstract class AbstractScriptedMojoDescriptorExtractor
String scriptExtension = getScriptFileExtension();
Map scriptFilesKeyedByBasedir =
gatherFilesByBasedir( project.getScriptSourceRoots(), scriptExtension );
gatherFilesByBasedir( project.getBasedir(), project.getScriptSourceRoots(), scriptExtension );
List mojoDescriptors;
if ( !StringUtils.isEmpty( metadataExtension ) )
{
Map metadataFilesKeyedByBasedir =
gatherFilesByBasedir( project.getScriptSourceRoots(), metadataExtension );
gatherFilesByBasedir( project.getBasedir(), project.getScriptSourceRoots(), metadataExtension );
mojoDescriptors = extractMojoDescriptorsFromMetadata( metadataFilesKeyedByBasedir, pluginDescriptor );
}
@ -100,7 +100,7 @@ public abstract class AbstractScriptedMojoDescriptorExtractor
}
}
protected Map gatherFilesByBasedir( List directories, String scriptFileExtension )
protected Map gatherFilesByBasedir( File basedir, List directories, String scriptFileExtension )
{
Map sourcesByBasedir = new TreeMap();
@ -109,7 +109,8 @@ public abstract class AbstractScriptedMojoDescriptorExtractor
Set sources = new HashSet();
String resourceDir = (String) it.next();
File dir = new File( resourceDir ).getAbsoluteFile();
File dir = new File( basedir, resourceDir ).getAbsoluteFile();
resourceDir = dir.getPath();
@ -119,6 +120,7 @@ public abstract class AbstractScriptedMojoDescriptorExtractor
scanner.setBasedir( dir );
scanner.addDefaultExcludes();
scanner.setIncludes( new String[] { "**/*" + scriptFileExtension } );
scanner.scan();
String[] relativePaths = scanner.getIncludedFiles();