1

After passing a complex Codename One project from Ant to Maven with the appropriate tool (https://www.codenameone.com/blog/migrating-your-project-to-maven.html), in Netbeans 12.3 I have two problems:

  1. when in the log there is the stack trace of a crash, clicking on the line of code (reported in the log) does not open the related Java file and automatically scroll to the line in question (with Ant it worked).

  2. Netbeans reports me non-existent errors, even if it compiles correctly: these errors are all related to code that refers to libraries (before, with Ant, these errors were not reported).

Thanks for the suggestions

Error in Netbeans

Francesco Galgani
  • 6,137
  • 3
  • 20
  • 23
  • 1
    I also have this problem (with clicking on the line, not opening the related java file) in NetBeans. I haven't been able to figure out why yet. Perhaps related to the multi-module project layout that Netbeans is having difficulty navigating. Can you post an example of the errors? – steve hannah May 18 '21 at 20:43
  • You are asking two completely unrelated questions, which should be posted separately. Update your post to be more focused, and ask only one of the two questions. Otherwise it is liable to be closed. – skomisa May 19 '21 at 02:45
  • @stevehannah Thanks Steve for the clarification, I hope you work it out. Regarding the error, I attach a screenshot: obviously the code in question refers to cn1lib for using WebSocket. I have similar problems with all other cn1libs. But the code compiles! The code in the screenshot is pretty standard for the use of that cn1lib, so you can test it. If you find it useful, we can move these two issues to Github. – Francesco Galgani May 19 '21 at 20:11
  • (I updated the question by including the screenshot). – Francesco Galgani May 19 '21 at 20:12
  • @skomisa The two questions could be unrelated, or they could be related, we cannot know beforehand. These are two problems introduced after using the migration tool mentioned in the question, and it cannot be ruled out that both problems may have a common cause. – Francesco Galgani May 19 '21 at 20:15
  • @FrancescoGalgani We'll have to agree to disagree on the questions being related. As a separate matter, what version of Java are you using? – skomisa May 20 '21 at 00:43
  • @skomisa OpenJDK 11 – Francesco Galgani May 20 '21 at 09:58
  • @stevehannah I found a solution, please see my answer – Francesco Galgani May 20 '21 at 13:54

1 Answers1

1

I have good news, I solved both issues.

About the fake errors like in the screenshot, right-clicking on the "common" module of the Codename One project, there was an item "Resolve Project Problems" that I hadn't noticed before. The error was:

Your project has dependencies that are not resolved locally. Code completion in the IDE will not include classes from these dependencies or their transitive dependencies (unless they are among the open projects). Please download the dependencies, or install them manually, if not available remotely.

The artifacts are:

xxx:mainclass-cn1-websockets:jar:common:1.0-SNAPSHOT
xxx:mainclass-Device:jar:common:1.0-SNAPSHOT
xxx:mainclass-NativeLogsReader:jar:common:1.0-SNAPSHOT
xxx:mainclass-SMSActivation:jar:common:1.0-SNAPSHOT
xxx:mainclass-GoogleMaps:jar:common:1.0-SNAPSHOT
xxx:mainclass-CameraKitCodenameOne:jar:common:1.0-SNAPSHOT
xxx:mainclass-VideoOptimizerCN1Lib:jar:common:1.0-SNAPSHOT

As you can see, all the errors refer to cn1libs. By clicking on "Resolve", Netbeans automatically resolved this issue and the false errors (like the one in the screenshot) disappeared.

This partially solved also the first problem, related to the fact that Netbeans did not open the java file related to the error line reported in the log. I specified "partially solved" because the problem is solved only by taking care, before pressing "Run", to left-click in the Projects view on the main module of the application (otherwise the "Run" will refer to the "common" module, with various side effects). Ultimately, however, without the use of "Resolve Project Problems" this partial solution would not have worked. I'm sure of this because I ran some tests on the exact same error before and after.

UPDATE

Removing nbactions.xml from the common package prevents the use of "Run" with that package, avoiding the described problem.

Francesco Galgani
  • 6,137
  • 3
  • 20
  • 23