You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by jv...@apache.org on 2004/03/21 04:58:28 UTC
cvs commit: maven-components/maven-mboot/src/main ArtifactDownloader.java Bootstrapper.java
jvanzyl 2004/03/20 19:58:28
Modified: maven-mboot/src/bash maven.functions
maven-mboot/src/main ArtifactDownloader.java
Bootstrapper.java
Log:
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.
Revision Changes Path
1.30 +2 -2 maven-components/maven-mboot/src/bash/maven.functions
Index: maven.functions
===================================================================
RCS file: /home/cvs/maven-components/maven-mboot/src/bash/maven.functions,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- maven.functions 10 Mar 2004 00:01:48 -0000 1.29
+++ maven.functions 21 Mar 2004 03:58:28 -0000 1.30
@@ -172,7 +172,7 @@
# 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 @@
# 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
1.3 +0 -24 maven-components/maven-mboot/src/main/ArtifactDownloader.java
Index: ArtifactDownloader.java
===================================================================
RCS file: /home/cvs/maven-components/maven-mboot/src/main/ArtifactDownloader.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ArtifactDownloader.java 7 Feb 2004 16:17:49 -0000 1.2
+++ ArtifactDownloader.java 21 Mar 2004 03:58:28 -0000 1.3
@@ -214,30 +214,6 @@
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() );
1.18 +31 -10 maven-components/maven-mboot/src/main/Bootstrapper.java
Index: Bootstrapper.java
===================================================================
RCS file: /home/cvs/maven-components/maven-mboot/src/main/Bootstrapper.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- Bootstrapper.java 13 Feb 2004 21:20:58 -0000 1.17
+++ Bootstrapper.java 21 Mar 2004 03:58:28 -0000 1.18
@@ -1,3 +1,4 @@
+
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXParseException;
@@ -28,8 +29,6 @@
private UnitTests unitTests;
- private List resources;
-
private Properties properties;
public static void main( String[] args )
@@ -59,7 +58,14 @@
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 @@
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 @@
{
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 @@
// 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 @@
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 @@
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 @@
writer.write( contents );
+ writer.flush();
+
writer.close();
}
@@ -449,7 +470,7 @@
{
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 @@
currentResource.addExclude( getBodyText() );
}
}
- else if ( ! insideResource && insideUnitTest )
+ else if ( !insideResource && insideUnitTest )
{
if ( rawName.equals( "include" ) )
{
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org