Issues with Liferay 7.1 workspace imported from Github

559 Views Asked by At

I have cloned my Liferay 7.1 workspace from my Github repository. When I try to get Assistance in Liferay IDE using Control+Space, I get error:

This compilation unit is not on the build path of a java project

This happens on the new module project created in the same workspace(that was cloned from Github). But when I create/import module from my local workspace that was created by Liferay for first time, this issue is not there.

I feel like there is some extra workspace setting that I am not doing in my Github workspace. Like we had to create build.username.properties in the SDK folder for Liferay 6.2. Totally stuck and no solutions anywhere.

I tried fixing Project Build path and Project Facets but did not help.

2

There are 2 best solutions below

0
Dhruv Pandey On BEST ANSWER

There were some differences between the workspace that I imported from Github and the one that Liferay was creating on my local. I opened both the workspaces in Beyond Compare. Following are the files that had major differences. I made them same and it started working after Gradle Refresh in Eclipse.

  • liferay-workspace/gradle/wrapper/gradle-wrapper.properties
  • liferay-workspace/.project
  • liferay-workspace/gradle.properties
  • liferay-workspace/gradlew
  • liferay-workspace/settings.gradle
0
Olaf Kock On

The way you did it in your own answer obviously solved it. My take on this is: The problem was most likely the .project file, because it contains all the configuration that eclipse requires, and the error message you post is an indicator that eclipse doesn't know what to do with these files.

The .project file can be regenerated from gradle settings, typically by choosing "gradle / refresh" (from memory, from the context menu of the project/workspace in Project Explorer), which will read the gradle settings and apply them to the eclipse world. This might happen automatically, but it might also need some manual push - next time you might want to try this, because just copying random files rarely is a good idea. You might end up pointing to other directories far outside of your workspace, and wonder why a local change is not picked up.