diff --git a/pom.xml b/pom.xml
index 973313ab06..c91f974ed6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -35,7 +35,7 @@
UTF-8
UTF-8
- 1.1.0-M2
+ 1.1.0-M3
1.1.0
diff --git a/src/main/groovy/io/codearte/accurest/maven/ConvertMojo.groovy b/src/main/groovy/io/codearte/accurest/maven/ConvertMojo.groovy
index 5b57bc6865..0b245842af 100644
--- a/src/main/groovy/io/codearte/accurest/maven/ConvertMojo.groovy
+++ b/src/main/groovy/io/codearte/accurest/maven/ConvertMojo.groovy
@@ -57,7 +57,7 @@ class ConvertMojo extends AbstractMojo {
AccurestConfigProperties config = new AccurestConfigProperties()
config.contractsDslDir = insideProject ? contractsDirectory : source
- config.stubsOutputDir = insideProject ? new File(outputDirectory, 'mappings') : destination
+ config.stubsOutputDir = insideProject ? new File(outputDirectory, 'mappings') : destination
log.info('Converting from accurest contracts written in GroovyDSL to WireMock stubs mappings')
log.info(" Accurest contracts directory: ${config.contractsDslDir}")
diff --git a/src/main/groovy/io/codearte/accurest/maven/RunMojo.groovy b/src/main/groovy/io/codearte/accurest/maven/RunMojo.groovy
index a6b67e4939..7dd0381ef3 100644
--- a/src/main/groovy/io/codearte/accurest/maven/RunMojo.groovy
+++ b/src/main/groovy/io/codearte/accurest/maven/RunMojo.groovy
@@ -10,11 +10,12 @@ import org.apache.maven.plugin.MojoExecutionException
import org.apache.maven.plugin.MojoFailureException
import org.apache.maven.plugins.annotations.Mojo
import org.apache.maven.plugins.annotations.Parameter
+import org.apache.maven.plugins.annotations.ResolutionScope
import org.eclipse.aether.RepositorySystemSession
import javax.inject.Inject
-@Mojo(name = 'run', requiresProject = false)
+@Mojo(name = 'run', requiresProject = false, requiresDependencyResolution = ResolutionScope.RUNTIME)
@CompileStatic
class RunMojo extends AbstractMojo {
diff --git a/src/main/resources/META-INF/plexus/components.xml b/src/main/resources/META-INF/plexus/components.xml
new file mode 100644
index 0000000000..a0ace0cd0e
--- /dev/null
+++ b/src/main/resources/META-INF/plexus/components.xml
@@ -0,0 +1,27 @@
+
+
+
+
+ org.apache.maven.lifecycle.Lifecycle
+ org.apache.maven.lifecycle.Lifecycle
+ accurest
+
+ accurest
+
+ accurest-not-used-phase
+
+
+
+ io.codearte.accurest:accurest-maven-plugin:${project.version}:convert
+
+
+ io.codearte.accurest:accurest-maven-plugin:${project.version}:generateTests
+
+
+ io.codearte.accurest:accurest-maven-plugin:${project.version}:generateStubs
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/java/io/codearte/accurest/maven/PluginIT.java b/src/test/java/io/codearte/accurest/maven/PluginIT.java
index 4a4e396f46..268090b57a 100644
--- a/src/test/java/io/codearte/accurest/maven/PluginIT.java
+++ b/src/test/java/io/codearte/accurest/maven/PluginIT.java
@@ -57,6 +57,20 @@ public class PluginIT {
.assertErrorFreeLog();
}
+ @Test
+ public void should_build_project_with_plugin_extension() throws Exception {
+ File basedir = resources.getBasedir("plugin-extension");
+ maven.forProject(basedir)
+ .execute("package")
+ .assertErrorFreeLog()
+ .assertLogText("Generating server tests source code for Accurest contract verification")
+ .assertLogText("Generated 1 test classes.")
+ .assertLogText("Converting from accurest contracts written in GroovyDSL to WireMock stubs mappings")
+ .assertLogText("Creating new json")
+ .assertLogText("Running io.codearte.accurest.tests.AccurestTest")
+ .assertErrorFreeLog();
+ }
+
@Test
@Ignore("Ignored, because of bug accurest#245")
public void should_build_project_project_with_complex_configuration() throws Exception {
diff --git a/src/test/projects/plugin-extension/pom.xml b/src/test/projects/plugin-extension/pom.xml
new file mode 100644
index 0000000000..cebe6bce3e
--- /dev/null
+++ b/src/test/projects/plugin-extension/pom.xml
@@ -0,0 +1,84 @@
+
+
+ 4.0.0
+
+ org.springframework
+ gs-rest-service
+ 0.1.0
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 1.3.3.RELEASE
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ ch.qos.logback
+ logback-classic
+
+
+
+
+
+ com.jayway.restassured
+ rest-assured
+ 2.9.0
+ test
+
+
+ com.jayway.restassured
+ spring-mock-mvc
+ 2.9.0
+ test
+
+
+ com.toomuchcoding.jsonassert
+ jsonassert
+ 0.4.1
+ test
+
+
+ org.assertj
+ assertj-core
+ 2.4.0
+ test
+
+
+
+
+
+ 1.8
+ ${it-plugin.version}
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ io.codearte.accurest
+ accurest-maven-plugin
+ ${accurest-plugin.version}
+ true
+
+ hello.BaseAccurest
+
+
+
+
+
+
diff --git a/src/test/projects/plugin-extension/src/main/java/hello/Application.java b/src/test/projects/plugin-extension/src/main/java/hello/Application.java
new file mode 100644
index 0000000000..5abd411428
--- /dev/null
+++ b/src/test/projects/plugin-extension/src/main/java/hello/Application.java
@@ -0,0 +1,12 @@
+package hello;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class Application {
+
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
+ }
+}
diff --git a/src/test/projects/plugin-extension/src/main/java/hello/Greeting.java b/src/test/projects/plugin-extension/src/main/java/hello/Greeting.java
new file mode 100644
index 0000000000..5d10b59b77
--- /dev/null
+++ b/src/test/projects/plugin-extension/src/main/java/hello/Greeting.java
@@ -0,0 +1,20 @@
+package hello;
+
+public class Greeting {
+
+ private final long id;
+ private final String content;
+
+ public Greeting(long id, String content) {
+ this.id = id;
+ this.content = content;
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public String getContent() {
+ return content;
+ }
+}
diff --git a/src/test/projects/plugin-extension/src/main/java/hello/GreetingController.java b/src/test/projects/plugin-extension/src/main/java/hello/GreetingController.java
new file mode 100644
index 0000000000..e356ab2b10
--- /dev/null
+++ b/src/test/projects/plugin-extension/src/main/java/hello/GreetingController.java
@@ -0,0 +1,19 @@
+package hello;
+
+import java.util.concurrent.atomic.AtomicLong;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+public class GreetingController {
+
+ private static final String template = "Hello, %s!";
+ private final AtomicLong counter = new AtomicLong();
+
+ @RequestMapping("/greeting")
+ public Greeting greeting(@RequestParam(value="name", defaultValue="World") String name) {
+ return new Greeting(counter.incrementAndGet(),
+ String.format(template, name));
+ }
+}
diff --git a/src/test/projects/plugin-extension/src/test/accurest/greetings_ok.groovy b/src/test/projects/plugin-extension/src/test/accurest/greetings_ok.groovy
new file mode 100644
index 0000000000..0ffb665f6e
--- /dev/null
+++ b/src/test/projects/plugin-extension/src/test/accurest/greetings_ok.groovy
@@ -0,0 +1,21 @@
+io.codearte.accurest.dsl.GroovyDsl.make {
+ priority 2
+ request {
+ method 'GET'
+ urlPath('/greeting') {
+ queryParameters {
+ parameter 'name': 'Something'
+ }
+ }
+ headers {
+ header 'Content-Type': 'application/json'
+ }
+ }
+ response {
+ status 200
+ body(
+ id: 1,
+ content: "Hello, Something!"
+ )
+ }
+}
\ No newline at end of file
diff --git a/src/test/projects/plugin-extension/src/test/accurest/greetings_with_default_value.groovy b/src/test/projects/plugin-extension/src/test/accurest/greetings_with_default_value.groovy
new file mode 100644
index 0000000000..2c5c32f159
--- /dev/null
+++ b/src/test/projects/plugin-extension/src/test/accurest/greetings_with_default_value.groovy
@@ -0,0 +1,17 @@
+io.codearte.accurest.dsl.GroovyDsl.make {
+ priority 2
+ request {
+ method 'GET'
+ url('/greeting')
+ headers {
+ header 'Content-Type': 'application/json'
+ }
+ }
+ response {
+ status 200
+ body(
+ id: 1,
+ content: "Hello, World!"
+ )
+ }
+}
\ No newline at end of file
diff --git a/src/test/projects/plugin-extension/src/test/java/hello/BaseAccurest.java b/src/test/projects/plugin-extension/src/test/java/hello/BaseAccurest.java
new file mode 100644
index 0000000000..d3bf7124e2
--- /dev/null
+++ b/src/test/projects/plugin-extension/src/test/java/hello/BaseAccurest.java
@@ -0,0 +1,13 @@
+package hello;
+
+import com.jayway.restassured.module.mockmvc.RestAssuredMockMvc;
+import org.junit.Before;
+
+public class BaseAccurest {
+
+ @Before
+ public void setup() {
+ RestAssuredMockMvc.standaloneSetup(new GreetingController());
+ }
+
+}