buildship icon indicating copy to clipboard operation
buildship copied to clipboard

how to add compileOnly module dependencies in to eclipse build path libary

Open ldwqh0 opened this issue 2 years ago • 3 comments

my eclipse is STS 4.12.1.RELEASE and gradle is v7.3. the build ship version is 3.1.5.

there are two module in my project , moduelA,moduleB. the moduleB depends on moduleA with compileOnly.

dependencies {
    compileOnly(project(":moduleA"))
    testImplementation("org.junit.jupiter:junit-jupiter-api")
    testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
}

how to add modulA into moduleB build path libary? image

i do not want to change compileOnly to Implementation. this project work good with gradlew build. and work ok in idea.

but it can not work in eclipse.

I'm try to resolve like this

plugins {
    `java-library`
    `maven-publish`
    `eclipse`
    id("io.spring.dependency-management")
}

eclipse {
    classpath {
        plusConfigurations.plus(configurations.compileOnly)
    }
}

but it can not work.

the projec is here

https://github.com/ldwqh0/buildship-problem.git

helpme

ldwqh0 avatar Nov 24 '21 09:11 ldwqh0

Me too

yuanjinyong avatar Nov 10 '22 17:11 yuanjinyong

for me it worked like this:

  configurations {
    eclipseExtraClasspath.extendsFrom compileOnly
  }

  eclipse.classpath {
    plusConfigurations += [ configurations.eclipseExtraClasspath ]
  }

cherni78 avatar Dec 01 '22 12:12 cherni78

Hi anyone, I tried this latest fix and it seems to me it results in "Unresolved dependencies" when using compileOnly together with version catalogues because the version is not resolved. Can anyone confirm?

moley avatar Jan 12 '23 21:01 moley