jvanzyl 2002/10/01 14:28:26
Modified: . maven.xml
src/java/org/apache/maven/app PluginManager.java
ProjectVerifier.java
src/java/org/apache/maven/repository AbstractArtifact.java
Artifact.java
Added: src/java/org/apache/maven/repository
DefaultArtifactFactory.java GenericArtifact.java
Log:
o Adding patches by Michael McKibben
> Please see attached patch files and 2 new java sources to add. These
> changes add support for downloading of non-jar dependencies in the
> project.xml.
Revision Changes Path
1.51 +7 -0 jakarta-turbine-maven/maven.xml
Index: maven.xml
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/maven.xml,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- maven.xml 30 Sep 2002 04:12:56 -0000 1.50
+++ maven.xml 1 Oct 2002 21:28:25 -0000 1.51
@@ -309,6 +309,8 @@
<postGoal name="site:generate">
<j:if test="${mainSite == null}">
+
+ <!--
<reactor:execute
basedir="${basedir}"
glob="src/plugins-build/*/project.xml"
@@ -316,6 +318,7 @@
banner="Generating site for"
ignoreFailures="true"
/>
+ -->
<!-- create the parent directory for the docs -->
<mkdir dir="${maven.docs.dest}/reference/plugins" />
@@ -340,6 +343,10 @@
<!-- ================================================================== -->
<!-- M A V E N D I S T R I B U T I O N T E S T A I D S -->
+ <!-- ================================================================== -->
+ <!-- NOTE: -->
+ <!-- Make sure you get rid of as many (all ideally) SNAPSHOT jars -->
+ <!-- as possible. -->
<!-- ================================================================== -->
<!-- 1. (Re)move current Maven installation -->
<!-- 2. Bootstrap -->
1.34 +8 -8
jakarta-turbine-maven/src/java/org/apache/maven/app/PluginManager.java
Index: PluginManager.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/app/PluginManager.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- PluginManager.java 30 Sep 2002 04:12:56 -0000 1.33
+++ PluginManager.java 1 Oct 2002 21:28:25 -0000 1.34
@@ -90,7 +90,8 @@
import org.apache.maven.project.Project;
// Tmp
-import org.apache.maven.repository.DefaultJarArtifact;
+import org.apache.maven.repository.DefaultArtifactFactory;
+import org.apache.maven.repository.Artifact;
/**
* Plugin manager for Maven. <p>
@@ -311,14 +312,13 @@
String classloader = dependency.getProperty("classloader");
log.debug("classloader: " + classloader);
- if (classloader != null)
+ // Only add compile type dependencies to classloader
+ if (classloader != null &&
+ (dependency.isCompileType() || dependency.isTestType()))
{
- DefaultJarArtifact dja = new DefaultJarArtifact();
-
- dja.setDependency(dependency);
-
+ Artifact artifact =
DefaultArtifactFactory.createArtifact(dependency);
String localRepo = (String)
getJellyContext().getVariable("maven.repo.local");
- File jarFile = new File(localRepo,dja.getPath());
+ File jarFile = new File(localRepo,artifact.getPath());
log.debug("jarFile: " + jarFile);
1.7 +13 -13
jakarta-turbine-maven/src/java/org/apache/maven/app/ProjectVerifier.java
Index: ProjectVerifier.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/app/ProjectVerifier.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ProjectVerifier.java 30 Sep 2002 04:12:56 -0000 1.6
+++ ProjectVerifier.java 1 Oct 2002 21:28:25 -0000 1.7
@@ -82,8 +82,8 @@
import org.apache.maven.project.Dependency;
import org.apache.maven.util.HttpUtils;
-// Temporary
-import org.apache.maven.repository.DefaultJarArtifact;
+import org.apache.maven.repository.DefaultArtifactFactory;
+import org.apache.maven.repository.Artifact;
/**
* Make sure that everything that is required for the project to build
@@ -399,10 +399,10 @@
log.debug("id: " + dependency.getId());
log.debug("version: " + dependency.getVersion());
log.debug("jar: " + dependency.getJar());
-
- DefaultJarArtifact dja = new DefaultJarArtifact();
- dja.setDependency(dependency);
- String path = dja.getPath();
+
+
+ Artifact artifact = DefaultArtifactFactory.createArtifact(dependency);
+ String path = artifact.getPath();
File jarFile = new File(getMavenLocalRepo(), path);
log.debug("Looking for " + jarFile.getCanonicalPath() + "\n\n");
@@ -421,8 +421,8 @@
// run update-jars or something else has gone wrong. So
// We'll add the jar to our list of failed dependencies
// and get them when we're done checking all the JARs.
- log.debug("failed dependency: " + dja.getPath());
- failedDependencies.add(dja);
+ log.debug("failed dependency: " + artifact.getPath());
+ failedDependencies.add(artifact);
}
}
@@ -457,9 +457,9 @@
for (Iterator i = failedDependencies.iterator(); i.hasNext();)
{
- DefaultJarArtifact dja = (DefaultJarArtifact) i.next();
- File destinationFile = new File(getMavenLocalRepo(), dja.getPath());
- String artifactName = dja.getName();
+ Artifact artifact = (Artifact) i.next();
+ File destinationFile = new File(getMavenLocalRepo(),
artifact.getPath());
+ String artifactName = artifact.getName();
if (nonDistMap.containsKey(artifactName))
{
@@ -488,7 +488,7 @@
continue;
}
- if (!getRemoteFile(dja.getUrlPath(), destinationFile) && isOnline())
+ if (!getRemoteFile(artifact.getUrlPath(), destinationFile) &&
isOnline())
{
warnings.append("-------------------------------------"
+ "------------\n");
1.5 +3 -2
jakarta-turbine-maven/src/java/org/apache/maven/repository/AbstractArtifact.java
Index: AbstractArtifact.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/repository/AbstractArtifact.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AbstractArtifact.java 22 Aug 2002 19:40:44 -0000 1.4
+++ AbstractArtifact.java 1 Oct 2002 21:28:26 -0000 1.5
@@ -61,8 +61,9 @@
* @author <a href="[EMAIL PROTECTED]">Jason van Zyl</a>
* @version $Id$
*/
-public abstract class AbstractArtifact
+public abstract class AbstractArtifact implements Artifact
{
public abstract String getPath();
public abstract String getUrlPath();
+ public abstract String getName();
}
1.5 +15 -1
jakarta-turbine-maven/src/java/org/apache/maven/repository/Artifact.java
Index: Artifact.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/repository/Artifact.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Artifact.java 22 Aug 2002 19:40:44 -0000 1.4
+++ Artifact.java 1 Oct 2002 21:28:26 -0000 1.5
@@ -63,6 +63,20 @@
*/
public interface Artifact
{
+
+ /**
+ * Return the path of the artifact using platform specific naming
+ * conventions.
+ */
String getPath();
+
+ /**
+ * Return an URL path that is platform agnostic.
+ */
String getUrlPath();
+
+ /**
+ * Return the name of the artifact.
+ */
+ String getName();
}
1.1
jakarta-turbine-maven/src/java/org/apache/maven/repository/DefaultArtifactFactory.java
Index: DefaultArtifactFactory.java
===================================================================
package org.apache.maven.repository;
/* ====================================================================
* 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 [EMAIL PROTECTED]
*
* 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.Dependency;
/**
* Simple factory for creating Artifact implementations based on a dependency
* type.
*
* @version $Id: DefaultArtifactFactory.java,v 1.1 2002/10/01 21:28:26 jvanzyl Exp $
*/
public class DefaultArtifactFactory
{
/**
* Return an appropriate Artifact implementation based on the dependency
* type.
*/
public static Artifact createArtifact(Dependency dependency)
{
Artifact artifact = null;
if (dependency.isCompileType())
{
DefaultJarArtifact dja = new DefaultJarArtifact();
dja.setDependency(dependency);
artifact = dja;
}
else
{
artifact = new GenericArtifact(dependency);
}
return artifact;
}
}
1.1
jakarta-turbine-maven/src/java/org/apache/maven/repository/GenericArtifact.java
Index: GenericArtifact.java
===================================================================
package org.apache.maven.repository;
/* ====================================================================
* 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 [EMAIL PROTECTED]
*
* 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 java.io.File;
import org.apache.maven.project.Dependency;
/**
* Generic artifact that builds its path and url information based on its
* associated dependency. URLs are of the form "id/type/artifact".
*
* @version $Id: GenericArtifact.java,v 1.1 2002/10/01 21:28:26 jvanzyl Exp $
*/
public class GenericArtifact
extends AbstractArtifact
{
/**
* Platform specific file separator used for file system operations.
*/
private final static String ps = File.separator;
private Dependency dependency;
private String path;
private String url;
/**
* Constructor for the GenericArtifact object
*
* @param dependency
*/
public GenericArtifact(Dependency dependency)
{
this.dependency = dependency;
String projectId = dependency.getProjectId();
String artifact = dependency.getArtifact();
String typeDir;
if (dependency.isCompileType() || dependency.isTestType())
{
typeDir = "jars";
}
else
{
typeDir = dependency.getType();
if ("distribution".equals(typeDir))
{
// make plural to conform to existing naming
// conventions.
typeDir = "distributions";
}
}
this.path = ps + projectId + ps + typeDir + ps + artifact;
this.url = "/" + projectId + "/" + typeDir + "/" + artifact;
}
/**
* Return the associated dependency of this artifact.
*/
public Dependency getDependency()
{
return this.dependency;
}
/**
* Get the path of the artifact using platform specific naming conventions.
* The path is derived from the underlying dependency in the form
* "id/type/artifact".
*/
public String getPath()
{
return this.path;
}
/**
* Get an URL path that is platform agnostic. The returned URL is derived
* from the underlying dependency in the form "id/type/artifact".
*/
public String getUrlPath()
{
return this.url;
}
/**
* Get the name of the artifact from the underlying dependency.
*/
public String getName()
{
return this.dependency.getArtifact();
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>