vmassol 2003/06/18 14:50:14
Modified: src/java/org/apache/maven/project Dependency.java
xdocs changes.xml
Added: src/java/org/apache/maven/project ArtifactType.java
Log:
Added dependency type mapping to support extensions different than the artifact
type. This fixes the EJB plugin issue (MAVEN-196).
Revision Changes Path
1.34 +29 -10 maven/src/java/org/apache/maven/project/Dependency.java
Index: Dependency.java
===================================================================
RCS file: /home/cvs/maven/src/java/org/apache/maven/project/Dependency.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- Dependency.java 12 Apr 2003 00:02:03 -0000 1.33
+++ Dependency.java 18 Jun 2003 21:50:14 -0000 1.34
@@ -58,6 +58,7 @@
/**
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
+ * @author <a href="mailto:[EMAIL PROTECTED]">Vincent Massol</a>
* @version $Id$
*/
public class Dependency
@@ -79,7 +80,7 @@
private String groupId;
/** The dependency type */
- private String type;
+ private ArtifactType type;
/** Flag to indicate the artifact is poorly named. */
//private boolean isPoorlyNamed = false;
@@ -222,7 +223,7 @@
return jar;
}
- return getArtifactId() + "-" + getVersion() + "." + getType();
+ return getArtifactId() + "-" + getVersion() + "." + getExtension();
}
/**
@@ -297,15 +298,33 @@
/**
- * Set the type of the dependency.
- *
- * @return dependency type such as "jar" or "war"
+ * @return dependency type such as "jar", "war", etc.
*/
public String getType()
{
- return type;
- }
-
+ String result = null;
+
+ if (this.type != null)
+ {
+ result = this.type.getType();
+ }
+ return result;
+ }
+
+ /**
+ * @return dependency extension such as "jar", "war", etc.
+ */
+ public String getExtension()
+ {
+ String result = null;
+
+ if (this.type != null)
+ {
+ result = this.type.getExtension();
+ }
+ return result;
+ }
+
/**
* Sets the dependency type such as "jar" or "war"
*
@@ -313,7 +332,7 @@
*/
public void setType( String type )
{
- this.type = type;
+ this.type = ArtifactType.findType(type);
}
/**
1.1 maven/src/java/org/apache/maven/project/ArtifactType.java
Index: ArtifactType.java
===================================================================
package org.apache.maven.project;
/* ====================================================================
* 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/>.
*
* ====================================================================
*/
/**
* Provides mapping between artifact types and an extension associated
* with these types.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Vincent Massol</a>
* @version $Id: ArtifactType.java,v 1.1 2003/06/18 21:50:14 vmassol Exp $
*/
public class ArtifactType
{
/**
* EJB artifact mapping.
*/
public static final ArtifactType EJB = new ArtifactType("ejb", "jar");
/**
* Artifact type.
*/
private String type;
/**
* Artifact file extension.
*/
private String extension;
/**
* @param type the artifact type
* @param extension the artifact extension
*/
private ArtifactType(String type, String extension)
{
this.type = type;
this.extension = extension;
}
/**
* @return the artifact type
*/
public String getType()
{
return this.type;
}
/**
* @return the artifact extension
*/
public String getExtension()
{
return this.extension;
}
/**
* Factory to return the correct [EMAIL PROTECTED] ArtifactType} object.
*
* @param type the artifact type
* @return the artifact mapping
*/
public static ArtifactType findType(String type)
{
ArtifactType result;
if (type == null)
{
result = null;
}
else if (type.equalsIgnoreCase("ejb"))
{
result = EJB;
}
else
{
result = new ArtifactType(type, type);
}
return result;
}
}
1.12 +5 -0 maven/xdocs/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/maven/xdocs/changes.xml,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- changes.xml 13 Jun 2003 12:24:36 -0000 1.11
+++ changes.xml 18 Jun 2003 21:50:14 -0000 1.12
@@ -8,6 +8,11 @@
<body>
<release version="1.0RC1" date="in CVS">
+ <action dev="vmassol" type="fix">
+ Fixed dependency for ejb so that ejbs file have a jar extension. Fixes
+ bug
+ <a
href="http://jira.codehaus.org/secure/ViewIssue.jspa?key=MAVEN-196">MAVEN-196</a>.
+ </action>
<action dev="vmassol" type="add">
Added support for filtering resources both for runtime and test
resources. To use it, define a
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]