Configure Maven to run Gradle where necessary

This commit is contained in:
Dave Syer
2016-07-28 12:51:22 +01:00
parent ad889ee6d2
commit 71b16eac86
14 changed files with 243 additions and 53 deletions

View File

@@ -135,6 +135,34 @@
</pluginRepository>
</pluginRepositories>
</profile>
<profile>
<id>integration</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>gradle</id>
<phase>install</phase>
<configuration>
<executable>./gradlew</executable>
<arguments>
<argument>build</argument>
<argument>publishToMavenLocal</argument>
<argument>-PverifierVersion=${spring-cloud-contract.version}</argument>
</arguments>
</configuration>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@@ -179,5 +179,33 @@
</pluginRepositories>
<!-- end::repos[] -->
</profile>
<profile>
<id>integration</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>gradle</id>
<phase>install</phase>
<configuration>
<executable>./gradlew</executable>
<arguments>
<argument>build</argument>
<argument>publishToMavenLocal</argument>
<argument>-PverifierVersion=${spring-cloud-contract.version}</argument>
</arguments>
</configuration>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@@ -16,6 +16,10 @@
<name>Spring Cloud Contract Standalone Test Samples</name>
<description>Spring Cloud Contract Standalone Test Samples used for end to end tests</description>
<properties>
<verifier.version>${project.version}</verifier.version>
</properties>
<modules>
<module>dsl</module>
<module>restdocs</module>
@@ -34,6 +38,21 @@
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<filesets>
<fileset>
<directory>build</directory>
</fileset>
<fileset>
<directory>target</directory>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>

View File

@@ -143,6 +143,34 @@
</pluginRepository>
</pluginRepositories>
</profile>
<profile>
<id>integration</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>gradle</id>
<phase>install</phase>
<configuration>
<executable>./gradlew</executable>
<arguments>
<argument>build</argument>
<argument>publishToMavenLocal</argument>
<argument>-PverifierVersion=${spring-cloud-contract.version}</argument>
</arguments>
</configuration>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@@ -28,7 +28,6 @@ repositories {
apply plugin: 'groovy'
apply plugin: 'spring-boot'
apply plugin: 'spring-cloud-contract'
apply plugin: 'maven-publish'
dependencyManagement {
@@ -42,7 +41,10 @@ dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.boot:spring-boot-starter-actuator")
testCompile 'org.springframework.cloud:spring-cloud-starter-contract-verifier'
testCompile 'com.google.code.gson:gson'
testCompile 'org.springframework.boot:spring-boot-starter-test'
testCompile 'org.springframework.restdocs:spring-restdocs-mockmvc'
testCompile 'org.springframework.cloud:spring-cloud-contract-wiremock'
}
test {

View File

@@ -168,5 +168,33 @@
</pluginRepository>
</pluginRepositories>
</profile>
<profile>
<id>integration</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>gradle</id>
<phase>install</phase>
<configuration>
<executable>./gradlew</executable>
<arguments>
<argument>build</argument>
<argument>publishToMavenLocal</argument>
<argument>-PverifierVersion=${spring-cloud-contract.version}</argument>
</arguments>
</configuration>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@@ -1,21 +0,0 @@
#!/bin/bash
set -o errexit
LOCAL_MAVEN_REPO=${LOCAL_MAVEN_REPO-~/.m2}
VERIFIER_VERSION=${VERIFIER_VERSION:-1.0.0.BUILD-SNAPSHOT}
ROOT=`pwd`
cat <<EOF
Running tests with the following parameters
LOCAL_MAVEN_REPO=${LOCAL_MAVEN_REPO}
VERIFIER_VERSION=${VERIFIER_VERSION}
EOF
echo -e "\n\nClearing saved stubs"
rm -rf $LOCAL_MAVEN_REPO/repository/org/springframework/cloud/contract/testprojects/
rm -rf $LOCAL_MAVEN_REPO/repository/com/example
echo -e "\n\nRunning tests for Maven (HTTP communication)\n\n"
echo -e "Building server (uses Spring Cloud Contract Verifier Maven Plugin)"
./mvnw clean install -Dspring-contract.version=${VERIFIER_VERSION}

View File

@@ -16,25 +16,6 @@ echo -e "\n\nClearing saved stubs"
rm -rf $LOCAL_MAVEN_REPO/repository/org/springframework/cloud/contract/testprojects/
rm -rf $LOCAL_MAVEN_REPO/repository/com/example
echo -e "\n\nRunning tests for Gradle (HTTP communication)\n\n"
echo -e "Building server (uses Spring Cloud Contract Verifier Gradle Plugin)"
cd dsl/http-server
./gradlew clean build publishToMavenLocal -PverifierVersion=${VERIFIER_VERSION} --stacktrace
cd $ROOT
echo -e "\n\nBuilding client (uses Spring Cloud Contract Stub Runner)"
cd dsl/http-client
./gradlew clean build -PverifierVersion=${VERIFIER_VERSION} --stacktrace
cd $ROOT
echo -e "\n\nClearing saved stubs"
rm -rf $LOCAL_MAVEN_REPO/repository/org/springframework/cloud/contract/testprojects/
echo -e "\n\nRunning tests for Gradle (communication via messaging)\n\n"
echo -e "Building producer (uses Spring Cloud Contract Verifier Gradle Plugin)"
cd stream-source
./gradlew clean build publishToMavenLocal -PverifierVersion=${VERIFIER_VERSION} --stacktrace
cd $ROOT
echo -e "\n\nBuilding consumer (uses Spring Cloud Contract Stub Runner Messaging)"
cd stream-sink
./gradlew clean build -PverifierVersion=${VERIFIER_VERSION} --stacktrace
cd $ROOT
echo -e "\n\nRunning tests for Maven (HTTP communication)\n\n"
echo -e "Building server (uses Spring Cloud Contract Verifier Maven Plugin)"
./mvnw clean install -Dspring-contract.version=${VERIFIER_VERSION} -P integration