Message Boards
weird IDE Error markers Liferay 7.3.5 CE
weird IDE Error markers Liferay 7.3.5 CE
Junior Member Posts: 35 Join Date: 5/9/19 Recent PostsHello together,
currently I am trying to develop for the new Liferay 7.3.5ga6 CE version. I am getting weird IDE error markers and I dont know how to fix them.
What I have done:
- I have downloaded the LiferayWorkspacewithDevStudio windows installer and installed it. (Help -> About -> Liferay Developer Studio -> Version: 3.9.0.202010130127-ga1)
- After that I have created a new Liferay Workspace Project and checked the download Server bundle checkbox for bundle 7.3.5 ga6 CE.
- Then I created a new Liferay Module Project panel-app and deployed it. Everything works fine.
But in the Eclipse IDE I am getting on many lines of code (that was
generated by 'create new liferay module project')
errors
like:
on line '@Component' 'Component cannot be resolved
to a type'
on this import 'import
org.osgi.service.component.annotations.Component;' I am getting
'The type org.osgi.service.component.annotations.Component
is not accessible'
There are many other similar error markers (The type ... is not accessible). They do not break the module because if I deploy the module it is working fine.
Here is a screenshot from my IDE and these error markers: https://i.imgur.com/hPKDsdl.png
Why am I getting these error markers and how can I fix them?
RE: weird IDE Error markers Liferay 7.3.5 CE
Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent PostsYou're either missing an import (hit Ctrl-Shift-O, or "organize imports" from context menu) in the source file in question. Or you're missing a dependency in your build.gradle file.
E.g.
compileOnly group: "org.osgi", name: "org.osgi.service.component.annotations"
RE: weird IDE Error markers Liferay 7.3.5 CE
Junior Member Posts: 35 Join Date: 5/9/19 Recent PostsHello Olaf,
thanks for your answer. If I try to organize my imports nothing happens.
The build.gradle was auto generated by the IDE (create new liferay module project) and currently it looks like this:
dependencies {
compileOnly group: "com.liferay.portal", name: "release.portal.api"
cssBuilder group: "com.liferay", name: "com.liferay.css.builder", version: "3.0.2"
}
Why would the IDE generate a module that hasnt all dependencies in
its build.gradle file?
I tried to add the dependency but it
still shows the same error markers.
RE: RE: weird IDE Error markers Liferay 7.3.5 CE
Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent PostsIt might be that the dependency I'm listing is already contained in the release.portal.api dependency - I've not yet started a new project on 7.3, only ported existing ones forward that explicitly declared the modules they depend on.
RE: weird IDE Error markers Liferay 7.3.5 CE
Junior Member Posts: 35 Join Date: 5/9/19 Recent PostsI have tried to fix these error markers with no success.
I am
completely lost now. I dont know how to get rid of these. I tried to
reinstall my IDE and everything.
I dont know what is going on.
I am sorry to say this but the
dependency management with liferay and the liferay IDE is very unclear
for me. I dont even know if this is a dependency issue or a bug/error
in my IDE.
The craziest part is that my test module is working fine after I deploy it. But still the IDE shows these error markers on many lines of the generated code.
Has anyone had similar experiences developing with this IDE version (3.9.0.202010130127-ga1) and Liferay Portal CE 7.3.5ga6?
RE: weird IDE Error markers Liferay 7.3.5 CE
Junior Member Posts: 35 Join Date: 5/9/19 Recent PostsI am still getting these error markers with fresh generated
modules.
My goal is to upgrade some other modules from 7.1/7.2 to
the new liferay 7.3 version.
So like Olaf said here :
It might be that the dependency I'm listing is already contained in the release.portal.api dependency - I've not yet started a new project on 7.3, only ported existing ones forward that explicitly declared the modules they depend on.
If I remove the 'compileOnly group: "com.liferay.portal", name: "release.portal.api"' import and use every dependency import directly on its own I dont get these error markers anymore.
But is this the way to go now? I thought that the single build gradle
line 'compileOnly group: "com.liferay.portal", name:
"release.portal.api"' would solve importing every single
dependency manually or it has all dependencies in it for the fresh
generated module?
Can anyone confirm that other people are having similar issues
with those error markers? I am worried that I have a
problem in my IDE/workstation and this issue isnt an issue at all?
RE: RE: weird IDE Error markers Liferay 7.3.5 CE
Regular Member Posts: 104 Join Date: 3/10/11 Recent PostsI can confirm. Experiencing the exakt same thing with liferay IDE Version: 3.9.0.202010130127-ga1 and JDK11.0.8. Default install nothing changed and get errors if i dont use days to find what i need to put in gradle.build to get it to work.
RE: weird IDE Error markers Liferay 7.3.5 CE
New Member Posts: 15 Join Date: 3/11/10 Recent PostsHi,
What version of eclipse are you using? Also, what version of JDK do you have selected?
This works for me with eclipse 2020-09 and JDK 8 and 11. If i upgrade my workspace to Gradle 6, then it'll work with JDK 14.
Hope this helps!
RE: weird IDE Error markers Liferay 7.3.5 CE
Junior Member Posts: 35 Join Date: 5/9/19 Recent PostsHello,
I have changed my JDK version from zulu11.35.13-ca-jdk11.0.5-win_x64 to zulu8.44.0.11-ca-jdk8.0.242-win_x64 it seems that this fixed my issues with these error markers.
Is working with JDK zulu11.35.13-ca-jdk11.0.5-win_x64 an issue?
Are there any JDK versions that I should or sould not use while working/developing with liferay eclipse?
best regards and thanks for your help.
RE: RE: weird IDE Error markers Liferay 7.3.5 CE
New Member Posts: 15 Join Date: 3/11/10 Recent PostsI dont think that this is an issue with the JDK. I was able to follow your steps with Zulu11.43+21-CA
Can you try a project clean and then build again?
RE: RE: weird IDE Error markers Liferay 7.3.5 CE
New Member Posts: 15 Join Date: 3/11/10 Recent PostsActually, can you check a few different JDK settings in your eclipse?
Preferences > Java > Installed JREs
Preferences > Gradle > Java Home
Make sure these point to the correct JDK.
RE: RE: weird IDE Error markers Liferay 7.3.5 CE
Junior Member Posts: 35 Join Date: 5/9/19 Recent PostsHello Lawrence Lee,
I have tried this all (checked installed JREs/clean/rebuild) on multiple workstations with the same result.
Ashley Yuan created an issue for this problem which seemed fixed 2
days ago...
https://liferay.dev/blogs/-/blogs/new-installers-and-ide-3-9-0-ga1-released?scroll=_com_liferay_blogs_web_portlet_BlogsPortlet_discussionContainer
The issue: https://issues.liferay.com/browse/IDE-4902
I havent tried it since then.
RE: weird IDE Error markers Liferay 7.3.5 CE
New Member Post: 1 Join Date: 4/18/22 Recent PostsHello
I faced the same Issue
In Liferay 7.3 can be used only
compileOnly group: "com.liferay.portal", name:
"release.portal.api" instead of a lot of jar such in old
Liferay version and that cause IDE wired issue
to solve this issue
and then Upgrade gradle Version
gradle =>wrapper
=> gradle-wrapper.properties
Upgrade Gradle Workspace on file settings.gradle
classpath
group: "com.liferay", name:
"com.liferay.gradle.plugins.workspace", version: "3.4.2"
then upgrade any module using the old config at
build.gradle
such as
compileOnly group: "com.liferay.portal", name:
"com.liferay.portal.kernel"
compileOnly group:
'com.liferay', name: 'com.liferay.petra.function'
and use
compileOnly group: "com.liferay.portal", name: "release.portal.api"
last you must clear old jar and used release.portal.api
open
cmd and go to workspace folder then you will find gradlew.bat
run this command
gradlew.bat clean
to clean the project
and this issue solve