Fixed build

This commit is contained in:
Marcin Grzejszczak
2016-08-09 14:28:57 +02:00
parent 10293f4ad9
commit 01cfa8dcf9
13 changed files with 188 additions and 10 deletions

2
.gitignore vendored
View File

@@ -34,3 +34,5 @@ build/
hs_err_pid*
.DS_Store
*.log
interpolated-settings.xml
interpolated-pom.xml

View File

@@ -73,6 +73,21 @@
<skip>true</skip>
</configuration>
</plugin>
<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>
</plugins>
</build>
@@ -145,10 +160,11 @@
<executions>
<execution>
<id>gradle</id>
<phase>install</phase>
<phase>test</phase>
<configuration>
<executable>./gradlew</executable>
<arguments>
<argument>clean</argument>
<argument>build</argument>
<argument>publishToMavenLocal</argument>
<argument>-PverifierVersion=${spring-cloud-contract.version}</argument>

View File

@@ -58,6 +58,10 @@ task wrapper(type: Wrapper) {
gradleVersion = '2.14'
}
clean.doFirst {
delete "~/.m2/repository/com/example/"
}
task resolveDependencies {
doLast {
project.rootProject.allprojects.each { subProject ->

View File

@@ -85,6 +85,27 @@
<skip>true</skip>
</configuration>
</plugin>
<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>
<fileset>
<directory>${env.HOME}/.m2/repository/com/example/</directory>
<includes>
<include>**/*</include>
</includes>
</fileset>
</filesets>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
@@ -189,10 +210,11 @@
<executions>
<execution>
<id>gradle</id>
<phase>install</phase>
<phase>test</phase>
<configuration>
<executable>./gradlew</executable>
<arguments>
<argument>clean</argument>
<argument>build</argument>
<argument>publishToMavenLocal</argument>
<argument>-PverifierVersion=${spring-cloud-contract.version}</argument>

View File

@@ -153,7 +153,7 @@
<executions>
<execution>
<id>gradle</id>
<phase>install</phase>
<phase>test</phase>
<configuration>
<executable>./gradlew</executable>
<arguments>

View File

@@ -1 +1 @@
rootProject.name = 'http-client'
rootProject.name = 'http-client-restdocs'

View File

@@ -29,6 +29,7 @@ repositories {
apply plugin: 'groovy'
apply plugin: 'spring-boot'
apply plugin: 'maven-publish'
apply plugin: 'maven'
dependencyManagement {
imports {
@@ -57,6 +58,38 @@ task wrapper(type: Wrapper) {
gradleVersion = '2.14'
}
task stubsJar(type: Jar, dependsOn: ['copySnippets', 'copySources', 'copyClasses']) {
baseName = project.name
classifier = 'stubs'
from project.file("${project.buildDir}/stubs")
}
artifacts {
archives stubsJar
}
task copySnippets(type: Copy, dependsOn: test) {
from "target/snippets/stubs"
into "${project.buildDir}/stubs/META-INF/${project.group}/${project.name}/${project.version}/mappings"
}
task copySources(type: Copy) {
from "src/main/java"
include '**/model/Fraud*.*'
into "${project.buildDir}/stubs/"
}
task copyClasses(type: Copy) {
from "${project.buildDir}/classes/main/"
include '**/model/Fraud*.*'
into "${project.buildDir}/stubs/"
}
clean.doFirst {
delete 'target/snippets/stubs'
delete "~/.m2/repository/com/example/"
}
task resolveDependencies {
doLast {
project.rootProject.allprojects.each { subProject ->

View File

@@ -178,12 +178,14 @@
<executions>
<execution>
<id>gradle</id>
<phase>install</phase>
<phase>test</phase>
<configuration>
<executable>./gradlew</executable>
<arguments>
<argument>clean</argument>
<argument>build</argument>
<argument>publishToMavenLocal</argument>
<!-- For some reason publishToMavenLocal doesn't work... Please don't troll Gradle ;)-->
<argument>install</argument>
<argument>-PverifierVersion=${spring-cloud-contract.version}</argument>
</arguments>
</configuration>

View File

@@ -1 +1 @@
rootProject.name = 'http-server'
rootProject.name = 'http-server-restdocs'

View File

@@ -78,6 +78,21 @@
<skip>true</skip>
</configuration>
</plugin>
<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>
</plugins>
</build>
@@ -140,5 +155,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>test</phase>
<configuration>
<executable>./gradlew</executable>
<arguments>
<argument>clean</argument>
<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

@@ -82,6 +82,10 @@ task wrapper(type: Wrapper) {
gradleVersion = '2.14'
}
clean.doFirst {
delete "~/.m2/repository/com/example/"
}
task resolveDependencies {
doLast {
project.rootProject.allprojects.each { subProject ->

View File

@@ -80,6 +80,28 @@
<baseClassForTests>com.example.source.SensorSourceTestBase</baseClassForTests>
</configuration>
</plugin>
<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>
<fileset>
<directory>${env.HOME}/.m2/repository/com/example/</directory>
<includes>
<include>**/*</include>
</includes>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
@@ -178,5 +200,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>test</phase>
<configuration>
<executable>./gradlew</executable>
<arguments>
<argument>clean</argument>
<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

@@ -78,15 +78,15 @@ class ContentUtils {
}
// else Brute force :(
try {
log.debug("No content type provided so trying to parse as JSON")
log.trace("No content type provided so trying to parse as JSON")
return extractValueForJSON(bodyAsValue, valueProvider)
} catch(JsonException e) {
// Not a JSON format
log.debug("Failed to parse as JSON - trying to parse as XML", e)
log.trace("Failed to parse as JSON - trying to parse as XML", e)
try {
return extractValueForXML(bodyAsValue, valueProvider)
} catch (Exception exception) {
log.debug("No content type provided and failed to parse as XML - returning the value back to the user", exception)
log.trace("No content type provided and failed to parse as XML - returning the value back to the user", exception)
return extractValueForGString(bodyAsValue, valueProvider)
}
}