14
Сен
2021

Как зависимости gradle добавить зависимость с другого собственного проекта?

Мой первый проект

gradle.build
plugins {
    id 'java'
    id 'maven-publish'
}

archivesBaseName = 'utils'
version = '1.3.5'

repositories {
    mavenCentral()
}

dependencies {
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
    implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.10'
}

tasks.named('jar') {
    manifest {
        attributes('Implementation-Title': project.archivesBaseName,
                'Implementation-Version': project.version)
    }
}

test {
    useJUnitPlatform()
}

publishing {
    publications {
        maven(MavenPublication) {
            groupId 'com.epam'
            artifactId 'utils'
            version '1.3.5'
            from components.java
        }
    }
}

Мой второй проект

 gradle.build
plugins {
    id 'java'
}

version 'core'

repositories {
    mavenLocal()
    mavenCentral()
}

dependencies {
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
    implementation group: 'com.epam', name: 'utils', version: '1.3.5'
}

test {
    useJUnitPlatform()
}

Результат :

Execution failed for task ':api:compileJava'.
> Could not resolve all files for configuration ':api:compileClasspath'.
   > Could not find com.epam:utils:1.3.5.
     Searched in the following locations:
       - file:/C:/Users/����/.m2/repository/com/epam/utils/1.3.5/utils-1.3.5.pom
       - https://repo.maven.apache.org/maven2/com/epam/utils/1.3.5/utils-1.3.5.pom
     Required by:
         project :api

Источник: https://ru.stackoverflow.com/questions/1328282/%D0%9A%D0%B0%D0%BA-%D0%B7%D0%B0%D0%B2%D0%B8%D1%81%D0%B8%D0%BC%D0%BE%D1%81%D1%82%D0%B8-gradle-%D0%B4%D0%BE%D0%B1%D0%B0%D0%B2%D0%B8%D1%82%D1%8C-%D0%B7%D0%B0%D0%B2%D0%B8%D1%81%D0%B8%D0%BC%D0%BE%D1%81%D1%82%D1%8C-%D1%81-%D0%B4%D1%80%D1%83%D0%B3%D0%BE%D0%B3%D0%BE-%D1%81%D0%BE%D0%B1%D1%81%D1%82%D0%B2%D0%B5%D0%BD%D0%BD%D0%BE%D0%B3%D0%BE-%D0%BF%D1%80%D0%BE%D0%B5%D0%BA%D1%82%D0%B0

Тебе может это понравится...

Добавить комментарий