javawindowsintellij-ideabackend

Plugin [id: 'com.jfrog.artifactory', version: '4.33.1'] was not found in any of the following sources:


So, there is a backend that was written before, but, for some reasons can't be launched (I tried using IntelliJ and also from terminal.) gradle.properties are set up correctly, but I get this error every time:

Build file 'C:\Users\Desktop\Land-Backend\build.gradle' line: 5


----------


Plugin [id: 'com.jfrog.artifactory', version: '4.33.1'] was not found in any of the following sources:

* 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 6s

I am using Windows - any Ideas on this?

I tried deleting .gradle files and try to run it, but didn't work

I think that the problem might be because windows automatically conttects some files after the boot of IntelliJ.

I tried deleting .gradle and .idea files after all dependencies were correct, but it still can't connect to the artifactory.

Here is my build.gradle file:
import org.gradle.api.services.BuildService
import org.gradle.api.services.BuildServiceParameters

plugins {
    id "com.jfrog.artifactory" version "4.33.1"
    id 'com.gorylenko.gradle-git-properties' version '2.4.1' apply false
    id 'jacoco'
    id 'java'
    id 'java-library'
    id 'org.liquibase.gradle' version '2.2.0'
    id 'org.sonarqube' version '4.2.1.3168'
    id 'org.springframework.boot' version '3.1.1' apply false
    id 'org.jetbrains.kotlin.jvm' version '1.9.0'
    id 'org.jetbrains.kotlin.plugin.jpa' version '1.9.0'
    id 'org.jetbrains.kotlin.plugin.spring' version '1.9.0'
}

def artifactoryAuthentication(MavenArtifactRepository repo) {
    repo.credentials(PasswordCredentials) {
        username = project.findProperty("artifactory_user") ?: "your-username"
        password = project.findProperty("artifactory_token_secret") ?: "your-token"
    }
}

def noParallelUsageService = project.getGradle().getSharedServices().registerIfAbsent(
        "noParallelUsageService",
        AbstractService.class,
        spec -> {
            spec.getMaxParallelUsages().set(1)
        }
)

ext {
    platformVersion = '6.2.3'
}
def exclusionList = [
        "**/com/example/moduletemplate/configuration/*",
        "**/com/example/moduletemplate/YourApplication.java",
        "**/com/example/moduletemplate/service/configuration/*"
]
allprojects {
    group 'com.example.land'
    version '6.2.3'

    apply plugin: 'java-library'

    java {
        sourceCompatibility = JavaVersion.VERSION_17
        targetCompatibility = JavaVersion.VERSION_17
    }

    repositories {
        maven {
            url "${project.findProperty("artifactory_url") ?: 'your-artifactory-url'}/ap-releases/"
            artifactoryAuthentication it
        }
        maven {
            url "${project.findProperty("artifactory_url") ?: 'your-artifactory-url'}/ap-snapshots/"
            artifactoryAuthentication it
        }
        maven {
            url "${project.findProperty("artifactory_url") ?: 'your-artifactory-url'}/apache-maven/"
            artifactoryAuthentication it
        }
    }
}

