pact-jvm-junit5 writes all pacts to target/pacts instead of $buildDir/pacts
See original GitHub issueThe title explains it.
Here is my build.gradle file for reference
buildscript {
ext {
springBootVersion = '2.0.2.RELEASE'
pactDirectory = "$buildDir/pacts"
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath("org.junit.platform:junit-platform-gradle-plugin:1.1.0")
classpath("au.com.dius:pact-jvm-provider-gradle_2.12:3.5.16")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'au.com.dius.pact'
apply plugin: 'org.junit.platform.gradle.plugin'
group = 'io.redacted'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile("org.projectlombok:lombok:1.16.16")
compile('org.springframework.boot:spring-boot-starter-web')
testCompile('org.springframework.boot:spring-boot-starter-test')
testCompile('au.com.dius:pact-jvm-consumer-junit5_2.12:3.5.16')
testRuntime("org.junit.jupiter:junit-jupiter-engine:5.1.0")
testRuntime("org.junit.platform:junit-platform-launcher:1.1.0")
}
task wrapper(type: Wrapper) {
gradleVersion = '4.6'
}
// Set where to put pact files
test {
systemProperties['pact.rootDir'] = pactDirectory
}
// Publish pact files
pact {
publish {
pactDirectory = pactDirectory
pactBrokerUrl = 'http://localhost:3000'
}
}
// Push pacts to broker
build.finalizedBy(pactPublish)
Issue Analytics
- State:
- Created 5 years ago
- Comments:14 (6 by maintainers)
Top Results From Across the Web
pact-jvm-junit5 writes all pacts to target/pacts instead ... - GitHub
I noticed that it actually happens only when I run my pact tests using IntelliJ. If instead I run the same tests from...
Read more >pact-jvm-consumer-junit5 | Pact Docs
By default, pact files are written to target/pacts (or build/pacts if you use Gradle), but this can be overwritten with the pact.rootDir system ......
Read more >How to write and validate Pact contracts using JUnit5 and ...
Uncomment this and comment @PactBroker instead to test locally by pasting a .json file for the contract under the target/pacts folder */
Read more >Pact File Not Generated Inspite of test being Passed
rootDir>src/test/resources/pacts</pact. ... Pact JVM appears to ignore the buildDirectory property. Try the following configuration:
Read more >au.com.dius.pact.consumer : junit5 - Maven Central
To write Pact consumer tests with JUnit 5, you need to add ... pact files are written to `target/pacts` (or `build/pacts` if you...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This fix has been released with version 3.6.4
Hey @HaMatthias and @uglyog, I had the same issue where the pact files are actually stored in the target dir by default.
I noticed that it actually happens only when I run my pact tests using IntelliJ. If instead I run the same tests from CLI, it works correctly.
The issue is that I was running the tests using
IntelliJ IDEA
instead ofGradle (Default)
as per screenshot (Settings > Build, Execution, Deployment > Build and Tools > Gradle
)Changing it to
Gradle
worked for me.