Bugfixing terracer: 6. Importing the Project Bugs
於 2017年一月15日 由 alexkemp 以English發表。 上一次更新在 2017年一月22日。- There May be Troubles Ahead
- Errors whilst Compiling using Ant
- Creating Eclipse Project
- Eclipse Debugging Routines
- wORD cASE bLINDNESS
- Importing the Project Bugs
- Have you Tried Restarting Your Program, Sir?
- Show Your Bugs, Damn You!
- Be Careful What You Wish For
- Installing NetBeans
Under Compiling using Eclipse the Developers’ Guide says: > Use Eclipse and the provided .project and .classpath file. Just import project using the JOSM core folder as root directory.
Those are brave words, but more than a touch useless for noobs like me (how do I do that?) (and exactly why do I need to compile anything anyway, since a full build is provided? I come here to debug a plugin, not compile it).
The nightmare of Black Friday 13 & Saturday suggest that I do need to import the provided project. So, here is how to do that (and, unfortunately, import the project’s bugs at the same time):
File ▸ Import
- (expand
General
) selectExisting Projects into Workspace
(pressNext>
) - (click
Browse...
onSelect root directory
) -
select
josm
dir + pressOK
A ghost-in-the-machine now appears within theProjects
box. The entire thing is grey rather than black (including the checkbox) and cannot be selected. After the initial checkbox, the text reads:josm (~/workspace/josm)
(the dir in brackets is identical to the workspace dir that has been selected) (this result previously stopped me going any further). Under the dialog title (Import Projects
) it says:
> Some projects cannot be imported because they already exist in the workspace - (click
Browse...
onSelect root directory
) - select
core
dir + pressOK
The text in theProjects
box now readsJOSM (~/workspace/josm/core)
and is both pre-selected & selectable. - Press
Finish
Back at the main window a Building Workspace
notice appears at bottom right. After a short while it concludes with 2 show-stopping errors:
> - The project was not built since its build path is incomplete. Cannot find the class file for AuthorizationProcedure. Fix the build path then try building this project
> - The type AuthorizationProcedure cannot be resolved. It is indirectly referenced from required .class files
Debug As ▸ Java Application
on ~/workspace/josm/core/eclipse/JOSM (Java 8).launch
now has a Proceed
button (although errors are reported) and clicking gives the result:
> The specified JRE installation does not exist
Not good, but it is progress.
Coda 1: Missing AuthorizationProcedure
This is located as follows (though atm I have zero idea as to why it is missing):
~/workspace/josm$ head ./core/src/org/openstreetmap/josm/gui/oauth/AuthorizationProcedure.java
// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.gui.oauth;
public enum AuthorizationProcedure {
/**
* Run a fully automatic procedure to get an access token from the OSM website.
* JOSM accesses the OSM website on behalf of the JOSM user and interacts
* with the site using an OSM session, form posting and screen scraping.
*/
Coda 2: The source of this problem?
It begins to look likely that the source of this problem is that the 3.8.1 version of Eclipse provided with Debian Stable (Jessie) is much, much too old, and thus cannot support JAVA-8. My first clue on this came with a stackoverflow question. The questioner answered his own question: > This was fixed by changing my Eclipse IDE version from indigo to luna. Luna comes with support for Java 8 so all issues have now been resolved.
Luna is 4.4 and was released in 2014 so yes, 3.8 (Juno) will not work with JAVA-8.
As necessary cross-confirmation, with advice from here, the compliance level needs to be at least 1.8 (Window ▸ Preferences
(open Java
) Compiler ▸ JDK Compliance
). If the JDK Compliance Level
is not set to 1.8 (or better), then that version can NOT support JAVA-8. In my case it was 1.4 & has 1.7 as the maximum available.
Eclipse has an Installer which promises easy updates (release-notes). Advice from linuxconfig.org if you would rather go the direct route. For me:
$ cd ~
$ tar xpf Downloads/eclipse-inst-linux64.tar.gz
$ cd eclipse-installer
$ ls -Al
total 296
-rw-r--r-- 1 alexk alexk 42735 Dec 14 10:58 artifacts.xml
drwxr-sr-x 4 alexk alexk 4096 Dec 14 10:58 configuration
-rwxr-xr-x 1 alexk alexk 80393 Dec 14 10:58 eclipse-inst
-rw-r--r-- 1 alexk alexk 316 Dec 14 10:59 eclipse-inst.ini
drwxr-sr-x 18 alexk alexk 4096 Dec 14 10:58 features
-rwxr-xr-x 1 alexk alexk 134914 Dec 14 10:58 icon.xpm
drwxr-sr-x 4 alexk alexk 4096 Dec 14 10:58 p2
drwxr-sr-x 4 alexk alexk 20480 Dec 14 10:58 plugins
drwxr-sr-x 2 alexk alexk 4096 Dec 14 10:58 readme
$ ./eclipse-inst
java version "1.7.0_111"
OpenJDK Runtime Environment (IcedTea 2.6.7) (7u111-2.6.7-2~deb8u1)
OpenJDK 64-Bit Server VM (build 24.111-b01, mixed mode)
Notice how the damn thing is running JAVA-7, even though I’ve set the alternatives system to prefer JAVA-8. That makes me spit. However, it is up & running with Version: Oxygen Release Milestone 4 (4.7.0 M4)
, and is set internally to use JAVA-8, except that we now get 56 errors, 6,082 warnings, 17 others
after building the workspace.
Fortunately, I spotted the name MapCSSParser
, which was referenced as Mappaint MapCSS
in the Wiki under ‘Compiling’:
- Go
Help ▸ Install New Software...
- Add URL http://eclipse-javacc.sourceforge.net/
- Add name
JavaCC Plugin
(pressing Enter put it in theWork with
selection, whilstJavaCC Eclipse Plugin
appeared in the box below, and needed to be selected) - Press
Next>
- (version 1.5.33) Press
Next>
- (accept license agreement) Press
Finish
- (warning about unsigned content) (prats - accept it)
- Restart Eclipse
That only puts us into a situation where we can compile the required .java files from MapCSSParser.jj
using the newly installed JavaCC
(try to keep up). Unfortunately, the Wiki has the wrong location for this file. You can find it at ~/workspace/josm/core/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParser.jj
. Locate it within the package explorer, right-click on it & select Compile with javacc
. When that completes all errors have gone, although there are now 6,299 warnings.
Debug As ▸ Java Application
on ~/workspace/josm/core/eclipse/JOSM (Java 8).launch
now launches the JOSM load window (I almost fainted, but it immediately stopped on Error: Unknown projection code
& restored my faith in buggy builds!).
討論