mirror of https://github.com/apache/maven.git
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:
parent
3889f9ac96
commit
896baf2832
|
@ -25,6 +25,7 @@
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
<scriptSourceDirectory>src/main/scripts</scriptSourceDirectory>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-plugin-plugin</artifactId>
|
<artifactId>maven-plugin-plugin</artifactId>
|
||||||
|
|
|
@ -32,14 +32,14 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<!-- configuration>
|
<configuration>
|
||||||
<name>Hani</name>
|
<name>Hani</name>
|
||||||
</configuration -->
|
</configuration>
|
||||||
|
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>test</id>
|
<id>test</id>
|
||||||
<phase>install</phase>
|
<phase>package</phase>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>test</goal>
|
<goal>test</goal>
|
||||||
</goals>
|
</goals>
|
||||||
|
|
|
@ -31,13 +31,13 @@ public abstract class AbstractScriptedMojoDescriptorExtractor
|
||||||
String scriptExtension = getScriptFileExtension();
|
String scriptExtension = getScriptFileExtension();
|
||||||
|
|
||||||
Map scriptFilesKeyedByBasedir =
|
Map scriptFilesKeyedByBasedir =
|
||||||
gatherFilesByBasedir( project.getScriptSourceRoots(), scriptExtension );
|
gatherFilesByBasedir( project.getBasedir(), project.getScriptSourceRoots(), scriptExtension );
|
||||||
|
|
||||||
List mojoDescriptors;
|
List mojoDescriptors;
|
||||||
if ( !StringUtils.isEmpty( metadataExtension ) )
|
if ( !StringUtils.isEmpty( metadataExtension ) )
|
||||||
{
|
{
|
||||||
Map metadataFilesKeyedByBasedir =
|
Map metadataFilesKeyedByBasedir =
|
||||||
gatherFilesByBasedir( project.getScriptSourceRoots(), metadataExtension );
|
gatherFilesByBasedir( project.getBasedir(), project.getScriptSourceRoots(), metadataExtension );
|
||||||
|
|
||||||
mojoDescriptors = extractMojoDescriptorsFromMetadata( metadataFilesKeyedByBasedir, pluginDescriptor );
|
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();
|
Map sourcesByBasedir = new TreeMap();
|
||||||
|
|
||||||
|
@ -109,7 +109,8 @@ public abstract class AbstractScriptedMojoDescriptorExtractor
|
||||||
Set sources = new HashSet();
|
Set sources = new HashSet();
|
||||||
|
|
||||||
String resourceDir = (String) it.next();
|
String resourceDir = (String) it.next();
|
||||||
File dir = new File( resourceDir ).getAbsoluteFile();
|
|
||||||
|
File dir = new File( basedir, resourceDir ).getAbsoluteFile();
|
||||||
|
|
||||||
resourceDir = dir.getPath();
|
resourceDir = dir.getPath();
|
||||||
|
|
||||||
|
@ -119,6 +120,7 @@ public abstract class AbstractScriptedMojoDescriptorExtractor
|
||||||
|
|
||||||
scanner.setBasedir( dir );
|
scanner.setBasedir( dir );
|
||||||
scanner.addDefaultExcludes();
|
scanner.addDefaultExcludes();
|
||||||
|
scanner.setIncludes( new String[] { "**/*" + scriptFileExtension } );
|
||||||
scanner.scan();
|
scanner.scan();
|
||||||
|
|
||||||
String[] relativePaths = scanner.getIncludedFiles();
|
String[] relativePaths = scanner.getIncludedFiles();
|
||||||
|
|
Loading…
Reference in New Issue