snakeyaml-1.27-android.jar not found error while running tests
Asked Answered
I

4

8

./gradlew test

Task :compileTestJava FAILED FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileTestJava'.
> Could not find snakeyaml-1.27-android.jar (org.yaml:snakeyaml:1.27).
  Searched in the following locations:
      file:/Users/user/.m2/repository/org/yaml/snakeyaml/1.27/snakeyaml-1.27-android.jar

I get the above error with the following definition in my build.gradle file, trying to exclude from javafaker doesn't help either. What should I do here?

// faker
testImplementation('com.github.javafaker:javafaker:1.0.2')
testImplementation group: 'org.yaml', name: 'snakeyaml', version: '1.27'
Intercross answered 18/1, 2021 at 13:59 Comment(2)
There is an issue in java faker repository with an workaround - github.com/DiUS/java-faker/issues/327 you gonna need to exclude org.yaml from your javafaker dependencySuspiration
@Suspiration this doesn't help, resulting in the same errorIntercross
A
9

You need to exclude the org.yaml from the java faker dependency.

 implementation ('com.github.javafaker:javafaker:1.0.2') { exclude module: 'org.yaml' }
    implementation group: 'org.yaml', name: 'snakeyaml', version: '1.26'
Aboveboard answered 7/9, 2022 at 14:51 Comment(0)
A
10

In my case, I just deleted snakeyaml dependencies directory manually (*/.m2/repository/org/yaml/snakeyaml), it works.

Alleyne answered 28/6, 2021 at 3:57 Comment(0)
A
9

You need to exclude the org.yaml from the java faker dependency.

 implementation ('com.github.javafaker:javafaker:1.0.2') { exclude module: 'org.yaml' }
    implementation group: 'org.yaml', name: 'snakeyaml', version: '1.26'
Aboveboard answered 7/9, 2022 at 14:51 Comment(0)
V
8
// https://mvnrepository.com/artifact/com.github.javafaker/javafaker
implementation 'com.github.javafaker:javafaker:1.0.2'

Result: Could not find snakeyaml-1.30-android.jar (org.yaml:snakeyaml:1.30). Searched in the following locations: https://repo.maven.apache.org/maven2/org/yaml/snakeyaml/1.30/snakeyaml-1.30-android.jar

Solution: Use dataFaker instead of javaFaker that will resolve all the issues, like so:

// https://mvnrepository.com/artifact/net.datafaker/datafaker
implementation 'net.datafaker:datafaker:1.5.0'
Vincentvincenta answered 15/8, 2022 at 19:6 Comment(2)
Thank you! I solve my problem by using your solution.Grieve
Did it for me. Datafaker states "This library is a improved port of JavaFaker"Condemn
K
0

Workaround: Copy existing snakeyaml jar to the filename being searched

cp /Users/user/.m2/repository/org/yaml/snakeyaml/1.27/snakeyaml-1.27.jar /Users/user/.m2/repository/org/yaml/snakeyaml/1.27/snakeyaml-1.27-android.jar

Kado answered 1/7, 2021 at 4:10 Comment(1)
generic: cp -p ~/.m2/repository/org/yaml/snakeyaml/1.29/snakeyaml-1.29.jar ~/.m2/repository/org/yaml/snakeyaml/1.29/snakeyaml-1.29-android.jarExtraneous

© 2022 - 2024 — McMap. All rights reserved.