o give mboot enough smarts to simulate this:

<project>
  <build>
    <sourceDirectory>src/main/java</sourceDirectory>
    <unitTestSourceDirectory>src/test/java</unitTestSourceDirectory>
    <unitTest>
      <includes>
        <include>**/*Test.java</include>
      </includes>
      <excludes>
        <exclude>**/*Abstract*.java</exclude>
      </excludes>
      <resource>
        <directory>src/test/resources</directory>
      </resource>
    </unitTest>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
      </resource>
    </resources>
  </build>
</project>

being the parent model.


git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@162619 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2004-03-21 03:58:28 +00:00
parent 12dca611b8
commit 9c52342203
3 changed files with 33 additions and 36 deletions

View File

@ -172,7 +172,7 @@ buildMavenProject()
# Look for source directory in project.xml
sourceDirectory=`grep sourceDirectory project.xml | sed -e 's/^*//;s/<sourceDirectory>//;s/<\/sourceDirectory>//;s/\${basedir}\///'`
[ -z $sourceDirectory ] && sourceDirectory=src/main
[ -z $sourceDirectory ] && sourceDirectory=src/main/java
buildDir=target
buildDest=target/classes
@ -180,7 +180,7 @@ buildMavenProject()
# Look for unit test source directory in project.xml
unitTestSourceDirectory=`grep unitTestSourceDirectory project.xml | sed -e 's/^*//;s/<unitTestSourceDirectory>//;s/<\/unitTestSourceDirectory>//;s/\${basedir}\///'`
[ -z $unitTestSourceDirectory ] && unitTestSourceDirectory=src/test
[ -z $unitTestSourceDirectory ] && unitTestSourceDirectory=src/test/java
buildTestDest=target/test-classes

View File

@ -214,30 +214,6 @@ public class ArtifactDownloader
return fileFound;
}
/**
* <p>Replaces all occurrences of a String within another String.</p>
*
* This methods comes from Commons Lang
*
* <p>A <code>null</code> reference passed to this method is a no-op.</p>
*
* <pre>
* StringUtils.replace(null, *, *) = null
* StringUtils.replace("", *, *) = ""
* StringUtils.replace("any", null, *) = "any"
* StringUtils.replace("any", *, null) = "any"
* StringUtils.replace("any", "", *) = "any"
* StringUtils.replace("aba", "a", null) = "aba"
* StringUtils.replace("aba", "a", "") = "b"
* StringUtils.replace("aba", "a", "z") = "zbz"
* </pre>
*
* @param text text to search and replace in, may be null
* @param repl the String to search for, may be null
* @param with the String to replace with, may be null
* @return the text with any replacements processed,
* <code>null</code> if null String input
*/
private String replace( String text, String repl, String with )
{
StringBuffer buf = new StringBuffer( text.length() );

View File

@ -1,3 +1,4 @@
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXParseException;
@ -28,8 +29,6 @@ public class Bootstrapper
private UnitTests unitTests;
private List resources;
private Properties properties;
public static void main( String[] args )
@ -59,7 +58,14 @@ public class Bootstrapper
writeUnitTest();
writeResources( bootstrapPomParser.getResources(), "bootstrap.resources" );
if ( bootstrapPomParser.getResources().size() == 0 )
{
writeFile( "bootstrap.resources", "src/main/resources@'*'" );
}
else
{
writeResources( bootstrapPomParser.getResources(), "bootstrap.resources" );
}
writeFile( "bootstrap.repo", downloader.getMavenRepoLocal().getPath() );
}
@ -88,9 +94,9 @@ public class Bootstrapper
StringBuffer deps = new StringBuffer();
String repoLocal = replace(downloader.getMavenRepoLocal().getPath(), "\\", "/");
String repoLocal = replace( downloader.getMavenRepoLocal().getPath(), "\\", "/" );
String classpathSeparator;
if (repoLocal.indexOf(":") != -1) //Windows
if ( repoLocal.indexOf( ":" ) != -1 ) //Windows
{
classpathSeparator = ";";
}
@ -98,11 +104,11 @@ public class Bootstrapper
{
classpathSeparator = ":";
}
for ( Iterator i = dependencies.iterator(); i.hasNext(); )
{
Dependency d = (Dependency) i.next();
classPath.append( repoLocal + "/" + getArtifactPath( d, "/" ) + classpathSeparator );
libs.append( repoLocal + "/" + getArtifactPath( d, "/" ) + "\n" );
@ -137,7 +143,7 @@ public class Bootstrapper
// If there are no unitTestIncludes specified then we want it all.
if ( size == 0 )
{
tests.append( "'*'" );
tests.append( "'*Test.java'" );
}
for ( int j = 0; j < size; j++ )
@ -164,6 +170,11 @@ public class Bootstrapper
size = unitTests.getExcludes().size();
if ( size == 0 )
{
tests.append( "*Abstract*.java'" );
}
for ( int j = 0; j < size; j++ )
{
String exclude = (String) unitTests.getExcludes().get( j );
@ -182,6 +193,14 @@ public class Bootstrapper
writeResources( unitTests.getResources(), "bootstrap.tests.resources" );
}
else
{
writeFile( "bootstrap.tests.includes", "target/test-classes@**/*Test.java" );
writeFile( "bootstrap.tests.excludes", "target/test-classes@**/*Abstract*.java" );
writeFile( "bootstrap.tests.resources", "src/test/resources@'*'" );
}
}
private void writeResources( List resources, String file )
@ -248,6 +267,8 @@ public class Bootstrapper
writer.write( contents );
writer.flush();
writer.close();
}
@ -449,7 +470,7 @@ public class Bootstrapper
{
if ( rawName.equals( "extend" ) )
{
String extend = interpolate( getBodyText(), properties ) ;
String extend = interpolate( getBodyText(), properties );
File f = new File( file.getParentFile(), extend );
@ -530,7 +551,7 @@ public class Bootstrapper
currentResource.addExclude( getBodyText() );
}
}
else if ( ! insideResource && insideUnitTest )
else if ( !insideResource && insideUnitTest )
{
if ( rawName.equals( "include" ) )
{