java – Gradle api or implementation problem with Transitive dependency

project

  • projectA
  • projectB
  • projectC
  • projectD

projectA/build.gradle

dependencies {
   implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.9'
}

“api” configurations will be transitively exposed to consumers of the library as per the Gradle website. Hence I added api to import project A in project C as shown below.

projectC/build.gradle

dependencies {
   api(project(":projectA")){
      transitive = true
   }
}

or 

dependencies {
     implementation(project(":projectA"))
}

I want a transitive dependency in projectC from projectA’s dependencies i.e.”jackson-annotation” ( dependency of “jackson-databind:2.9”). However the above code doesn’t provide transitive dependency. It says “error: package x doesn’t exist”

Similarly, projectA has 2 api configurations – project B and project D. It is not able to import transitive dependency from project B or D either. Please help .

java – How do I build a new project structure in netbeans using gradle?

I want to create a program using youtube’s api.There is a guide on youtube’s web site on how to run a sample. https://developers.google.com/youtube/v3/quickstart/java . I installed gradle and created a new project with gradle in netbeans. But then the web site says “In your working directory, run the following commands to create a new project structure:

$ gradle init –type basic

$ mkdir -p src/main/java src/main/resources “

How do I do that? I’m guessing that is a gradle command and it creates a directory within my project but I’m not sure how to run the gradle command.

java 8 – org.openapitools en gradle no funciona

En Intellij IDEA estoy probando este código. Cree un proyecto con Gradle, Java 1.8. Tengo el SDK correcto. Basicamente los imports de org.openapitools no funcionan, y ya no se que dependencias poner porque probe muchísimas cosas pero ninguna anda.

El código de a continuación es de un SDK de communications de AVALARA. Lo que quiero es probar esto, pero no puedo hacerlo andar.

import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.Configuration;
import org.openapitools.client.auth.*;
import org.openapitools.client.models.*;
import org.openapitools.client.api.CustomizationApi;

