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".
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@232640 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
1 parent
d15ca4a5f8
commit
0c15cac721
5 files changed
+213
-14
No files matched your search
+21
-12
@@ -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>
|
||||
+37
-2
@@ -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>vmassol@apache.org</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>
|
||||
@@ -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:havard@tracetracker.com">Håvard Bjåstad</a>
|
||||
* @author <a href="mailto:vmassol@apache.org>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();
|
||||
}
|
||||
}
|
||||
@@ -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:vmassol@apache.org">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());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,14 @@
|
||||
<author email="nathan.coast@blueyonder.co.uk">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
|
||||
|
||||
Reference in new issue
Block a user