jvanzyl 2004/02/04 11:05:47
Modified: maven-project project.xml
maven-project/src/java/org/apache/maven/project
MavenProject.java
Log:
o packaging component descriptor in JAR so plexus can find it.
Revision Changes Path
1.13 +13 -14 maven-components/maven-project/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/maven-components/maven-project/project.xml,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- project.xml 18 Jan 2004 22:11:32 -0000 1.12
+++ project.xml 4 Feb 2004 19:05:47 -0000 1.13
@@ -10,7 +10,7 @@
<gumpRepositoryId>jakarta</gumpRepositoryId>
<description>Maven is a project management and project comprehension tool. Maven
is based on the concept of a project object model: builds, documentation creation,
site publication, and distribution publication are all controlled from the project
object model. Maven also provides tools to create source metrics, change logs based
directly on source repository, and source cross-references.</description>
<shortDescription>Java Project Management Tools</shortDescription>
-
+
<versions/>
<branches/>
@@ -32,7 +32,7 @@
</roles>
</developer>
</developers>
-
+
<contributors/>
<dependencies>
@@ -48,7 +48,7 @@
<artifactId>maven-model-xpp3</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
-
+
<dependency>
<groupId>plexus</groupId>
<artifactId>plexus</artifactId>
@@ -66,17 +66,17 @@
<dependency>
<groupId>classworlds</groupId>
<artifactId>classworlds</artifactId>
- <version>1.0</version>
+ <version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>xpp3</groupId>
<artifactId>xpp3</artifactId>
- <version>1.1.2a</version>
+ <version>1.1.3.3</version>
</dependency>
-
+
</dependencies>
-
+
<build>
<nagEmailAddress>[EMAIL PROTECTED]</nagEmailAddress>
<sourceDirectory>src/java</sourceDirectory>
@@ -86,7 +86,6 @@
<includes>
<include>**/*Test.java</include>
</includes>
-
<resources>
<resource>
<directory>src/test</directory>
@@ -98,13 +97,13 @@
<directory>src/test-properties</directory>
</resource>
</resources>
-
</unitTest>
-
- <resources/>
-
+ <resources>
+ <resource>
+ <directory>src/meta-inf</directory>
+ <targetPath>META-INF/plexus</targetPath>
+ </resource>
+ </resources>
</build>
-
<reports/>
-
</project>
1.3 +73 -6
maven-components/maven-project/src/java/org/apache/maven/project/MavenProject.java
Index: MavenProject.java
===================================================================
RCS file:
/home/cvs/maven-components/maven-project/src/java/org/apache/maven/project/MavenProject.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MavenProject.java 26 Jan 2004 11:01:23 -0000 1.2
+++ MavenProject.java 4 Feb 2004 19:05:47 -0000 1.3
@@ -12,6 +12,7 @@
import org.apache.maven.model.Repository;
import org.apache.maven.model.Version;
import org.apache.maven.model.Resource;
+import org.apache.maven.artifact.MavenArtifact;
import org.codehaus.plexus.util.StringUtils;
import java.io.File;
@@ -203,6 +204,9 @@
// Test and compile sourceroots.
// ----------------------------------------------------------------------
+ //!!! Refactor, collect the list of compile source roots and create a
path1:path2
+ // type construct from the list instead of the other way around. jvz.
+
private static String PS = System.getProperty( "path.separator" );
private String compileSourceRoots = "";
@@ -211,12 +215,22 @@
public void addCompileSourceRoot( String path )
{
- compileSourceRoots += PS + path;
+ if ( path != null || path.trim().length() != 0 )
+ {
+ compileSourceRoots += path + PS;
+ }
}
public String getCompileSourceRoots()
{
- return compileSourceRoots;
+ // Get rid of any trailing path separators.
+ if ( compileSourceRoots.endsWith( PS ) )
+ {
+ compileSourceRoots = compileSourceRoots.substring( 0,
compileSourceRoots.length() - 1 );
+ }
+
+ // Always add the build.sourceDirectory
+ return getBuild().getSourceDirectory() + PS + compileSourceRoots;
}
public List getCompileSourceRootsList()
@@ -235,13 +249,23 @@
public void addTestCompileSourceRoot( String path )
{
- testCompileSourceRoots += PS + path;
+ if ( path != null || path.trim().length() != 0 )
+ {
+ testCompileSourceRoots += path + PS;
+ }
}
public String getTestCompileSourceRoots()
{
- return testCompileSourceRoots;
+ // Get rid of any trailing path separators.
+ if ( testCompileSourceRoots.endsWith( PS ) )
+ {
+ testCompileSourceRoots = testCompileSourceRoots.substring( 0,
testCompileSourceRoots.length() - 1 );
+ }
+
+ // Always add the build.unitTestSourceDirectory
+ return getBuild().getUnitTestSourceDirectory() + PS +
testCompileSourceRoots;
}
public List getTestCompileSourceRootsList()
@@ -258,6 +282,49 @@
return list;
}
+ public String getDependencyClasspath()
+ {
+ StringBuffer classpath = new StringBuffer();
+
+ for ( Iterator i = getArtifacts().iterator(); i.hasNext(); )
+ {
+ MavenArtifact artifact = (MavenArtifact) i.next();
+
+ Dependency d = artifact.getDependency();
+
+ if ( isAddedToClasspath( d ) )
+ {
+ classpath.append( artifact.getPath() ).append( PS );
+ }
+ }
+
+ return classpath.toString();
+ }
+
+ public boolean isAddedToClasspath( Dependency dependency )
+ {
+ String type = dependency.getType().trim();
+
+ if ( type.equals( "jar" ) || type.equals( "ejb" ) )
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ public boolean isPlugin( Dependency dependency )
+ {
+ String type = dependency.getType().trim();
+
+ if ( type != null )
+ {
+ return type.equals( "plugin" );
+ }
+
+ return false;
+ }
+
// ----------------------------------------------------------------------
// Delegate to the model
// ----------------------------------------------------------------------
@@ -509,7 +576,7 @@
public Build getBuild()
{
- if ( ! alignedToBaseDirectory )
+ if ( !alignedToBaseDirectory )
{
alignToBaseDirectory();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]