public class Example {
    public static void main(String() args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("http://localhost");


        CustomizationApi apiInstance = new CustomizationApi(defaultClient);
        Integer requestedClientId = 56; // Integer | Client id associated with profile(s) to be fetched  Null value will use client id submitting the request or default client id as applicable.
        Integer requestedProfileId = 56; // Integer | Configuration profile id to be fetched  Use 0 to indicate all profiles  Null value will use profile id from request or 0 if not set.
        TaxCalculationSettingTypes itemType = new TaxCalculationSettingTypes(); // TaxCalculationSettingTypes | Item Type  Examples:    Configuration, Bundle, Exclusion, Override, All
        try {
            TaxCalculationSettingsResponse result = apiInstance.apiV2ProfilesGetProfilesGet(requestedClientId, requestedProfileId, itemType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling CustomizationApi#apiV2ProfilesGetProfilesGet");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }

Pero no me reconoce ningun import. En build.gradle tengo esto:

buildscript {
    repositories {
        mavenLocal()
        maven { url "https://repo1.maven.org/maven2" }
    }
    dependencies {
        classpath "org.openapitools:openapi-generator-gradle-plugin:3.3.4"
    }
}

plugins {
    id 'java'
    id "org.openapi.generator" version "4.3.1"
}
apply plugin: 'org.openapi.generator'

También probe esto en build.gradley tampoco:


plugins {
    id 'java'
}

group 'org.example'
version '1.0-SNAPSHOT'

repositories {
    mavenCentral()
}

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.12'

    // https://mvnrepository.com/artifact/org.openapitools/openapi-generator
    compile group: 'org.openapitools', name: 'openapi-generator', version: '4.3.1'
}

UPDATE: Recien viendo la configuración de Intellij, me aparece que el Gradle JVM no reconoce al JAVA_HOME. No se si tiene que ver o no, porque en realidad tenia la opción de Project SDK. La cambie por las otras, que es la 1.8, y tampoco nada.

applications – I try to learn android development and whenever i wanna make project for my lessons i received this error for gradle

Stack Exchange Network


Stack Exchange network consists of 176 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

applications – gradle sync problem in android studio 4.1.1

when i click in sync android studio start download gradle file as the photo

enter image description here

but when the download finish it’s appear like this :
enter image description here

i tried to dowload a gradle 6.5 from gradle.org

and when i unzip the file into wraper/dists after i click on sync it’s start download gradle again and reapeat all the errors as above

junit5 – Unresolved dependency issue for JUnit tests with Gradle project in VS Code’s Java Test Runnner

I cannot run my JUnit tests, which are part of a Gradle-based Java project, in VS Code using the Java Test Runner. I get a dependency resolution error when I run test:

message: Unresolved dependency: org.junit:junit-bom:5.6.2; code: 0; resource: /Users/tdean-vital/Development/vitreaauthorization/build.gradle;

I do not get this error when I run from the Gradle command line – All tests run. I have run from a Mac using multiple versions of Gradle. I have also run in the gradle:4.1.1-jre-11 Docker image. All attempts succeed except running from within the VS Code Java Test Runner.

I have tried explicitly adding a dependency on org.junit:junit-bom:562 to my Gradle build projects, but that gave me the same error.

Any suggestions on how to identify and fix this issue so that I can run my tests from within VS Code?

android studio – Gradle DSL method not found: ‘androidTestImplementation()’

I’m trying to use uiautomator so looked the tutorial here https://developer.android.com/training/testing/ui-testing/uiautomator-testing#java

In the tutorial, it says:

In the build.gradle file of your Android app module, you must set a dependency reference to the UI Automator library:

dependencies {
    ...
    androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
}

So I added that line, so my build.gradle files is like this:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    ext.kotlin_version = "1.3.72"
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.0.2"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

//        androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
//        androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
        androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
//        androidTestImplementation('androidx.test.uiautomator:uiautomator:2.2.0')

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

And I tried to run the app. But I got an error:

Gradle DSL method not found: 'androidTestImplementation()'
Possible causes:
The project 'My Application' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0).
Upgrade plugin to version 4.0.2 and sync project

The project 'My Application' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper file

The build file may be missing a Gradle plugin.
Apply Gradle plugin

mac appstore – Why aren’t apps like Gradle, Carbon Copy Cloner, Android Studio, etc. in the App Store? How to “safely” install them?

To keep things simple, I’d like to only install apps from the official AppStore. But, I’m frequently finding that the apps that I need are not on the AppStore such as Gradle, Carbon Copy Cloner, and Android Studio. It is what it is, and I install them, but what’s the deal?

Why aren’t some legitimate MacOS apps in the AppStore?
What do expert Mac users do when they need apps outside the AppStore?
Is the only solution to use checksums to validate that the downloaded files are the correct files?

Is Android Studio pushing my code to a Gradle repo?

I am wondering if my Gradle project is automatically pushed to some repo somewhere. If it is, I would like that to stop in my instance; my code is mine, and I have not permitted it be shared by others – by using Gradle (Android Studio gave me no other option to create a project using, say, Ant) I did not authorise my code be managed by a publicly accessible repo.

Please let me know whether the code in my Gradle project is automatically being pushed into a repo somewhere.

Thanks.

Why am I still having issues even after trying to tell Gradle which Java version to use?

I’m trying to develop mods for 1.7.10 Minecraft.

I tried everything here. Sadly I can’t downvote the unhelpful because I’m on an alt account. My main account.

I tried:

compileJava.options.fork = true
compileJava.options.forkOptions.executable = /Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/bin/javac

I tried both with and without quotes around the path. Just to discover that even removing build.gradle changes nothing at all.

I then tried:

org.gradle.java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/bin/javac

In the gradle-wrapper.properties. Nothing.

And so on. Why does nothing work? I still always get:

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine java version from '14.0.2'.

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

How can I get it to work? What gives? Why is gradle so complicated?