You are viewing a plain text version of this content. The canonical link for it is here.
Posted to m2-dev@maven.apache.org by ev...@apache.org on 2005/03/10 18:14:39 UTC
cvs commit: maven-components/maven-plugins/maven-ejb-plugin/src/main/java/org/apache/maven/plugin/ejb EjbMojo.java
evenisse 2005/03/10 09:14:39
Modified: maven-artifact/src/main/resources/META-INF/plexus
components.xml
maven-core-it README.txt integration-tests.txt
maven-mboot2/src/main/java MBoot.java
maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin
CompilerMojo.java
Added: maven-artifact/src/main/java/org/apache/maven/artifact/handler
EjbHandler.java
maven-core-it/it0017 .cvsignore expected-results.txt
goals.txt pom.xml
maven-core-it/it0017/src/main/java/org/apache/maven/it0017
Person.java
maven-core-it/it0017/src/main/resources/META-INF ejb-jar.xml
maven-plugins/maven-ejb-plugin .cvsignore pom.xml
maven-plugins/maven-ejb-plugin/src/main/java/org/apache/maven/plugin/ejb
EjbMojo.java
Log:
initial version of EJB plugin
Revision Changes Path
1.5 +6 -0 maven-components/maven-artifact/src/main/resources/META-INF/plexus/components.xml
Index: components.xml
===================================================================
RCS file: /home/cvs/maven-components/maven-artifact/src/main/resources/META-INF/plexus/components.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- components.xml 9 Mar 2005 05:48:30 -0000 1.4
+++ components.xml 10 Mar 2005 17:14:38 -0000 1.5
@@ -88,6 +88,12 @@
<component>
<role>org.apache.maven.artifact.handler.ArtifactHandler</role>
+ <role-hint>ejb</role-hint>
+ <implementation>org.apache.maven.artifact.handler.EjbHandler</implementation>
+ </component>
+
+ <component>
+ <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
<role-hint>jar</role-hint>
<implementation>org.apache.maven.artifact.handler.JarHandler</implementation>
</component>
1.21 +2 -0 maven-components/maven-core-it/README.txt
Index: README.txt
===================================================================
RCS file: /home/cvs/maven-components/maven-core-it/README.txt,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- README.txt 8 Mar 2005 01:43:15 -0000 1.20
+++ README.txt 10 Mar 2005 17:14:38 -0000 1.21
@@ -45,6 +45,8 @@
install the plugin, and finally use the new plugin.
it0016: Test a WAR generation
+
+it0017: Test an EJB generation
-------------------------------------------------------------------------------
- generated sources
1.21 +1 -0 maven-components/maven-core-it/integration-tests.txt
Index: integration-tests.txt
===================================================================
RCS file: /home/cvs/maven-components/maven-core-it/integration-tests.txt,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- integration-tests.txt 8 Mar 2005 06:39:50 -0000 1.20
+++ integration-tests.txt 10 Mar 2005 17:14:38 -0000 1.21
@@ -12,3 +12,4 @@
it0013
it0015
it0016
+it0017
1.64 +5 -4 maven-components/maven-mboot2/src/main/java/MBoot.java
Index: MBoot.java
===================================================================
RCS file: /home/cvs/maven-components/maven-mboot2/src/main/java/MBoot.java,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -r1.63 -r1.64
--- MBoot.java 10 Mar 2005 16:35:03 -0000 1.63
+++ MBoot.java 10 Mar 2005 17:14:39 -0000 1.64
@@ -81,10 +81,11 @@
"maven-plugin-tools/maven-plugin-tools-marmalade", "maven-core-it-verifier"};
String[] pluginBuilds = new String[]{"maven-plugins/maven-clean-plugin", "maven-plugins/maven-compiler-plugin",
- "maven-plugins/maven-deploy-plugin", "maven-plugins/maven-install-plugin",
- "maven-plugins/maven-jar-plugin", "maven-plugins/maven-plugin-plugin",
- "maven-plugins/maven-pom-plugin", "maven-plugins/maven-resources-plugin",
- "maven-plugins/maven-surefire-plugin", "maven-plugins/maven-war-plugin"};
+ "maven-plugins/maven-deploy-plugin", "maven-plugins/maven-ejb-plugin",
+ "maven-plugins/maven-install-plugin", "maven-plugins/maven-jar-plugin",
+ "maven-plugins/maven-plugin-plugin", "maven-plugins/maven-pom-plugin",
+ "maven-plugins/maven-resources-plugin", "maven-plugins/maven-surefire-plugin",
+ "maven-plugins/maven-war-plugin"};
private static final Map MODELLO_TARGET_VERSIONS;
1.20 +3 -3 maven-components/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/CompilerMojo.java
Index: CompilerMojo.java
===================================================================
RCS file: /home/cvs/maven-components/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/CompilerMojo.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- CompilerMojo.java 10 Mar 2005 01:35:24 -0000 1.19
+++ CompilerMojo.java 10 Mar 2005 17:14:39 -0000 1.20
@@ -64,7 +64,7 @@
{
private Compiler compiler = new JavacCompiler();
- private boolean debug = false;
+ private boolean debug = true;
public void execute( PluginExecutionRequest request, PluginExecutionResponse response )
throws Exception
@@ -126,7 +126,7 @@
message = "Warning! not present in repository!";
}
- request.getLog().debug( "classpathElements[ " + i + " ] = " + classpathElement + ": " + message );
+ request.getLog().info( "classpathElements[ " + i + " ] = " + classpathElement + ": " + message );
}
}
1.1 maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/handler/EjbHandler.java
Index: EjbHandler.java
===================================================================
package org.apache.maven.artifact.handler;
/*
* Copyright 2001-2004 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.
*/
/**
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
* @version $Id: EjbHandler.java,v 1.1 2005/03/10 17:14:39 evenisse Exp $
*/
public class EjbHandler
extends JarHandler
{
public String directory()
{
return "ejbs";
}
public String packageGoal()
{
return "ejb:ejb";
}
}
1.1 maven-components/maven-core-it/it0017/.cvsignore
Index: .cvsignore
===================================================================
*~
*.log
target
*.ipr
*.iws
dist
target
.classpath
.project
log.txt
1.1 maven-components/maven-core-it/it0017/expected-results.txt
Index: expected-results.txt
===================================================================
target/classes/org/apache/maven/it0017/Person.class
target/maven-core-it0017-1.0.jar
target/maven-core-it0017-1.0.jar!/META-INF/ejbjar.xml
target/maven-core-it0017-1.0.jar!/org/apache/maven/it0017/Person.class
1.1 maven-components/maven-core-it/it0017/goals.txt
Index: goals.txt
===================================================================
package
1.1 maven-components/maven-core-it/it0017/pom.xml
Index: pom.xml
===================================================================
<model>
<modelVersion>4.0.0</modelVersion>
<groupId>maven</groupId>
<artifactId>maven-core-it0017</artifactId>
<packaging>ejb</packaging>
<version>1.0</version>
</model>
1.1 maven-components/maven-core-it/it0017/src/main/java/org/apache/maven/it0017/Person.java
Index: Person.java
===================================================================
package org.apache.maven.it0017;
public class Person
{
private String name;
public void setName( String name )
{
this.name = name;
}
public String getName()
{
return name;
}
}
1.1 maven-components/maven-core-it/it0017/src/main/resources/META-INF/ejb-jar.xml
Index: ejb-jar.xml
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar>
<enterprise-beans>
<session>
<ejb-name>Hello</ejb-name>
<home>org.apache.maven.it0017.HelloHome</home>
<remote>org.apache.maven.it0017.Hello</remote>
<ejb-class>org.apache.maven.it0017.HelloBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>Hello</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
1.1 maven-components/maven-plugins/maven-ejb-plugin/.cvsignore
Index: .cvsignore
===================================================================
target
*~
*.log
.classpath
.project
*.ipr
*.iws
*.iml
1.1 maven-components/maven-plugins/maven-ejb-plugin/pom.xml
Index: pom.xml
===================================================================
<model>
<parent>
<artifactId>maven-plugin-parent</artifactId>
<groupId>maven</groupId>
<version>2.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>maven</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<packaging>plugin</packaging>
<name>Maven EJB Plugin</name>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>plexus</groupId>
<artifactId>plexus-container-default</artifactId>
<version>1.0-alpha-2-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>plexus</groupId>
<artifactId>plexus-archiver</artifactId>
<version>1.0-alpha-1-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>maven</groupId>
<artifactId>maven-archiver</artifactId>
<version>1.0-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>2.0-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>maven</groupId>
<artifactId>maven-core</artifactId>
<version>2.0-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>maven</groupId>
<artifactId>maven-model</artifactId>
<version>2.0-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
</dependencies>
</model>
1.1 maven-components/maven-plugins/maven-ejb-plugin/src/main/java/org/apache/maven/plugin/ejb/EjbMojo.java
Index: EjbMojo.java
===================================================================
package org.apache.maven.plugin.jar;
/*
* 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.archiver.MavenArchiver;
import org.apache.maven.plugin.AbstractPlugin;
import org.apache.maven.plugin.PluginExecutionRequest;
import org.apache.maven.plugin.PluginExecutionResponse;
import java.io.File;
/**
* @author <a href="evenisse@apache.org">Emmanuel Venisse</a>
* @version $Id: EjbMojo.java,v 1.1 2005/03/10 17:14:39 evenisse Exp $
* @goal ejb
* @phase package
* @description build an ejb
* @parameter name="jarName"
* type="String"
* required="true"
* validator=""
* expression="#project.build.finalName"
* description=""
* @parameter name="compress"
* type="String"
* required="false"
* validator=""
* expression="#maven.ejb.compress"
* default="true"
* description=""
* @parameter name="index"
* type="String"
* required="false"
* validator=""
* expression="#maven.ejb.index"
* default="false"
* description=""
* @parameter name="package"
* type="String"
* required="false"
* validator=""
* expression="#maven.ejb.package"
* description=""
* @parameter name="manifest"
* type="String"
* required="false"
* validator=""
* expression="#maven.ejb.manifest"
* description=""
* @parameter name="mainClass"
* type="String"
* required="false"
* validator=""
* expression="#maven.ejb.mainClass"
* description=""
* @parameter name="addClasspath"
* type="String"
* required="false"
* validator=""
* expression="#maven.ejb.addClasspath"
* default="false"
* description=""
* @parameter name="addExtensions"
* type="String"
* required="false"
* validator=""
* expression="#maven.ejb.addExtensions"
* default="false"
* description=""
* @parameter name="generateClient"
* type="String"
* required="false"
* validator=""
* expression="#maven.ejb.generateclient"
* default="false"
* description=""
* @parameter name="outputDirectory"
* type="String"
* required="true"
* validator=""
* expression="#project.build.outputDirectory"
* description=""
* @parameter name="basedir"
* type="String"
* required="true"
* validator=""
* expression="#project.build.directory"
* description=""
* @parameter name="project"
* type="org.apache.maven.project.MavenProject"
* required="true"
* validator=""
* expression="#project"
* description="current MavenProject instance"
*/
public class EjbMojo
extends AbstractPlugin
{
/**
* @todo Add license files in META-INF directory.
*/
public void execute( PluginExecutionRequest request, PluginExecutionResponse response )
throws Exception
{
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
File basedir = new File( (String) request.getParameter( "basedir" ) );
String outputDirectory = (String) request.getParameter( "outputDirectory" );
String jarName = (String) request.getParameter( "jarName" );
boolean generateClient = new Boolean( (String) request.getParameter( "generateClient" ) ).booleanValue();
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
request.getLog().info( "Building ejb " + jarName );
File jarFile = new File( basedir, jarName + ".jar" );
MavenArchiver archiver = new MavenArchiver();
archiver.setOutputFile( jarFile );
String ejbJarXmlFile = "META-INF/ejb-jar.xml";
archiver.getArchiver().addDirectory( new File( outputDirectory ), new String[]{"**/**"},
new String[]{ejbJarXmlFile, "**/package.html"} );
archiver.getArchiver().addFile( new File( outputDirectory, ejbJarXmlFile ), ejbJarXmlFile );
// create archive
archiver.createArchive( request );
if ( generateClient )
{
request.getLog().info( "Building ejb client " + jarName + "-client" );
File clientJarFile = new File( basedir, jarName + "-client.jar" );
MavenArchiver clientArchiver = new MavenArchiver();
clientArchiver.setOutputFile( jarFile );
clientArchiver.getArchiver().addDirectory( new File( outputDirectory ), new String[]{"**/**"},
new String[]{"**/*Bean.class", "**/*CMP.class",
"**/*Session.class", "**/package.html"} );
// create archive
clientArchiver.createArchive( request );
}
}
}