You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue
I use spring cloud contract tests for a while now and they were working as expected. I've recently had to change my laptop (old one - Windows, this one Windows as well) and now the spring cloud contract tests are not generated anymore. We use Gradle as build tool.
What we've tried so far
generating them from the IDE as well as from PowerShell -> same error. .\gradlew.bat :contract-tests:generateContractTests --debug --rerun-tasks
manually compiling contract providing the full classpath and JDK -> the compilation is successful. javac -cp "C:\Users\diadeliu\.gradle\.tmp\gradle-javaexec-classpath3162018629030617727.jar;C:\Program Files\Java\jdk-11\lib\jrt-fs.jar" C:\Users\diadeliu\IdeaProjects\repo\contract-tests\build\stubs\META-INF\com.company\contract-tests\0.0.0\contracts\producer_name\consumer_name\SampleContract.java
providing gradle_home via environment variable or the folder path directly, in gradlew.bat and gradlew.sh files -> same error "-Dgradle.user.home=C:\Gradle" or "-Dgradle.user.home=gradle_home" where gradle_home is
locally installing gradle version 8.6 and make IDE use it -> same error
I've had this issue before and it was because I have had a space in the path of my folder structure "Name Surname", but now that's not the case anymore, as per the provided path above.
Please keep in mind that the provided configuration works for almost all of my peers and it's been working for me as well for the last couple of years.
We use:
JDK 11.0.21
spring-cloud-dependencies 2021.0.3
spring-boot 2.6.11
org.springframework.cloud.contract 3.1.4
Gradle wrapper version 7.5
The actual error
java.lang.IllegalStateException: Exceptions occurred while trying to compile the file [==========
import org.springframework.cloud.contract.spec.Contract;
^^^^^^^^^
ERROR:package org.springframework.cloud.contract.spec does not exist
==========
, ==========
import org.springframework.cloud.contract.spec.internal.QueryParameters;
^^^^^^^^^^^^^^^^
ERROR:package org.springframework.cloud.contract.spec.internal does not exist
==========
, ==========
import org.springframework.cloud.contract.spec.internal.RegexPatterns;
^^^^^^^^^^^^^^
ERROR:package org.springframework.cloud.contract.spec.internal does not exist
==========
, ==========
import org.springframework.cloud.contract.spec.internal.Request;
^^^^^^^^
ERROR:package org.springframework.cloud.contract.spec.internal does not exist
==========
, ==========
import org.springframework.cloud.contract.spec.internal.Response;
^^^^^^^^^
ERROR:package org.springframework.cloud.contract.spec.internal does not exist
==========
, ==========
import org.springframework.cloud.contract.verifier.util.ContractVerifierUtil;
^^^^^^^^^^^^^^^^^^^^^
ERROR:package org.springframework.cloud.contract.verifier.util does not exist
==========
, ==========
import static org.assertj.core.util.Lists.newArrayList;
^^^^^^
ERROR:package org.assertj.core.util does not exist
==========
, ==========
import static org.assertj.core.util.Lists.newArrayList;
We've run out of ideas, so any help is much appreciated. Thanks in advance!
The text was updated successfully, but these errors were encountered:
@marcingrzejszczak, I don't think that it's a Windows + Gradle sort of problem.
Here's the steps that I'd go through:
Where are the tests located? src/test/resources/contracts/? src/contractTest/resources/contracts/?
Verify the dependencies by their configuration (test=testCompileClasspath, contractTest=contractTestCompileClasspath) with gradlew dependencyInsight --configuration <configuration> --dependency spring-cloud-contract-spec-java since it's failing to compile and the Contract class comes from that jar (repeat for other classes locations).
If Gradle is showing the jars are resolving from a dependency standpoint, I'd go into the Gradle user home and verify it's contents of those jars by looking specifically for the classes that are failing to resolve inside of them.
Hello!
The issue
I use spring cloud contract tests for a while now and they were working as expected. I've recently had to change my laptop (old one - Windows, this one Windows as well) and now the spring cloud contract tests are not generated anymore. We use Gradle as build tool.
What we've tried so far
generating them from the IDE as well as from PowerShell -> same error.
.\gradlew.bat :contract-tests:generateContractTests --debug --rerun-tasks
manually compiling contract providing the full classpath and JDK -> the compilation is successful.
javac -cp "C:\Users\diadeliu\.gradle\.tmp\gradle-javaexec-classpath3162018629030617727.jar;C:\Program Files\Java\jdk-11\lib\jrt-fs.jar" C:\Users\diadeliu\IdeaProjects\repo\contract-tests\build\stubs\META-INF\com.company\contract-tests\0.0.0\contracts\producer_name\consumer_name\SampleContract.java
providing gradle_home via environment variable or the folder path directly, in gradlew.bat and gradlew.sh files -> same error
"-Dgradle.user.home=C:\Gradle"
or"-Dgradle.user.home=gradle_home"
where gradle_home islocally installing gradle version 8.6 and make IDE use it -> same error
I've had this issue before and it was because I have had a space in the path of my folder structure "Name Surname", but now that's not the case anymore, as per the provided path above.
Please keep in mind that the provided configuration works for almost all of my peers and it's been working for me as well for the last couple of years.
We use:
The actual error
We've run out of ideas, so any help is much appreciated. Thanks in advance!
The text was updated successfully, but these errors were encountered: