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/01/25 01:28:20 UTC
cvs commit: maven-components/maven-project/src/test/org/apache/maven/project DefaultProjectBuilderTest.java DefaultProjectBuilderTest.xml ProjectTestHelper.java
jvanzyl 2004/01/24 16:28:20
Modified: maven-project/src/test/org/apache/maven/project
DefaultProjectBuilderTest.java
DefaultProjectBuilderTest.xml
ProjectTestHelper.java
Added: maven-project/src/java/org/apache/maven/artifact
AbstractMavenArtifact.java
DefaultMavenArtifactFactory.java
DefaultMavenArtifactory.java
GenericMavenArtifact.java MavenArtifact.java
MavenArtifactory.java
maven-project/src/java/org/apache/maven/project
DefaultMavenProjectBuilder.java MavenProject.java
MavenProjectBuilder.java
Removed: maven-project/src/java/org/apache/maven/artifact
AbstractArtifact.java Artifact.java
Artifactory.java DefaultArtifactFactory.java
DefaultArtifactory.java GenericArtifact.java
maven-project/src/java/org/apache/maven/project
DefaultProjectBuilder.java Project.java
ProjectBuilder.java
Log:
o we will avoid overloaded term artifact and project and use a maven
prefix 1) to provide a name with a context and 2) prevent classes when
the old and new run together which was the original impetus for this
change.
Revision Changes Path
1.1 maven-components/maven-project/src/java/org/apache/maven/artifact/AbstractMavenArtifact.java
Index: AbstractMavenArtifact.java
===================================================================
package org.apache.maven.artifact;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Maven" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Maven", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
import org.apache.maven.model.Dependency;
import java.io.File;
import java.io.IOException;
import java.io.FileInputStream;
/**
* Base class from which all artifact subclasses are derived.
*
* @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
* @version $Id: AbstractMavenArtifact.java,v 1.1 2004/01/25 00:28:20 jvanzyl Exp $
*/
public abstract class AbstractMavenArtifact
implements MavenArtifact
{
/** Platform specific file separator used for file system operations. */
protected static final String ps = File.separator;
/** Dependency this artifact is based on. */
private Dependency dependency;
/** Path to artifact. */
private String path;
/**
* Default constructor.
* @param dependency the dependency the artifact is based on
*/
public AbstractMavenArtifact( Dependency dependency )
{
this.dependency = dependency;
}
/** @see MavenArtifact#setDependency */
public void setDependency( Dependency dependency )
{
this.dependency = dependency;
}
/** @see MavenArtifact#getDependency */
public Dependency getDependency()
{
return dependency;
}
/** @see MavenArtifact#setPath */
public void setPath( String path )
{
this.path = path;
}
/** @see MavenArtifact#getPath */
public String getPath()
{
if ( path == null )
{
return generatePath();
}
return path;
}
/** @see MavenArtifact#generatePath */
public String generatePath()
{
return "/" + getArtifactDirectory( getDependency() )
+ ps + getDependency().getType() + "s"
+ ps + getDependency().getArtifact();
}
/** @see MavenArtifact#getUrlPath */
public String getUrlPath()
{
return "/" + getArtifactDirectory( getDependency() )
+ "/" + getDependency().getType() + "s"
+ "/" + getDependency().getArtifact();
}
/** @see MavenArtifact#getChecksumUrl */
public String getChecksumUrl()
{
return "/" + getArtifactDirectory( getDependency() )
+ "/" + getDependency().getType() + "s"
+ "/" + getDependency().getArtifact()
+ ".md5";
}
/**
* Get the directory to place the artifact in. If the groupId has been
* set then use that, otherwise use the id.
*
* @return The artifact directory.
*/
public String getArtifactDirectory( Dependency d )
{
if ( isValid( d.getGroupId() ) )
{
return d.getGroupId();
}
return d.getId();
}
protected boolean isValid( String value )
{
if ( value != null
&& value.trim().equals("") == false )
{
return true;
}
return false;
}
/**
* Get the name of the artifact from the underlying dependency.
*
* @return The name of the underlying dependency.
*/
public String getName()
{
return getDependency().getArtifact();
}
/** @see MavenArtifact#exists */
public boolean exists()
{
return getFile().exists();
}
/** @see MavenArtifact#isSnapshot */
public boolean isSnapshot()
{
return getDependency().getArtifact().indexOf( "SNAPSHOT" ) > 0;
}
/** @see MavenArtifact#getFile */
public File getFile()
{
return new File( getPath() );
}
/**
* Reads the contents of a file.
*
* @param file The name of the file to read.
* @return The file contents or null if read failed.
* @throws IOException if there is an error reading the file
*/
String fileRead( File file )
throws IOException
{
StringBuffer buf = new StringBuffer();
FileInputStream in = new FileInputStream( file );
int count;
byte[] b = new byte[512];
while ( ( count = in.read( b ) ) > 0 ) // blocking read
{
buf.append( new String( b, 0, count ) );
}
in.close();
return buf.toString();
}
}
1.1 maven-components/maven-project/src/java/org/apache/maven/artifact/DefaultMavenArtifactFactory.java
Index: DefaultMavenArtifactFactory.java
===================================================================
package org.apache.maven.artifact;
import org.apache.maven.model.Dependency;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Maven" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Maven", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
/**
* Simple factory for creating Artifact implementations based on a dependency
* type.
*
* @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
* @version $Id: DefaultMavenArtifactFactory.java,v 1.1 2004/01/25 00:28:20 jvanzyl Exp $
*
* @todo The factor needs to take a properties file describing the acceptable
* types of artifacts. We can have a default set and also allow users
* to customize the list for their own purposes.
*/
public class DefaultMavenArtifactFactory
{
/**
* Return an appropriate Artifact implementation based on the dependency
* type.
*
* @param dependency The base dependency.
* @todo not the intended usage of test type
* @return The appropriate artifact based on the dependency type.
*/
public static MavenArtifact createArtifact( Dependency dependency )
{
//!! I certainly have to revisit this. As sometimes we get
// any of the following conditions satisfied.
if ( dependency.getType() == null
|| dependency.getType().trim().length() == 0
|| dependency.getType().equals( "jar" )
|| dependency.getType().equals( "test" ) )
{
dependency.setType( "jar" );
return new GenericMavenArtifact( dependency );
}
else
{
return new GenericMavenArtifact( dependency );
}
}
}
1.1 maven-components/maven-project/src/java/org/apache/maven/artifact/DefaultMavenArtifactory.java
Index: DefaultMavenArtifactory.java
===================================================================
package org.apache.maven.artifact;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Maven" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Maven", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
import org.apache.maven.project.MavenProject;
import org.apache.maven.artifact.MavenArtifact;
import org.apache.maven.artifact.DefaultMavenArtifactFactory;
import org.apache.maven.model.Dependency;
import org.codehaus.plexus.util.StringUtils;
import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
*
* @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
*
* @version $Id: DefaultMavenArtifactory.java,v 1.1 2004/01/25 00:28:20 jvanzyl Exp $
*/
public class DefaultMavenArtifactory
implements MavenArtifactory
{
/**
* Create the list of artifacts for a project based on the stated dependencies
* taking into account any user specified overrides.
*
* @param project MavenSession project.
* @return the list of artifacts for a project
*/
public List createArtifacts( MavenProject project )
{
List projectArtifacts = new ArrayList();
String mavenRepoLocal = project.getProperty( "maven.repo.local" );
boolean mavenJarOverride = project.getBooleanProperty( "maven.jar.override" );
for ( Iterator i = project.getDependencies().iterator(); i.hasNext(); )
{
Dependency d = (Dependency) i.next();
String mavenJarProperty = project.getProperty( "maven.jar." + MavenProject.standardToLegacyId( d.getId() ) );
MavenArtifact artifact = DefaultMavenArtifactFactory.createArtifact( d );
if ( mavenJarOverride && StringUtils.isNotEmpty(mavenJarProperty) )
{
// The jar override option has been set and we have a property
// for the this dependency so override the path with the user
// specified value.
if ( Character.isDigit( mavenJarProperty.charAt( 0 ) ) )
{
// User is requesting a specific version of a dependency
// be used.
d.setVersion( mavenJarProperty );
artifact.setPath( mavenRepoLocal + artifact.generatePath() );
}
else
{
// User is requesting a specific path to a dependency
// be used.
artifact.setPath( new File( mavenJarProperty ).getAbsolutePath() );
}
}
else
{
artifact.setPath( mavenRepoLocal + artifact.generatePath() );
}
project.setDependencyPath( artifact.getDependency().getArtifactId(), artifact.getPath() );
projectArtifacts.add( artifact );
}
return projectArtifacts;
}
}
1.1 maven-components/maven-project/src/java/org/apache/maven/artifact/GenericMavenArtifact.java
Index: GenericMavenArtifact.java
===================================================================
package org.apache.maven.artifact;
import org.apache.maven.model.Dependency;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Maven" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Maven", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
/**
* Generic artifact that builds its path and url information based on its
* associated dependency. URLs are of the form "id/type/artifact".
*
* @author <a href="mailto:jason@zenplex.org">Jason van Zyl</a>
*
* @version $Id: GenericMavenArtifact.java,v 1.1 2004/01/25 00:28:20 jvanzyl Exp $
*/
public class GenericMavenArtifact
extends AbstractMavenArtifact
{
/**
* Constructor for the GenericArtifact object
*
* @param dependency Project dependency.
*/
public GenericMavenArtifact( Dependency dependency )
{
super( dependency );
}
}
1.1 maven-components/maven-project/src/java/org/apache/maven/artifact/MavenArtifact.java
Index: MavenArtifact.java
===================================================================
package org.apache.maven.artifact;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Maven" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Maven", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
import org.apache.maven.model.Dependency;
import java.io.File;
/**
* The interface defining an artifact (which probably lives in the
* artifact).
*
* @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
* @version $Id: MavenArtifact.java,v 1.1 2004/01/25 00:28:20 jvanzyl Exp $
*/
public interface MavenArtifact
{
/**
* Set the dependency for this JAR artifact.
*
* @param dependency Dependency this artifact is based on.
*/
void setDependency( Dependency dependency );
/**
* Get the dependency.
*
* @return The dependency this artifact is based on.
*/
Dependency getDependency();
/**
* Set the path to the artifact. The maven jar override facilty can be
* used to change the path to the artifact if the user specifies the
* use of a specific version.
*
* @param path Path to the artifact.
*/
void setPath( String path );
/**
* Return the path of the artifact using platform specific naming
* conventions.
*
* @return Path to the artifact.
*/
String getPath();
/**
* Generate the path for this artifact given its dependency attributes.
*
* @return The generated path of the artifact based on the dependency attributes.
*/
String generatePath();
/**
* Return an URL path that is platform agnostic.
*
* @return URL of the artifact.
*/
String getUrlPath();
/**
* Return the url to the checksum file for this artifact.
*
* @return URL of the checksum file for this artifact.
*/
String getChecksumUrl();
/**
* Return the name of the artifact.
*
* @return Name of the underlying dependency.
*/
String getName();
/**
* Boolean flag indicating whether this artifact is a snapshot.
*
* @return Flag indicating whether this artifact is a snapshot.
*/
boolean isSnapshot();
/**
* Boolean flag indicating whether this artifact exists.
*
* @return Flag indicating the existance of the artifact in the local artifact.
*/
boolean exists();
/**
* Get the location of the artifact in the local file system.
*
* @return The location of the artifact in the local file system.
*/
File getFile();
}
1.1 maven-components/maven-project/src/java/org/apache/maven/artifact/MavenArtifactory.java
Index: MavenArtifactory.java
===================================================================
package org.apache.maven.artifact;
import org.apache.maven.project.MavenProject;
import java.util.List;
/**
*
*
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
*
* @version $Id: MavenArtifactory.java,v 1.1 2004/01/25 00:28:20 jvanzyl Exp $
*/
public interface MavenArtifactory
{
static String ROLE = MavenArtifactory.class.getName();
List createArtifacts( MavenProject project );
}
1.1 maven-components/maven-project/src/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
Index: DefaultMavenProjectBuilder.java
===================================================================
package org.apache.maven.project;
import org.apache.maven.artifact.MavenArtifactory;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.Model;
import org.apache.maven.model.ModelMarshaller;
import org.apache.maven.model.ModelUnmarshaller;
import org.apache.maven.util.CollectionUtils;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.dag.DAG;
import org.codehaus.plexus.util.dag.TopologicalSorter;
import org.xmlpull.v1.XmlPullParserException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringReader;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
/**
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
*/
public class DefaultMavenProjectBuilder
extends AbstractLogEnabled
implements MavenProjectBuilder
{
private ModelMarshaller marshaller;
private ModelUnmarshaller unmarshaller;
private MavenArtifactory artifactory;
// ----------------------------------------------------------------------
// Protected methods to be used by the Maven facade.
// ----------------------------------------------------------------------
//
// 1. collect all the vertices for the projects that we want to build.
//
// 2. iterate through the deps of each project and if that dep is within
// the set of projects we want to build then add an edge, otherwise throw
// the edge away because that dependency is not within the set of projects
// we are trying to build. we assume a closed set.
//
// 3. do a topo sort on the graph that remains.
//
public List getSortedProjects( List projects )
throws Exception
{
DAG dag = new DAG();
Map projectMap = new HashMap();
for ( Iterator i = projects.iterator(); i.hasNext(); )
{
MavenProject project = (MavenProject) i.next();
String artifactId = project.getArtifactId();
dag.addVertex( artifactId );
projectMap.put( artifactId, project );
}
for ( Iterator i = projects.iterator(); i.hasNext(); )
{
MavenProject project = (MavenProject) i.next();
String artifactId = project.getArtifactId();
for ( Iterator j = project.getDependencies().iterator(); j.hasNext(); )
{
Dependency dependency = (Dependency) j.next();
String dependencyArtifactId = dependency.getArtifactId();
if ( dag.getVertex( dependencyArtifactId ) != null )
{
dag.addEdge( artifactId, dependency.getArtifactId() );
}
}
}
List sortedProjects = new ArrayList();
for ( Iterator i = TopologicalSorter.sort( dag ).iterator(); i.hasNext(); )
{
String artifactId = (String) i.next();
sortedProjects.add( projectMap.get( artifactId ) );
}
return sortedProjects;
}
public MavenProject build( File project )
throws Exception
{
return build( project, true );
}
public MavenProject build( File projectDescriptor, boolean useParentPom )
throws Exception
{
MavenProject project = new MavenProject();
Map properties = createProjectProperties( projectDescriptor.getParentFile() );
FileReader reader = new FileReader( projectDescriptor );
Model model = null;
try
{
model = unmarshaller.parse( reader );
project.setFile( projectDescriptor );
project.setModel( model );
project.setInterpolatedModel( interpolateModel( model, properties ) );
}
catch ( XmlPullParserException e )
{
e.printStackTrace();
getLogger().error( "Error reading file: " + projectDescriptor, e );
throw e;
}
reader.close();
String modelToExtend = model.getExtend();
if ( modelToExtend != null && useParentPom )
{
modelToExtend = StringUtils.interpolate( modelToExtend, properties );
File parentModel = new File( modelToExtend );
if ( ! parentModel.isAbsolute() )
{
parentModel = new File( projectDescriptor.getParentFile(), modelToExtend );
}
MavenProject parent = build( parentModel );
project.setParent( parent );
setupModelInheritance( project.getModel(), parent.getModel() );
}
project.setProperties( properties );
project.setFile( projectDescriptor );
project.setArtifacts( artifactory.createArtifacts( project ) );
String mavenFinalName = project.getProperty( "maven.final.name" );
if ( mavenFinalName == null || mavenFinalName.indexOf( "${" ) >= 0 )
{
if ( project.getArtifactId() != null )
{
project.setProperty( "maven.final.name", project.getArtifactId() + "-" + project.getVersion() );
}
else
{
project.setProperty( "maven.final.name", MavenProject.standardToLegacyId( project.getId() ) + "-" + project.getVersion() );
}
}
return project;
}
/**
* Setup the model inheritance if one model is extending another.
*
* Here we are strictly dealing with the model so raw model values from
* the parent model are used to populate fields in the child model.
*
* @param child
* @param parent
*/
private void setupModelInheritance( Model child, Model parent )
{
// Pom version
if ( child.getModelVersion() == null )
{
child.setModelVersion( parent.getModelVersion() );
}
// Group id
if ( child.getGroupId() == null )
{
child.setGroupId( parent.getGroupId() );
}
// artifactId
if ( child.getArtifactId() == null )
{
child.setArtifactId( parent.getArtifactId() );
}
// name
if ( child.getName() == null )
{
child.setName( parent.getName() );
}
// currentVersion
if ( child.getVersion() == null )
{
child.setVersion( parent.getVersion() );
}
// inceptionYear
if ( child.getInceptionYear() == null )
{
child.setInceptionYear( parent.getInceptionYear() );
}
// Name
if ( child.getPackage() == null )
{
child.setPackage( parent.getPackage() );
}
// url
if ( child.getUrl() == null )
{
child.setUrl( parent.getUrl() );
}
// siteAddress
if ( child.getSiteAddress() == null )
{
child.setSiteAddress( parent.getSiteAddress() );
}
// siteDirectory
if ( child.getSiteDirectory() == null )
{
child.setSiteDirectory( parent.getSiteDirectory() );
}
// distributionDirectory
if ( child.getDistributionDirectory() == null )
{
child.setDistributionDirectory( parent.getDistributionDirectory() );
}
// issueTrackingUrl
if ( child.getIssueTrackingUrl() == null )
{
child.setIssueTrackingUrl( parent.getIssueTrackingUrl() );
}
// Short description
if ( child.getShortDescription() == null )
{
child.setShortDescription( parent.getShortDescription() );
}
// Short description
if ( child.getDescription() == null )
{
child.setDescription( parent.getDescription() );
}
// Organization
if ( child.getOrganization() == null )
{
child.setOrganization( parent.getOrganization() );
}
// Build
if ( child.getRepository() == null )
{
child.setRepository( parent.getRepository() );
}
// developers
if ( child.getDevelopers().size() == 0 )
{
child.setDevelopers( parent.getDevelopers() );
}
// developers
if ( child.getContributors().size() == 0 )
{
child.setContributors( parent.getContributors() );
}
// mailingLists
if ( child.getMailingLists().size() == 0 )
{
child.setMailingLists( parent.getMailingLists() );
}
// versions
if ( child.getVersions().size() == 0 )
{
child.setVersions( parent.getVersions() );
}
// branches
if ( child.getBranches().size() == 0 )
{
child.setBranches( parent.getBranches() );
}
// dependencies
if ( child.getDependencies().size() == 0 )
{
child.setDependencies( parent.getDependencies() );
}
// reports
if ( child.getReports().size() == 0 )
{
child.setReports( parent.getReports() );
}
// Build
if ( child.getBuild() == null )
{
child.setBuild( parent.getBuild() );
}
// Dependencies :: aggregate
//child.addParentDependencies( parent.getDependencies() );
}
/**
* Create a jelly context given a descriptor directory and parent
* jelly context.
*
* @param descriptorDirectory The directory from which to pull the standard maven
* properties files from.
* @return The generated maven based on the contents of the standard maven
* properties files.
*/
Map createProjectProperties( File descriptorDirectory )
{
// System properties
Properties systemProperties = System.getProperties();
// User build properties
File userBuildPropertiesFile = new File( System.getProperty( "user.home" ), "build.properties" );
Properties userBuildProperties = loadProperties( userBuildPropertiesFile );
// project build properties
File projectBuildPropertiesFile = new File( descriptorDirectory, "build.properties" );
Properties projectBuildProperties = loadProperties( projectBuildPropertiesFile );
// project properties
File projectPropertiesFile = new File( descriptorDirectory, "project.properties" );
Properties projectProperties = loadProperties( projectPropertiesFile );
Properties driverProperties = loadProperties(
DefaultMavenProjectBuilder.class.getClassLoader().getResourceAsStream( DRIVER_PROPERTIES ) );
Properties defaultProperties = loadProperties(
DefaultMavenProjectBuilder.class.getClassLoader().getResourceAsStream( DEFAULTS_PROPERTIES ) );
Map result = CollectionUtils.mergeMaps( new Map[]
{
systemProperties,
userBuildProperties,
projectBuildProperties,
projectProperties,
defaultProperties,
driverProperties
} );
// Set the basedir value in the context.
result.put( "basedir", descriptorDirectory.getPath() );
for ( Iterator i = result.keySet().iterator(); i.hasNext(); )
{
String key = (String) i.next();
String value = (String) result.get( key );
result.put( key, StringUtils.interpolate( value, result ) );
}
return result;
}
/**
* Create an XML string from a project.
*
* @param project MavenSession project to turn into an XML representation.
* @return XML representation of the project
* @throws java.lang.Exception when anything goes wrong. FIXME this is bad
*/
public String getProjectString( Model project )
throws Exception
{
StringWriter writer = new StringWriter();
marshaller.marshall( writer, project );
return writer.toString();
}
// ----------------------------------------------------------------------
// private
// ----------------------------------------------------------------------
private Model interpolateModel( Model model, Map map )
throws Exception
{
return unmarshaller.parse( new StringReader( StringUtils.interpolate( getProjectString( model ), map ) ) );
}
/**
* Load properties from a <code>File</code>.
*
* @param file Propertie file to load.
* @return The loaded Properties.
*/
public Properties loadProperties( File file )
{
try
{
return loadProperties( new FileInputStream( file ) );
}
catch ( Exception e )
{
// ignore
}
return null;
}
/**
* Load properties from an <code>InputStream</code>.
*
* @param is InputStream from which load properties.
* @return The loaded Properties.
*/
public Properties loadProperties( InputStream is )
{
try
{
Properties properties = new Properties();
// Make sure the properties stream is valid
if ( is != null )
{
properties.load( is );
}
return properties;
}
catch ( IOException e )
{
// ignore
}
finally
{
try
{
if ( is != null )
{
is.close();
}
}
catch ( IOException e )
{
// ignore
}
}
return null;
}
}
1.1 maven-components/maven-project/src/java/org/apache/maven/project/MavenProject.java
Index: MavenProject.java
===================================================================
package org.apache.maven.project;
import org.apache.maven.model.Branch;
import org.apache.maven.model.Build;
import org.apache.maven.model.Contributor;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.Developer;
import org.apache.maven.model.License;
import org.apache.maven.model.MailingList;
import org.apache.maven.model.Model;
import org.apache.maven.model.Organization;
import org.apache.maven.model.Repository;
import org.apache.maven.model.Version;
import org.apache.maven.model.Resource;
import org.codehaus.plexus.util.StringUtils;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Iterator;
/**
* The concern of the project is provide runtime values based on the model.
*
* The values in the model remain untouched but during the process of building
* a project notions like inheritance and interpolation can be added. This allows
* to have an entity which is useful in a runtime while preserving the model so that
* it can be marshalled and unmarshalled without being tainted by runtime
* requirements.
*
* We need to leave the model intact because we don't want the following:
*
* 1. We don't want interpolated values being written back into the model.
* 2. We don't want inherited values being written back into the model.
*
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
*
* @version $Id: MavenProject.java,v 1.1 2004/01/25 00:28:20 jvanzyl Exp $
*
* @todo addParentDependencies for 1.x compat.
*/
public class MavenProject
{
/** The Maven model. */
private Model model;
/** The Maven model with interpolated values. */
private Model interpolatedModel;
/** Parent project. */
private MavenProject parent;
/** Source of the model. */
private File file;
/** Artifacts generated from dependencies. */
private List artifacts;
/** Properties */
private Map properties;
// ----------------------------------------------------------------------
// Accessors
// ----------------------------------------------------------------------
public Model getModel()
{
if ( model == null )
{
model = new Model();
}
return model;
}
public void setModel( Model model )
{
this.model = model;
}
public void setInterpolatedModel( Model interpolatedModel )
{
this.interpolatedModel = interpolatedModel;
}
public Model getInterpolatedModel()
{
return interpolatedModel;
}
public MavenProject getParent()
{
return parent;
}
public void setParent( MavenProject parent )
{
this.parent = parent;
}
public boolean hasParent()
{
return getParent() != null;
}
/**
*
* @return
*/
public File getFile()
{
return file;
}
/**
*
* @param file
*/
public void setFile( File file )
{
this.file = file;
}
/**
* Returnn base dir for this project
*/
public File getBasedir()
{
return getFile().getParentFile();
}
// ----------------------------------------------------------------------
// Dependency Support
// ----------------------------------------------------------------------
/** Map of dependency ids to their real paths in the system. */
private Map dependencyPaths = new HashMap();
/** Dependencies Map so that an individual dependency can be retrieved by id. */
private Map dependencyMap = new HashMap();
/**
* Add a unique dependency for this project.
*
* @param dependency Dependency for this project.
*/
public void addDependency( Dependency dependency )
{
if ( getModel().getDependencies().contains( dependency ) )
{
getModel().addDependency( dependency );
dependencyMap.put( dependency.getId(), dependency );
}
}
/**
* Set an individual dependency's classpath entry.
*
* @param depId Dependency id.
* @param path Classpath for the given dependency.
*/
public void setDependencyPath( String depId, String path )
{
dependencyPaths.put( depId, path );
}
public String getDependencyPath( String artifactId )
{
return (String) dependencyPaths.get( artifactId );
}
/**
*
* @param denpendencies
*/
public void setDependencies( List denpendencies )
{
getModel().setDependencies( denpendencies );
}
/**
*
* @return
*/
public List getDependencies()
{
return getModel().getDependencies();
}
// ----------------------------------------------------------------------
// Artifact Support
// ----------------------------------------------------------------------
public String getArtifactDirectory()
{
return getGroupId();
}
// ----------------------------------------------------------------------
// Test and compile sourceroots.
// ----------------------------------------------------------------------
private static String PS = System.getProperty( "path.separator" );
private String compileSourceRoots = "";
private String testCompileSourceRoots = "";
public void addCompileSourceRoot( String path )
{
compileSourceRoots += PS + path;
}
public String getCompileSourceRoots()
{
return compileSourceRoots;
}
public List getCompileSourceRootsList()
{
String[] s = StringUtils.split( getCompileSourceRoots(), PS );
List list = new ArrayList();
for ( int i = 0; i < s.length; i++ )
{
list.add( s[i] );
}
return list;
}
public void addTestCompileSourceRoot( String path )
{
testCompileSourceRoots += PS + path;
}
public String getTestCompileSourceRoots()
{
return testCompileSourceRoots;
}
public List getTestCompileSourceRootsList()
{
String[] s = StringUtils.split( getTestCompileSourceRoots(), PS );
List list = new ArrayList();
for ( int i = 0; i < s.length; i++ )
{
list.add( s[i] );
}
return list;
}
// ----------------------------------------------------------------------
// Delegate to the model
// ----------------------------------------------------------------------
public void setModelVersion( String pomVersion )
{
getModel().setModelVersion( pomVersion );
}
public String getModelVersion()
{
return getModel().getModelVersion();
}
public String getId()
{
return getModel().getId();
}
public void setGroupId( String groupId )
{
getModel().setGroupId( groupId );
}
public String getGroupId()
{
return getModel().getGroupId();
}
public void setArtifactId( String artifactId )
{
getModel().setArtifactId( artifactId );
}
public String getArtifactId()
{
return getModel().getArtifactId();
}
public void setName( String name )
{
getModel().setName( name );
}
public String getName()
{
return getModel().getName();
}
public void setVersion( String version )
{
getModel().setVersion( version );
}
public String getVersion()
{
return getModel().getVersion();
}
public void setInceptionYear( String inceptionYear )
{
getModel().setInceptionYear( inceptionYear );
}
public String getInceptionYear()
{
return getModel().getInceptionYear();
}
public void setPackage( String packageName )
{
getModel().setPackage( packageName );
}
public String getPackage()
{
return getModel().getPackage();
}
public void setUrl( String url )
{
getModel().setUrl( url );
}
public String getUrl()
{
return getModel().getUrl();
}
public void setIssueTrackingUrl( String issueTrackingUrl )
{
getModel().setIssueTrackingUrl( issueTrackingUrl );
}
public String getIssueTrackingUrl()
{
return getModel().getIssueTrackingUrl();
}
public void setSiteAddress( String siteAddress )
{
getModel().setSiteAddress( siteAddress );
}
public String getSiteAddress()
{
return getModel().getSiteAddress();
}
public void setSiteDirectory( String siteDirectory )
{
getModel().setSiteDirectory( siteDirectory );
}
public String getSiteDirectory()
{
return getModel().getSiteDirectory();
}
public void setDistributionDirectory( String distributionDirectory )
{
getModel().setDistributionDirectory( distributionDirectory );
}
public String getDistributionDirectory()
{
return getModel().getDistributionDirectory();
}
public void setShortDescription( String shortDescription )
{
getModel().setShortDescription( shortDescription );
}
public String getShortDescription()
{
return getModel().getShortDescription();
}
public void setDescription( String description )
{
getModel().setDescription( description );
}
public String getDescription()
{
return getModel().getDescription();
}
public void setOrganization( Organization organization )
{
getModel().setOrganization( organization );
}
public Organization getOrganization()
{
return getModel().getOrganization();
}
public void setRepository( Repository repository )
{
getModel().setRepository( repository );
}
public Repository getRepository()
{
return getModel().getRepository();
}
public void setMailingLists( List mailingLists )
{
getModel().setMailingLists( mailingLists );
}
public List getMailingLists()
{
return getModel().getMailingLists();
}
public void addMailingList( MailingList mailingList )
{
getModel().addMailingList( mailingList );
}
public void setVersions( List versions )
{
getModel().setVersions( versions );
}
public List getVersions()
{
return getModel().getVersions();
}
public void addVersion( Version version )
{
getModel().addVersion( version );
}
public void setBranches( List branches )
{
getModel().setBranches( branches );
}
public List getBranches()
{
return getModel().getBranches();
}
public void addBranches( Branch branch )
{
getModel().addBranch( branch );
}
public void setDevelopers( List developers )
{
getModel().setDevelopers( developers );
}
public List getDevelopers()
{
return getModel().getDevelopers();
}
public void addDeveloper( Developer developer )
{
getModel().addDeveloper( developer );
}
public void setContributors( List contributors )
{
getModel().setContributors( contributors );
}
public List getContributors()
{
return getModel().getContributors();
}
public void addContributor( Contributor contributor )
{
getModel().addContributor( contributor );
}
public void setBuild( Build build )
{
getModel().setBuild( build );
}
public Build getBuild()
{
if ( ! alignedToBaseDirectory )
{
alignToBaseDirectory();
}
return getModel().getBuild();
}
public void setReports( List reports )
{
getModel().setReports( reports );
}
public List getReports()
{
return getModel().getReports();
}
public void addReports( String report )
{
getModel().addReport( report );
}
public void setLicenses( List licenses )
{
getModel().setLicenses( licenses );
}
public List getLicenses()
{
return getModel().getLicenses();
}
public void addLicense( License license )
{
getModel().addLicense( license );
}
public void setArtifacts( List artifacts )
{
this.artifacts = artifacts;
}
public List getArtifacts()
{
return artifacts;
}
public void setProperty( String key, String value )
{
getProperties().put( key, value );
}
public void setProperties( Map properties )
{
this.properties = properties;
}
public Map getProperties()
{
return properties;
}
public String getProperty( String key )
{
String property = (String) properties.get( key );
if ( property == null && hasParent() )
{
property = getParent().getProperty( key );
}
return property;
}
// ----------------------------------------------------------------------
// L E G A C Y I D S U P P O R T
// ----------------------------------------------------------------------
/**
* This is to support methods that are using the legacy form of
* the project id. Currently the id is <groupId>:<artifactId> but the
* following methods assume <groupId>:
*
* Project::getDependencyPath( <groupId> )
* Project::getDependency( <groupId> )
*
* We don't want users to have to alter any usage until we have properly
* deprecated the use of the <groupId> form.
*
* @param id
* @return
*/
public static String legacyToStandardId( String id )
{
String newId = id;
if ( id.indexOf( "+" ) != -1 )
{
// legacy format is groupId "+" partial artifactId
// standard format is groupId ":" groupId "-" partialArtifactId
int plusPos = id.indexOf( "+" );
String groupId = id.substring( 0, plusPos );
String partialArtifactId = id.substring( plusPos + 1 );
newId = groupId + ":" + groupId + "-" + partialArtifactId;
}
else if ( id.indexOf( ":" ) == -1 )
{
newId += ":" + id;
}
return newId;
}
/**
* This method is to support methods are expecting legacy ids. The following
* methods expect legacy ids.
*
* MavenJellyContext::getMavenJarOverride( <groupId> )
* Project::addPluginContext( <groupId>, pluginContext )
* Project::getArtifactDirectory( <groupId> )
*
* We don't want users to have to alter any usage until we have properly
* deprecated the use of the <groupId> form.
*
* @param id
* @return
*/
public static String standardToLegacyId( String id )
{
int i = id.indexOf( ":" );
if ( i > 0 )
{
id = id.substring( i + 1 );
}
return id;
}
/**
* Convert a <code>String</code> property to a
* <code>Boolean</code> based on its contents. It would be nice
* if Jelly would deal with this automatically.
*
* @param key The property key to lookup and convert.
*
* @return The boolean value of the property if convertiable,
* otherwise <code>Boolean.FALSE</code>.
*/
public boolean getBooleanProperty( String key )
{
String value = getProperty( key );
if ( "true".equalsIgnoreCase( value )
|| "on".equalsIgnoreCase( value )
|| "1".equals( value ) )
{
return true;
}
return false;
}
private String FILE_SEPARATOR = System.getProperty( "file.separator" );
private boolean alignedToBaseDirectory;
private void alignToBaseDirectory()
{
// build.sourceDirectory
// build.unitTestSourceDirectory
// build.aspectSourceDirectory
// build.resources.resource.directory
// unitTest.resources.resource.directory
Build build = getModel().getBuild();
if ( build != null )
{
String s = build.getSourceDirectory();
if ( requiresBaseDirectoryAlignment( s ) )
{
build.setSourceDirectory( new File( getFile().getParentFile(), s ).getPath() );
}
s = build.getUnitTestSourceDirectory();
if ( requiresBaseDirectoryAlignment( s ) )
{
build.setUnitTestSourceDirectory( new File( getFile().getParentFile(), s ).getPath() );
}
s = build.getAspectSourceDirectory();
if ( requiresBaseDirectoryAlignment( s ) )
{
build.setAspectSourceDirectory( new File( getFile().getParentFile(), s ).getPath() );
}
List buildResources = build.getResources();
for ( Iterator i = buildResources.iterator(); i.hasNext(); )
{
Resource resource = (Resource) i.next();
s = resource.getDirectory();
if ( requiresBaseDirectoryAlignment( s ) )
{
resource.setDirectory( new File( getFile().getParentFile(), s ).getPath() );
}
}
List unitTestResources = build.getResources();
for ( Iterator i = unitTestResources.iterator(); i.hasNext(); )
{
Resource resource = (Resource) i.next();
s = resource.getDirectory();
if ( requiresBaseDirectoryAlignment( s ) )
{
resource.setDirectory( new File( getFile().getParentFile(), s ).getPath() );
}
}
}
}
private boolean requiresBaseDirectoryAlignment( String s )
{
if ( s != null && !s.startsWith( FILE_SEPARATOR ) )
{
return true;
}
return false;
}
}
1.1 maven-components/maven-project/src/java/org/apache/maven/project/MavenProjectBuilder.java
Index: MavenProjectBuilder.java
===================================================================
package org.apache.maven.project;
import java.io.File;
import java.util.List;
public interface MavenProjectBuilder
{
/** Role name. */
static String ROLE = MavenProjectBuilder.class.getName();
static String DRIVER_PROPERTIES = "driver.properties";
static String DEFAULTS_PROPERTIES = "defaults.properties";
MavenProject build( File project )
throws Exception;
MavenProject build( File project, boolean useParent )
throws Exception;
List getSortedProjects( List projects )
throws Exception;
}
1.28 +15 -15 maven-components/maven-project/src/test/org/apache/maven/project/DefaultProjectBuilderTest.java
Index: DefaultProjectBuilderTest.java
===================================================================
RCS file: /home/cvs/maven-components/maven-project/src/test/org/apache/maven/project/DefaultProjectBuilderTest.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- DefaultProjectBuilderTest.java 29 Dec 2003 20:05:49 -0000 1.27
+++ DefaultProjectBuilderTest.java 25 Jan 2004 00:28:20 -0000 1.28
@@ -19,7 +19,7 @@
private String basedir;
/** Project builder. */
- private ProjectBuilder projectBuilder;
+ private MavenProjectBuilder projectBuilder;
/**
*
@@ -37,7 +37,7 @@
basedir = System.getProperty( "basedir" );
- projectBuilder = (ProjectBuilder) lookup( ProjectBuilder.ROLE );
+ projectBuilder = (MavenProjectBuilder) lookup( MavenProjectBuilder.ROLE );
assertNotNull( "Test projectBuilder can't be null!", projectBuilder );
}
@@ -47,7 +47,7 @@
{
File f = new File( basedir, "src/test/org/apache/maven/project/project.xml" );
- Project project = projectBuilder.build( f );
+ MavenProject project = projectBuilder.build( f );
assertNotNull( project.getProperty( "maven.build.dir" ) );
}
@@ -57,7 +57,7 @@
{
File f = new File( basedir, "src/test/org/apache/maven/project/project.xml" );
- Project project = projectBuilder.build( f );
+ MavenProject project = projectBuilder.build( f );
ModelTestHelper.testModelMapping( project.getModel() );
@@ -71,7 +71,7 @@
{
File f = new File( basedir, "src/test/org/apache/maven/project/child.xml" );
- Project project = projectBuilder.build( f );
+ MavenProject project = projectBuilder.build( f );
System.out.println( "project.getFile() = " + project.getFile() );
@@ -89,7 +89,7 @@
{
File f = new File( basedir, "src/test/org/apache/maven/project/fully-populated-child.xml" );
- Project project = projectBuilder.build( f );
+ MavenProject project = projectBuilder.build( f );
assertNotNull( "Test project can't be null!", project );
@@ -143,7 +143,7 @@
{
File f = new File( basedir, "src/test-input/a/project.xml" );
- Project project = projectBuilder.build( f );
+ MavenProject project = projectBuilder.build( f );
assertNotNull( "Test project cannot be null.", project );
@@ -159,7 +159,7 @@
{
File f = new File( basedir, "src/test-input/a/aa/project.xml" );
- Project project = projectBuilder.build( f );
+ MavenProject project = projectBuilder.build( f );
assertNotNull( "Test project cannot be null.", project );
@@ -184,7 +184,7 @@
{
File f = new File( basedir, "src/test-input/a/aa/project.xml" );
- Project project = projectBuilder.build( f );
+ MavenProject project = projectBuilder.build( f );
assertNotNull( "Test project cannot be null.", project );
@@ -211,7 +211,7 @@
{
File f = new File( basedir, "src/test-input/b/bb/bbb/project.xml" );
- Project project = projectBuilder.build( f );
+ MavenProject project = projectBuilder.build( f );
assertNotNull( "Test project cannot be null.", project );
@@ -245,7 +245,7 @@
{
File f = new File( basedir, "src/test-input/c/cc/ccc/project.xml" );
- Project project = projectBuilder.build( f );
+ MavenProject project = projectBuilder.build( f );
assertNotNull( "Test project cannot be null.", project );
@@ -283,7 +283,7 @@
for ( Iterator i = sortedProjects.iterator(); i.hasNext(); )
{
- Project p = (Project) i.next();
+ MavenProject p = (MavenProject) i.next();
System.out.println( "p = " + p.getArtifactId() );
}
@@ -294,7 +294,7 @@
{
File f = new File( basedir, "src/test/org/apache/maven/project/project-which-needs-directory-alignment.xml" );
- Project project = projectBuilder.build( f );
+ MavenProject project = projectBuilder.build( f );
assertNotNull( "Test project can't be null!", project );
@@ -314,7 +314,7 @@
{
File f = new File( basedir, "src/test/org/apache/maven/project/project-which-needs-directory-alignment-child.xml" );
- Project project = projectBuilder.build( f );
+ MavenProject project = projectBuilder.build( f );
assertNotNull( "Test project can't be null!", project );
@@ -334,7 +334,7 @@
{
File f = new File( basedir, "src/test/org/apache/maven/project/plugins/project-which-needs-directory-alignment-child.xml" );
- Project project = projectBuilder.build( f );
+ MavenProject project = projectBuilder.build( f );
assertNotNull( "Test project can't be null!", project );
1.4 +5 -5 maven-components/maven-project/src/test/org/apache/maven/project/DefaultProjectBuilderTest.xml
Index: DefaultProjectBuilderTest.xml
===================================================================
RCS file: /home/cvs/maven-components/maven-project/src/test/org/apache/maven/project/DefaultProjectBuilderTest.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DefaultProjectBuilderTest.xml 24 Jan 2004 15:40:39 -0000 1.3
+++ DefaultProjectBuilderTest.xml 25 Jan 2004 00:28:20 -0000 1.4
@@ -1,8 +1,8 @@
<configuration>
<components>
<component>
- <role>org.apache.maven.project.ProjectBuilder</role>
- <implementation>org.apache.maven.project.DefaultProjectBuilder</implementation>
+ <role>org.apache.maven.project.MavenProjectBuilder</role>
+ <implementation>org.apache.maven.project.DefaultMavenProjectBuilder</implementation>
<requirements>
<requirement>
<role>org.apache.maven.model.ModelUnmarshaller</role>
@@ -11,7 +11,7 @@
<role>org.apache.maven.model.ModelMarshaller</role>
</requirement>
<requirement>
- <role>org.apache.maven.artifact.Artifactory</role>
+ <role>org.apache.maven.artifact.MavenArtifactory</role>
</requirement>
</requirements>
</component>
@@ -24,8 +24,8 @@
<implementation>org.apache.maven.model.DefaultModelMarshaller</implementation>
</component>
<component>
- <role>org.apache.maven.artifact.Artifactory</role>
- <implementation>org.apache.maven.artifact.DefaultArtifactory</implementation>
+ <role>org.apache.maven.artifact.MavenArtifactory</role>
+ <implementation>org.apache.maven.artifact.DefaultMavenArtifactory</implementation>
</component>
</components>
</configuration>
1.5 +2 -2 maven-components/maven-project/src/test/org/apache/maven/project/ProjectTestHelper.java
Index: ProjectTestHelper.java
===================================================================
RCS file: /home/cvs/maven-components/maven-project/src/test/org/apache/maven/project/ProjectTestHelper.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ProjectTestHelper.java 29 Dec 2003 17:49:20 -0000 1.4
+++ ProjectTestHelper.java 25 Jan 2004 00:28:20 -0000 1.5
@@ -20,7 +20,7 @@
public class ProjectTestHelper
extends TestCase
{
- public static void testProjectFieldRetrieval( Project project )
+ public static void testProjectFieldRetrieval( MavenProject project )
throws Exception
{
// ----------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org