subprojects {

    each {
        buildDir = "$project.rootDir/build/${project.path.replace(':', '/')}" as File
        afterEvaluate {
            if (!tasks.findByName('bootJar')?.enabled) {
                archivesBaseName = "${group}.${name}"
            }
        }

        tasks.withType(JavaCompile) {
            options.encoding = 'UTF-8'
            options.compilerArgs += [
                    '-Amapstruct.unmappedTargetPolicy=ERROR'
            ]
        }
    }

    // There is a problem with long paths on windows, so jacoco is not used than
    if (!System.properties['os.name'].toLowerCase().contains('windows')) {
        apply plugin: 'jacoco'
    }
    apply plugin: 'org.sonarqube'

    // let each subproject report the merged coverage report
    sonarqube {
        properties {
            property 'sonar.coverage.exclusions', exclusionList
            property 'sonar.coverage.jacoco.xmlReportPaths', "$project.rootDir/build/reports/jacoco/codeCoverageReport/codeCoverageReport.xml"
        }
    }

    testing {
        suites {
            test {
                targets {
                    configureEach {
                        testTask.configure {
                            finalizedBy jacocoTestReport
                            useJUnitPlatform()
                            maxHeapSize = "2048m"
                        }
                    }
                }
            }

            integrationTest(JvmTestSuite) {
                dependencies {
                    implementation project(':app')
                }

                sources {
                    java {
                        srcDirs = ['src/integrationTest/java']
                    }
                }

                targets {
                    configureEach {
                        testTask.configure {
                            shouldRunAfter(test)
                            usesService(noParallelUsageService)
                        }
                    }
                }
            }
        }
    }

    tasks.named('check') {
        dependsOn(testing.suites.integrationTest)
    }

    jacocoTestReport {
        reports {
            xml {
                enabled true
            }
            csv {
                enabled false
            }
            html {
                enabled false
            }
        }
    }

    dependencies {
        [
                'implementation', 'compileOnly', 'annotationProcessor',
                'testCompileOnly', 'testAnnotationProcessor',
                'integrationTestImplementation', 'integrationTestAnnotationProcessor',
        ].each {
            add it, enforcedPlatform("com.example:common-platform:${rootProject.ext.platformVersion}")
        }

        constraints {
            ...
        }

        implementation(
                'org.springframework.boot:spring-boot-starter-logging',
                'org.springframework.boot:spring-boot-starter-validation',
                'org.mapstruct:mapstruct',
                'org.mapstruct:mapstruct-processor'
        )

        compileOnly(
                'org.projectlombok:lombok',
                'com.google.code.findbugs:jsr305'
        )

        annotationProcessor(
                'org.projectlombok:lombok',
                'org.mapstruct:mapstruct',
                'org.mapstruct:mapstruct-processor',
                'org.projectlombok:lombok-mapstruct-binding',
                'org.mapstruct.extensions.spring:mapstruct-spring-extensions',
                'org.mapstruct.extensions.spring:mapstruct-spring-annotations',
                'org.mapstruct:mapstruct-processor',
                'org.hibernate:hibernate-jpamodelgen'
        )

        runtimeOnly(
                'com.h2database:h2'
        )

        testImplementation(
                'org.junit.jupiter:junit-jupiter',
                'org.assertj:assertj-core',
                'org.mockito:mockito-core',
                'org.mockito:mockito-junit-jupiter',
                'org.hamcrest:hamcrest',
                'org.springframework.boot:spring-boot-test'
        )

        testCompileOnly(
                'org.projectlombok:lombok'
        )

        testRuntimeOnly(
                'org.junit.platform:junit-platform-engine',
                'org.junit.platform:junit-platform-commons'
        )

        testAnnotationProcessor(
                'org.projectlombok:lombok',
                'org.mapstruct:mapstruct',
                'org.mapstruct:mapstruct-processor',
                'org.projectlombok:lombok-mapstruct-binding',
                'org.mapstruct.extensions.spring:mapstruct-spring-extensions',
                'org.mapstruct.extensions.spring:mapstruct-spring-annotations',
                'org.mapstruct:mapstruct-processor'
        )

        pluginManager.withPlugin('java-test-fixtures') {
            ['testFixturesImplementation', 'testFixturesAnnotationProcessor'].each {
                add it, enforcedPlatform("com.example:common-platform:${rootProject.ext.platformVersion}")
            }

            testFixturesImplementation(
                    'org.projectlombok:lombok',
                    'org.mapstruct:mapstruct',
                    'org.mapstruct:mapstruct-processor',
            )

            testFixturesAnnotationProcessor(
                    'org.projectlombok:lombok',
                    'org.mapstruct:mapstruct',
                    'org.mapstruct:mapstruct-processor',
                    'org.projectlombok:lombok-mapstruct-binding',
                    'org.mapstruct.extensions.spring:mapstruct-spring-extensions',
                    'org.mapstruct.extensions.spring:mapstruct-spring-annotations',
                    'org.mapstruct:mapstruct-processor'
            )
        }
    }

}

task codeCoverageReport(type: JacocoReport) {

    // Gather execution data from all subprojects
    executionData fileTree(project.rootDir.absolutePath).include("build/**/jacoco/*.exec")

    // Add all relevant sourceSets from the subprojects
    subprojects.each {
        sourceSets it.sourceSets.main
    }

    reports {
        xml.required = true
        csv.required = false
        html.required = false
    }
}

// always run the tests before generating the report
codeCoverageReport.dependsOn {
    subprojects*.check
}

// automatically create the codeCoverageReport after running check
check {
    finalizedBy codeCoverageReport
}

abstract class AbstractService implements BuildService<BuildServiceParameters.None> {}

Solution

  • Thanks for help, but the problem was a poorly set-up proxy... It is fixed now