Author: vmassol
Date: Sun Aug 14 13:46:54 2005
New Revision: 232640
URL: http://svn.apache.org/viewcvs?rev=232640&view=rev
Log:
MPEJB-16: Added new EJB type handler that supports <code>ejb</code> and
<code>ejb-client</code> types. This fixes the bug with
<code>ejb:install/deploy-client</code> not uploading the client jar. Thanks to
Håvard Bjåstad for the "patch".
Added:
maven/maven-1/plugins/trunk/ejb/src/
maven/maven-1/plugins/trunk/ejb/src/main/
maven/maven-1/plugins/trunk/ejb/src/main/org/
maven/maven-1/plugins/trunk/ejb/src/main/org/apache/
maven/maven-1/plugins/trunk/ejb/src/main/org/apache/maven/
maven/maven-1/plugins/trunk/ejb/src/main/org/apache/maven/ejb/
maven/maven-1/plugins/trunk/ejb/src/main/org/apache/maven/ejb/EJBArtifactTypeHandler.java
(with props)
maven/maven-1/plugins/trunk/ejb/src/test/
maven/maven-1/plugins/trunk/ejb/src/test/org/
maven/maven-1/plugins/trunk/ejb/src/test/org/apache/
maven/maven-1/plugins/trunk/ejb/src/test/org/apache/maven/
maven/maven-1/plugins/trunk/ejb/src/test/org/apache/maven/ejb/
maven/maven-1/plugins/trunk/ejb/src/test/org/apache/maven/ejb/EJBArtifactTypeHandlerTest.java
(with props)
Modified:
maven/maven-1/plugins/trunk/ejb/plugin.jelly
maven/maven-1/plugins/trunk/ejb/project.xml
maven/maven-1/plugins/trunk/ejb/xdocs/changes.xml
Modified: maven/maven-1/plugins/trunk/ejb/plugin.jelly
URL:
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/ejb/plugin.jelly?rev=232640&r1=232639&r2=232640&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/ejb/plugin.jelly (original)
+++ maven/maven-1/plugins/trunk/ejb/plugin.jelly Sun Aug 14 13:46:54 2005
@@ -24,6 +24,8 @@
xmlns:util="jelly:util"
xmlns:artifact="artifact">
+ <j:new var="ejbTypeHandler"
className="org.apache.maven.ejb.EJBArtifactTypeHandler" />
+
<!--==================================================================-->
<!-- Default goal : Builds a ejb file -->
<!--==================================================================-->
@@ -153,9 +155,10 @@
<artifact:install
artifact="${maven.ejb.build.dir}/${maven.final.name}-client.jar"
- type="jar"
- project="${pom}"/>
-
+ type="ejb-client"
+ project="${pom}"
+ typeHandler="${ejbTypeHandler}"/>
+
</goal>
<!--==================================================================-->
@@ -168,8 +171,9 @@
<artifact:install
artifact="${maven.ejb.build.dir}/${maven.ejb.final.name}"
type="ejb"
- project="${pom}"/>
-
+ project="${pom}"
+ typeHandler="${ejbTypeHandler}"/>
+
</goal>
<!--==================================================================-->
@@ -182,8 +186,9 @@
<artifact:install-snapshot
artifact="${maven.ejb.build.dir}/${maven.ejb.final.name}"
type="ejb"
- project="${pom}"/>
-
+ project="${pom}"
+ typeHandler="${ejbTypeHandler}"/>
+
</goal>
<!--==================================================================-->
@@ -196,8 +201,9 @@
<artifact:deploy
artifact="${maven.ejb.build.dir}/${maven.ejb.final.name}"
type="ejb"
- project="${pom}"/>
-
+ project="${pom}"
+ typeHandler="${ejbTypeHandler}"/>
+
</goal>
<!--==================================================================-->
@@ -210,8 +216,9 @@
<artifact:deploy-snapshot
artifact="${maven.ejb.build.dir}/${maven.ejb.final.name}"
type="ejb"
- project="${pom}"/>
-
+ project="${pom}"
+ typeHandler="${ejbTypeHandler}"/>
+
</goal>
<!--==================================================================-->
@@ -224,7 +231,9 @@
<artifact:deploy
artifact="${maven.ejb.build.dir}/${maven.final.name}-client.jar"
type="jar"
- project="${pom}"/>
+ project="${pom}"
+ typeHandler="${ejbTypeHandler}"/>
+
</goal>
</project>
Modified: maven/maven-1/plugins/trunk/ejb/project.xml
URL:
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/ejb/project.xml?rev=232640&r1=232639&r2=232640&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/ejb/project.xml (original)
+++ maven/maven-1/plugins/trunk/ejb/project.xml Sun Aug 14 13:46:54 2005
@@ -23,7 +23,7 @@
<pomVersion>3</pomVersion>
<id>maven-ejb-plugin</id>
<name>Maven EJB Plugin</name>
- <currentVersion>1.6</currentVersion>
+ <currentVersion>1.7-SNAPSHOT</currentVersion>
<description>EJB Plugin for Maven</description>
<shortDescription>EJB Plugin for Maven</shortDescription>
<url>http://maven.apache.org/reference/plugins/ejb/</url>
@@ -74,6 +74,41 @@
<role>Java Developer</role>
</roles>
</developer>
+ <developer>
+ <name>Vincent Massol</name>
+ <id>vmassol</id>
+ <email>[EMAIL PROTECTED]</email>
+ <roles>
+ <role>Java Developer</role>
+ </roles>
+ </developer>
</developers>
- <dependencies/>
+ <contributors>
+ <contributor>
+ <name>Håvard Bjåstad</name>
+ </contributor>
+ </contributors>
+ <dependencies>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.0.3</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>maven</groupId>
+ <artifactId>maven</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <!-- Test dep -->
+ <dependency>
+ <groupId>maven</groupId>
+ <artifactId>maven-model</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
</project>
Added:
maven/maven-1/plugins/trunk/ejb/src/main/org/apache/maven/ejb/EJBArtifactTypeHandler.java
URL:
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/ejb/src/main/org/apache/maven/ejb/EJBArtifactTypeHandler.java?rev=232640&view=auto
==============================================================================
---
maven/maven-1/plugins/trunk/ejb/src/main/org/apache/maven/ejb/EJBArtifactTypeHandler.java
(added)
+++
maven/maven-1/plugins/trunk/ejb/src/main/org/apache/maven/ejb/EJBArtifactTypeHandler.java
Sun Aug 14 13:46:54 2005
@@ -0,0 +1,75 @@
+package org.apache.maven.ejb;
+
+/* ====================================================================
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ====================================================================
+ */
+
+import org.apache.maven.MavenException;
+import org.apache.maven.project.Project;
+import org.apache.maven.repository.ArtifactTypeHandler;
+
+/**
+ * This will do until wagon debuts.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Håvard Bjåstad</a>
+ * @author <a href="mailto:[EMAIL PROTECTED]>Vincent Massol</a>
+ * @version $Id$
+ */
+public class EJBArtifactTypeHandler implements ArtifactTypeHandler
+{
+ /**
+ * Map an artifact to a repository directory path.
+ *
+ * @param project the project for the artifact
+ * @param type The type of the artifact
+ * @return the path
+ */
+ public String constructRepositoryDirectoryPath(String type, Project
project) throws MavenException
+ {
+ StringBuffer path = new StringBuffer();
+ path.append(project.getArtifactDirectory());
+ path.append("/ejbs/");
+ return path.toString();
+ }
+
+ /**
+ * Map an artifact to a repository path.
+ *
+ * @param project the project for the artifact
+ * @param type The type of the artifact
+ * @param version The version of the artifact (may be a snapshot)
+ * @return the path
+ */
+ public String constructRepositoryFullPath(String type, Project project,
String version) throws MavenException
+ {
+ StringBuffer path = new
StringBuffer(constructRepositoryDirectoryPath(type, project));
+ path.append(project.getArtifactId());
+ path.append("-");
+ path.append(version);
+
+ if ( type.equals( "ejb-client" ) ) {
+ path.append( "-client.jar" );
+ }
+ else if ( type.equals( "ejb" ) ) {
+ path.append(".jar");
+ }
+ else {
+ throw new MavenException("Unrecognised ejb type (is " + type +
")");
+ }
+
+ return path.toString();
+ }
+}
Propchange:
maven/maven-1/plugins/trunk/ejb/src/main/org/apache/maven/ejb/EJBArtifactTypeHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/maven-1/plugins/trunk/ejb/src/main/org/apache/maven/ejb/EJBArtifactTypeHandler.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added:
maven/maven-1/plugins/trunk/ejb/src/test/org/apache/maven/ejb/EJBArtifactTypeHandlerTest.java
URL:
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/ejb/src/test/org/apache/maven/ejb/EJBArtifactTypeHandlerTest.java?rev=232640&view=auto
==============================================================================
---
maven/maven-1/plugins/trunk/ejb/src/test/org/apache/maven/ejb/EJBArtifactTypeHandlerTest.java
(added)
+++
maven/maven-1/plugins/trunk/ejb/src/test/org/apache/maven/ejb/EJBArtifactTypeHandlerTest.java
Sun Aug 14 13:46:54 2005
@@ -0,0 +1,72 @@
+package org.apache.maven.ejb;
+
+/* ====================================================================
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ====================================================================
+ */
+
+import org.apache.maven.MavenException;
+import org.apache.maven.project.Project;
+import org.apache.maven.repository.ArtifactTypeHandler;
+
+import junit.framework.TestCase;
+
+/**
+ * This will do until wagon debuts.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Vincent Massol</a>
+ * @version $Id$
+ */
+public class EJBArtifactTypeHandlerTest extends TestCase
+{
+ private Project project;
+ private ArtifactTypeHandler handler;
+ private static final String VERSION = "VERSION";
+
+ public void setUp() throws Exception
+ {
+ project = new Project();
+ project.setGroupId("groupId");
+ project.setArtifactId("artifactId");
+ handler = new EJBArtifactTypeHandler();
+ }
+
+ public void testConstructRepositoryDirectoryPath() throws Exception
+ {
+ assertEquals("check artifact directory", "groupId/ejbs/",
+ handler.constructRepositoryDirectoryPath("ejb", project));
+ assertEquals("check artifact directory", "groupId/ejbs/",
+ handler.constructRepositoryDirectoryPath("ejb-client", project));
+ }
+
+ public void testConstructRepositoryFullPath() throws Exception
+ {
+ assertEquals("check artifact path",
"groupId/ejbs/artifactId-VERSION.jar",
+ handler.constructRepositoryFullPath("ejb", project, VERSION));
+ assertEquals("check artifact path",
"groupId/ejbs/artifactId-VERSION-client.jar",
+ handler.constructRepositoryFullPath("ejb-client", project,
VERSION));
+ }
+
+ public void testConstructRepositoryFullPathWithInvalidType() throws
Exception
+ {
+ try {
+ handler.constructRepositoryFullPath("foo", project, VERSION);
+ fail("expected exception");
+ }
+ catch (MavenException expected) {
+ assertEquals("Unrecognised ejb type (is foo)",
expected.getMessage());
+ }
+ }
+}
Propchange:
maven/maven-1/plugins/trunk/ejb/src/test/org/apache/maven/ejb/EJBArtifactTypeHandlerTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/maven-1/plugins/trunk/ejb/src/test/org/apache/maven/ejb/EJBArtifactTypeHandlerTest.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Modified: maven/maven-1/plugins/trunk/ejb/xdocs/changes.xml
URL:
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/ejb/xdocs/changes.xml?rev=232640&r1=232639&r2=232640&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/ejb/xdocs/changes.xml (original)
+++ maven/maven-1/plugins/trunk/ejb/xdocs/changes.xml Sun Aug 14 13:46:54 2005
@@ -24,6 +24,14 @@
<author email="[EMAIL PROTECTED]">Nathan Coast</author>
</properties>
<body>
+ <release version="1.7-SNAPSHOT" date="in SVN trunk">
+ <action dev="vmassol" type="fix" issue="MPEJB-16" due-to="Håvard
Bjåstad">
+ Added new EJB type handler that supports <code>ejb</code> and
+ <code>ejb-client</code> types. This fixes the bug with
+ <code>ejb:install/deploy-client</code> not uploading the client
+ jar.
+ </action>
+ </release>
<release version="1.6" date="2005-05-01">
<action dev="vmassol" type="add">
Added new <code>maven.ejb.build.dir</code> property that specifies the
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]