Gradle project doesn't import classes out of other projects or javax.persistence

TheAmygdala :

I have several java based projects in eclipse and build them via gradle. I want to import classes from project B and C into classes of project A. But I always get the error "The import bc.project.xyz cannot be resolved" That happens also when I import the javax.entity.EntityManager.

I imported all dependencies as written in other blogs like:

But all these suggestions dont work.

Some further details about the system environment:

  • java version 1.8.0_72 SE Runtime Environment (build 1.8.0.72-b15)
  • gradle version 5.1.1
  • Eclipse IDE 4.12
  • Windows 10

The projects are all in the same folder

build.gradle

dependencies {
    compile project(":project b")
    testCompile project(path: ':project b', configuration: 'tests')

    compile project(":project c")
    testCompile project(path: ':project c', configuration: 'tests')

    compile group: 'javax.persistence', name: 'persistence-api', version: '1.0'
    compile "javax.servlet:javax.servlet-api:3.1.0"
}
TheAmygdala :

Considering the quote 'The definition of insanity is doing the same thing over and over again and expecting a different result', I might be insane.

I cloned the project repositories for about 8-10 times and for some reason it works now. I did nothing different, I changed no line of code and still I got a different result. And by different result I mean the right result.

This blog is closed.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=162453&siteId=1