square / square-java-sdk

Java client library for the Square API

Home Page:https://developer.squareup.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Gradle Build Fails: cannot resolve org.apache.maven:maven-core:${project.prerequisites.maven}

heysoftwaredave opened this issue · comments

Describe the bug
When building gradle with the following dependency added to "dependencies":
implementation 'com.squareup:square:27.0.0.20221214'

You get the following error:

> Task :app:compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileJava'.
> Could not resolve all files for configuration ':app:compileClasspath'.
   > Could not find org.apache.maven:maven-core:${project.prerequisites.maven}.
     Required by:
         project :app > com.squareup:square:27.0.0.20221214 > io.apimatic:core:0.3.0 > org.jacoco:jacoco-maven-plugin:0.8.5

Expected behavior
A Successful Build

To Reproduce
Steps to reproduce the bug:
1.

mkdir ./my-project
cd ./my-project
gradle init \
--project-name app \
--type java-application \
--package com.square.examples \
--dsl groovy \
--test-framework junit
  1. Edit the ./app/build.gradle file and add a new dependency to the dependencies section

  2. gradle buld or gradle run

Here is my terminal output:

`➜  test_square_gradle gradle build -x test
> Task :app:compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileJava'.
> Could not resolve all files for configuration ':app:compileClasspath'.
   > Could not find org.apache.maven:maven-core:${project.prerequisites.maven}.
     Required by:
         project :app > com.squareup:square:27.0.0.20221214 > io.apimatic:core:0.3.0 > org.jacoco:jacoco-maven-plugin:0.8.5

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 422ms
1 actionable task: 1 executed
➜  test_square_gradle gradle run
> Task :app:compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileJava'.
> Could not resolve all files for configuration ':app:compileClasspath'.
   > Could not find org.apache.maven:maven-core:${project.prerequisites.maven}.
     Required by:
         project :app > com.squareup:square:27.0.0.20221214 > io.apimatic:core:0.3.0 > org.jacoco:jacoco-maven-plugin:0.8.5

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 381ms
1 actionable task: 1 executed

Square SDK version
27.0.0.20221214

Additional context
Tried this on Ubuntu and Mac M1

➜  test_square_gradle gradle --version

------------------------------------------------------------
Gradle 7.6
------------------------------------------------------------

Build time:   2022-11-25 13:35:10 UTC
Revision:     daece9dbc5b79370cc8e4fd6fe4b2cd400e150a8

Kotlin:       1.7.10
Groovy:       3.0.13
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          17.0.5 (Private Build 17.0.5+8-Ubuntu-2ubuntu120.04)
OS:           Linux 5.15.0-41-generic amd64

Just wanted to give an update. It looks like the scope of JaCoCo needs to be limited to test in a dependency to resolve this issue. Apologies for our delay in releasing a fix, but the issue appears to be resolved in the upcoming SDK version release.

Reinstalling the Java SDK will now resolve this issue. Please reopen if JaCoCo build errors are encountered again but this should now be fixed.