Index: plugins/maven/src/main/java/jbehave/mojo/BehaviourRunnerMojo.java
===================================================================
--- plugins/maven/src/main/java/jbehave/mojo/BehaviourRunnerMojo.java (revision 0)
+++ plugins/maven/src/main/java/jbehave/mojo/BehaviourRunnerMojo.java (revision 0)
@@ -0,0 +1,56 @@
+package jbehave.mojo;
+
+import java.net.MalformedURLException;
+import java.util.List;
+
+import jbehave.core.Run;
+import jbehave.core.behaviour.Behaviours;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+/**
+ * Mojo to run Behaviours via Main CLI
+ *
+ * @author Mauro Talevi
+ * @goal run
+ */
+public class BehaviourRunnerMojo extends AbstractMojo {
+
+ /**
+ * Compile classpath.
+ *
+ * @parameter expression="${project.compileClasspathElements}"
+ * @required
+ * @readonly
+ */
+ List classpathElements;
+
+ /**
+ * @parameter
+ * @required true
+ */
+ String behavioursClassName;
+
+ private Run runner = new Run(System.out);
+
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ try {
+ getLog().debug("Running behaviours "+ behavioursClassName);
+ Behaviours behaviours = loadBehaviours(behavioursClassName);
+ Class[] classes = behaviours.getBehaviours();
+ for (int i = 0; i < classes.length; i++) {
+ runner.verifyBehaviour(classes[i]);
+ }
+ } catch (Exception e) {
+ throw new MojoExecutionException("Failed to verify behaviours", e);
+ }
+ }
+
+ private Behaviours loadBehaviours(String name) throws MalformedURLException, InstantiationException, IllegalAccessException {
+ BehavioursClassLoader cl = new BehavioursClassLoader(classpathElements);
+ return cl.newBehaviours(name);
+ }
+
+}
Index: plugins/maven/src/main/java/jbehave/mojo/BehavioursClassLoader.java
===================================================================
--- plugins/maven/src/main/java/jbehave/mojo/BehavioursClassLoader.java (revision 0)
+++ plugins/maven/src/main/java/jbehave/mojo/BehavioursClassLoader.java (revision 0)
@@ -0,0 +1,68 @@
+package jbehave.mojo;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import jbehave.core.behaviour.Behaviours;
+
+/**
+ * Extends URLClassLoader to instantiate Behaviours.
+ *
+ * @author Mauro Talevi
+ */
+public class BehavioursClassLoader extends URLClassLoader {
+
+ public BehavioursClassLoader(List classpathElements)
+ throws MalformedURLException {
+ super(toClasspathURLs(classpathElements), Behaviours.class
+ .getClassLoader());
+ }
+
+ public BehavioursClassLoader(List classpathElements, ClassLoader parent)
+ throws MalformedURLException {
+ super(toClasspathURLs(classpathElements), parent);
+ }
+
+ /**
+ * Loads and instantiates a Behaviours class
+ *
+ * @param behavioursName
+ * the name of the Behaviours
+ * @return A Behaviours instance
+ * @throws IllegalAccessException
+ */
+ public Behaviours newBehaviours(String behavioursName)
+ throws InstantiationException, IllegalAccessException {
+ String behavioursNotFound = "The behaviours " + behavioursName
+ + " was not found in " + Arrays.toString(getURLs());
+ try {
+ return (Behaviours) loadClass(behavioursName).newInstance();
+ } catch (ClassCastException e) {
+ throw new RuntimeException(behavioursName + " is not a "
+ + Behaviours.class.getName(), e);
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException(behavioursNotFound, e);
+ } catch (NoClassDefFoundError e) {
+ throw new RuntimeException(behavioursNotFound, e);
+ }
+ }
+
+ protected static URL[] toClasspathURLs(List classpathElements)
+ throws MalformedURLException {
+ List urls = new ArrayList();
+ if (classpathElements != null) {
+ for (Iterator i = classpathElements.iterator(); i.hasNext();) {
+ String classpathElement = (String) i.next();
+ urls.add(new File(classpathElement).toURL());
+ }
+ }
+ return (URL[]) urls.toArray(new URL[urls.size()]);
+ }
+
+}
Index: plugins/maven/src/it/test1/pom.xml
===================================================================
--- plugins/maven/src/it/test1/pom.xml (revision 0)
+++ plugins/maven/src/it/test1/pom.xml (revision 0)
@@ -0,0 +1,42 @@
+
+ 4.0.0
+
+ org.codehaus.jbehave
+ jbehave-maven-plugin-it-test1
+ 1.0-SNAPSHOT
+ jar
+ jBehave Maven Plugin Integration Test 1
+
+
+
+ ${pom.groupId}
+ jbehave-core
+ ${pom.version}
+
+
+
+
+ ${basedir}/../src/main
+
+
+ org.codehaus.jbehave
+ jbehave-maven-plugin
+
+
+ run
+ integration-test
+
+ jbehave.it.ItBehaviours
+
+
+ run
+
+
+
+
+
+
+
+
Index: plugins/maven/src/it/src/main/java/jbehave/it/ItBehaviours.java
===================================================================
--- plugins/maven/src/it/src/main/java/jbehave/it/ItBehaviours.java (revision 0)
+++ plugins/maven/src/it/src/main/java/jbehave/it/ItBehaviours.java (revision 0)
@@ -0,0 +1,14 @@
+package jbehave.it;
+
+import jbehave.core.behaviour.Behaviours;
+
+public class ItBehaviours implements Behaviours {
+
+ public Class[] getBehaviours() {
+ return new Class[] {
+ jbehave.it.SampleBehaviour.class
+ };
+ }
+}
+
+
Index: plugins/maven/src/it/src/main/java/jbehave/it/SampleBehaviour.java
===================================================================
--- plugins/maven/src/it/src/main/java/jbehave/it/SampleBehaviour.java (revision 0)
+++ plugins/maven/src/it/src/main/java/jbehave/it/SampleBehaviour.java (revision 0)
@@ -0,0 +1,8 @@
+package jbehave.it;
+
+public class SampleBehaviour {
+
+ public void shouldDoSomething() {
+ System.out.println("Done something");
+ }
+}
Index: plugins/maven/src/it/pom.xml
===================================================================
--- plugins/maven/src/it/pom.xml (revision 0)
+++ plugins/maven/src/it/pom.xml (revision 0)
@@ -0,0 +1,16 @@
+
+ 4.0.0
+
+ org.codehaus.jbehave
+ jbehave-maven-plugin-it
+ 1.0-SNAPSHOT
+ pom
+ jBehave Maven Plugin Integration Test Reactor
+
+
+ test1
+
+
+
Index: plugins/maven/pom.xml
===================================================================
--- plugins/maven/pom.xml (revision 0)
+++ plugins/maven/pom.xml (revision 0)
@@ -0,0 +1,26 @@
+
+ 4.0.0
+
+ org.codehaus.jbehave
+ jbehave-parent
+ 1.0-SNAPSHOT
+
+ jbehave-maven-plugin
+ maven-plugin
+ jBehave Maven Plugin
+
+
+
+ ${pom.groupId}
+ jbehave-core
+ ${pom.version}
+
+
+ org.apache.maven
+ maven-plugin-api
+ 2.0
+
+
+
Index: .project
===================================================================
--- .project (revision 495)
+++ .project (working copy)
@@ -1,17 +1,23 @@
-
-
- jbehave
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
-
-
+
+
+ jbehave
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.maven.ide.eclipse.maven2Builder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+ org.maven.ide.eclipse.maven2Nature
+
+
Index: everything/pom.xml
===================================================================
--- everything/pom.xml (revision 0)
+++ everything/pom.xml (revision 0)
@@ -0,0 +1,58 @@
+
+
+
+ jbehave-parent
+ org.codehaus.jbehave
+ 1.0-SNAPSHOT
+
+ 4.0.0
+ jbehave-behaviour-tests
+ jBehave Behaviour Tests
+ 1.0-SNAPSHOT
+
+
+
+ ${pom.groupId}
+ jbehave-core-behaviours
+ ${pom.version}
+
+
+ ${pom.groupId}
+ jbehave-ant-behaviours
+ ${pom.version}
+
+
+ ${pom.groupId}
+ jbehave-jmock-behaviours
+ ${pom.version}
+
+
+ ${pom.groupId}
+ jbehave-junit-behaviours
+ ${pom.version}
+
+
+
+
+ ${basedir}/behaviour
+
+
+ org.codehaus.jbehave
+ jbehave-maven-plugin
+
+ jbehave.AllBehaviours
+
+
+
+ integration-test
+
+ run
+
+
+
+
+
+
+
\ No newline at end of file
Index: core/behaviours/pom.xml
===================================================================
--- core/behaviours/pom.xml (revision 0)
+++ core/behaviours/pom.xml (revision 0)
@@ -0,0 +1,27 @@
+
+
+
+ jbehave-parent
+ org.codehaus.jbehave
+ 1.0-SNAPSHOT
+
+ 4.0.0
+ jbehave-core-behaviours
+ jBehave Core Behaviours
+ 1.0-SNAPSHOT
+
+
+
+ ${pom.groupId}
+ jbehave-core
+ ${pom.version}
+
+
+
+
+ ${basedir}/../behaviour
+
+
+
\ No newline at end of file
Index: core/pom.xml
===================================================================
--- core/pom.xml (revision 0)
+++ core/pom.xml (revision 0)
@@ -0,0 +1,20 @@
+
+
+
+ jbehave-parent
+ org.codehaus.jbehave
+ 1.0-SNAPSHOT
+
+ 4.0.0
+ jbehave-core
+ jBehave Core
+ 1.0-SNAPSHOT
+
+
+
+ net.sf.cotta
+ cotta
+
+
+
+
\ No newline at end of file
Index: pom.xml
===================================================================
--- pom.xml (revision 0)
+++ pom.xml (revision 0)
@@ -0,0 +1,195 @@
+
+
+ 4.0.0
+ org.codehaus.jbehave
+ jbehave-parent
+ pom
+ jBehave Parent
+ 1.0-SNAPSHOT
+
+
+ core
+ core/behaviours
+ extensions/ant
+ extensions/ant/behaviours
+ extensions/jmock
+ extensions/jmock/behaviours
+ extensions/junit
+ extensions/junit/behaviours
+ plugins/maven
+ everything
+
+
+
+
+ ant
+ ant
+ 1.6.5
+
+
+ net.sf.cotta
+ cotta
+ 1.0
+
+
+ junit
+ junit
+ 3.8.1
+
+
+ jmock
+ jmock
+ 1.0.1
+
+
+ jmock
+ jmock-cglib
+ 1.0.1
+
+
+
+
+
+
+ scm:svn:https://svn.codehaus.org/jbehave/trunk
+ scm:svn:https://svn.codehaus.org/jbehave/trunk
+ https://svn.codehaus.org/jbehave/trunk
+
+
+
+ codehaus-jbehave-repository
+ Codehaus JET Repository
+ dav:https://dav.codehaus.org/repository/jbehave/
+
+
+ codehaus-jbehave-snapshot-repository
+ Codehaus JET Snapshot Repository
+ dav:https://dav.codehaus.org/snapshots.repository/jbehave/
+
+
+ jbehave-site
+ dav:https://dav.codehaus.org/jbehave
+
+
+
+
+ codehaus-repository
+ Codehaus Repository
+ http://repository.codehaus.org
+
+
+ codehaus-snapshots-repository
+ Codehaus Snapshots Repository
+ http://snapshots.repository.codehaus.org
+
+
+ codehaus-dist-repository
+ Codehaus Dist Repository
+ http://dist.codehaus.org
+ legacy
+
+ false
+
+
+
+ apache-snapshot-repository
+ Apache Snapshot Repository
+ http://people.apache.org/maven-snapshot-repository/
+
+
+
+
+ codehaus-plugin-snapshot-repository
+ Codehaus Plugin Snapshot Repository
+ http://snapshots.maven.codehaus.org/maven2/
+
+ true
+
+
+
+
+ ${basedir}/src
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ 1.5
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.2
+
+ once
+ true
+ true
+
+
+ test.src.dir
+ ${basedir}/src/test
+
+
+ java.awt.headless
+ true
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-report-plugin
+ 2.0
+
+
+ org.codehaus.mojo
+ cobertura-maven-plugin
+ 2.0
+
+
+
+ clean
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-release-plugin
+
+ https://svn.codehaus.org/jbehave/tags
+
+
+
+
+
+ org.apache.maven.wagon
+ wagon-webdav
+ 1.0-beta-1
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+
+
+ org.apache.maven.plugins
+ maven-surefire-report-plugin
+
+
+ org.codehaus.mojo
+ cobertura-maven-plugin
+
+
+
+
+ ${user.home}/jbehave.properties
+ ${basedir}/src
+ ${basedir}/../../distribution/src
+
+
\ No newline at end of file
Index: extensions/ant/behaviours/pom.xml
===================================================================
--- extensions/ant/behaviours/pom.xml (revision 0)
+++ extensions/ant/behaviours/pom.xml (revision 0)
@@ -0,0 +1,28 @@
+
+
+
+ jbehave-parent
+ org.codehaus.jbehave
+ 1.0-SNAPSHOT
+
+ 4.0.0
+ jbehave-ant-behaviours
+ jBehave Ant Behaviours
+ 1.0-SNAPSHOT
+ jar
+
+
+
+ ${pom.groupId}
+ jbehave-ant
+ ${pom.version}
+
+
+
+
+ ${basedir}/../behaviour
+
+
+
\ No newline at end of file
Index: extensions/ant/pom.xml
===================================================================
--- extensions/ant/pom.xml (revision 0)
+++ extensions/ant/pom.xml (revision 0)
@@ -0,0 +1,25 @@
+
+
+
+ jbehave-parent
+ org.codehaus.jbehave
+ 1.0-SNAPSHOT
+
+ 4.0.0
+ jbehave-ant
+ jBehave Ant Extension
+ 1.0-SNAPSHOT
+
+
+
+ ${pom.groupId}
+ jbehave-core
+ ${pom.version}
+
+
+ ant
+ ant
+
+
+
+
\ No newline at end of file
Index: extensions/jmock/behaviours/pom.xml
===================================================================
--- extensions/jmock/behaviours/pom.xml (revision 0)
+++ extensions/jmock/behaviours/pom.xml (revision 0)
@@ -0,0 +1,27 @@
+
+
+
+ jbehave-parent
+ org.codehaus.jbehave
+ 1.0-SNAPSHOT
+
+ 4.0.0
+ jbehave-jmock-behaviours
+ jBehave jMock Behaviours
+ 1.0-SNAPSHOT
+
+
+
+ ${pom.groupId}
+ jbehave-jmock
+ ${pom.version}
+
+
+
+
+ ${basedir}/../behaviour
+
+
+
\ No newline at end of file
Index: extensions/jmock/pom.xml
===================================================================
--- extensions/jmock/pom.xml (revision 0)
+++ extensions/jmock/pom.xml (revision 0)
@@ -0,0 +1,31 @@
+
+
+
+ jbehave-parent
+ org.codehaus.jbehave
+ 1.0-SNAPSHOT
+
+ 4.0.0
+ jbehave-jmock
+ jBehave jMock Extension
+ 1.0-SNAPSHOT
+
+
+
+ ${pom.groupId}
+ jbehave-core
+ ${pom.version}
+
+
+ jmock
+ jmock
+
+
+ jmock
+ jmock-cglib
+
+
+
+
\ No newline at end of file
Index: extensions/junit/behaviours/pom.xml
===================================================================
--- extensions/junit/behaviours/pom.xml (revision 0)
+++ extensions/junit/behaviours/pom.xml (revision 0)
@@ -0,0 +1,27 @@
+
+
+
+ jbehave-parent
+ org.codehaus.jbehave
+ 1.0-SNAPSHOT
+
+ 4.0.0
+ jbehave-junit-behaviours
+ jBehave JUnit Behaviours
+ 1.0-SNAPSHOT
+
+
+
+ ${pom.groupId}
+ jbehave-junit
+ ${pom.version}
+
+
+
+
+ ${basedir}/../behaviour
+
+
+
\ No newline at end of file
Index: extensions/junit/pom.xml
===================================================================
--- extensions/junit/pom.xml (revision 0)
+++ extensions/junit/pom.xml (revision 0)
@@ -0,0 +1,25 @@
+
+
+
+ jbehave-parent
+ org.codehaus.jbehave
+ 1.0-SNAPSHOT
+
+ 4.0.0
+ jbehave-junit
+ jBehave JUnit Extension
+ 1.0-SNAPSHOT
+
+
+
+ ${pom.groupId}
+ jbehave-core
+ ${pom.version}
+
+
+ junit
+ junit
+
+
+
+
\ No newline at end of file
Index: .classpath
===================================================================
--- .classpath (revision 495)
+++ .classpath (working copy)
@@ -1,25 +1,28 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: README.txt
===================================================================
--- README.txt (revision 0)
+++ README.txt (revision 0)
@@ -0,0 +1,6 @@
+Maven 2 support: requires maven 2.0.4 http://maven.apache.org
+
+To install cotta in m2 local repo:
+
+mvn install:install-file -DgroupId=net.sf.cotta -DartifactId=cotta -Dversion=1.0 -Dpackaging=jar -Dfile=lib/cotta/cotta-1.0.jar
+