OpenStreetMap

Bugfixing terracer: 2. Errors whilst Compiling using Ant

Posted by alexkemp on 10 January 2017 in English. Last updated on 22 January 2017.
  1. There May be Troubles Ahead
  2. Errors whilst Compiling using Ant
  3. Creating Eclipse Project
  4. Eclipse Debugging Routines
  5. wORD cASE bLINDNESS
  6. Importing the Project Bugs
  7. Have you Tried Restarting Your Program, Sir?
  8. Show Your Bugs, Damn You!
  9. Be Careful What You Wish For
  10. Installing NetBeans

Having used SVN to install the whole of the build directory into ~/josm, the developer’s Wiki says:- > The easiest way to compile JOSM … is to go to the josm directory and type: ant.

Hah! This is what happened to me:

~$ cd josm    
~/josm$ ant    
Unable to locate tools.jar. Expected to find it in /usr/lib/jvm/java-8-openjdk-amd64/lib/tools.jar    
Buildfile: build.xml does not exist!    
Build failed

The reason for the error is that I’ve only got the JAVA-7 JDK installed (the default JRE is JAVA-8, but that is the runtime environment, and it is the development kit that is needed here):

~/josm$ locate /tools.jar
/usr/lib/jvm/java-7-openjdk-amd64/lib/tools.jar

The fix is to install the missing openjdk-8-jdk, which I do via Synaptic. The result is still disappointing:

~/josm$ ant
Buildfile: build.xml does not exist!
Build failed

This is getting boring. build.xml is the buildfile (configuration-file) for the compiler. It’s default location is within the root of the directory from which the compiler is launched (./). Naturally, there isn’t a buildfile in the base directory, though there is within core/ & other directories. Which one to use? Who knows?

I try to use an intelligent pin:

~/josm$ ls
core  dist  i18n  plugins  webgrabber
~/josm$ cd core
~/josm/core$ ant
Buildfile: ~/josm/core/build.xml

init-properties:

init:
    [mkdir] Created dir:~/josm/core/build
    [mkdir] Created dir: ~/josm/core/dist

javacc:
    [mkdir] Created dir: ~/josm/core/src/org/openstreetmap/josm/gui/mappaint/mapcss/parsergen
     [exec] Java Compiler Compiler Version 6.1_9 (Parser Generator)
     [exec] (type "javacc" with no arguments for help)
     [exec] Reading from file ~/josm/core/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParser.jj . . .
     [exec] Warning: Line 4, Column 3: Command line setting of "OUTPUT_DIRECTORY" modifies option value in file.
     [exec] Warning: Line 168, Column 5: Non-ASCII characters used in regular expression.
     [exec] Please make sure you use the correct Reader when you create the parser, one that can handle your character set.
     [exec] File "TokenMgrError.java" does not exist.  Will create one.
     [exec] File "ParseException.java" does not exist.  Will create one.
     [exec] File "Token.java" does not exist.  Will create one.
     [exec] File "SimpleCharStream.java" does not exist.  Will create one.
     [exec] Parser generated with 0 errors and 2 warnings.

compile:
    [javac] Compiling 360 source files to ~/josm/core/build
    [javac] Note: ~/josm/core/src/oauth/signpost/AbstractOAuthProvider.java uses or overrides a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] Compiling 51 source files to ~/josm/core/build
    [javac] Compiling 1455 source files to ~/josm/core/build
    [javac] ~/josm/core/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java:901: warning: [deprecation] isChanged() in Layer has been deprecated
(many other similar deprecation & other warnings removed)
    [javac] 8 warnings
     [copy] Copying 1 file to ~/josm/core/build

init-svn-revision-xml:

init-git-revision-xml:

create-revision:
   [delete] Deleting: ~/josm/core/REVISION.XML

check-schemas:

epsg-compile:
    [mkdir] Created dir: ~/josm/core/build2
    [javac] Compiling 1 source file to ~/josm/core/build2

epsg:
    [touch] Creating ~/josm/core/data/projection/custom-epsg

dist:
     [echo] Revision 11444
     [copy] Copying 1 file to~/josm/core/build
     [copy] Copying 1 file to ~/josm/core/build
     [copy] Copying 1 file to ~/josm/core/build
      [jar] Building jar: ~/josm/core/dist/josm-custom.jar

BUILD SUCCESSFUL
Total time: 1 minute 40 seconds

That is a horrible, large number of warnings, but it works now!

Discussion

Log in to leave a comment