I have a J2EE program that I have been maintaining since 2006/7. The Ant build compiles all Java/J2EE code, creates the database in MySql and imports data into it, and deploys the build (exploded) war into Tomcat.
There's been no changes to the code in years. The only changes are in the stack - where I was forced to update the versions of Java (1.8), MySql (5.5), Eclipse, and lately, Windows (11).
This build runs flawlessly and I'm able to launch the website and run it successfully. The only thing that's changed is that somehow I'm unable to run the Ant build from inside Eclipse now.
I created the Eclipse project by importing the existing source folder. Then I created the 'Ant build' in the 'External Tools Configuration'. (I've been doing this in Eclipse since 2004, so I know the overall configurations I need to make.)
But somehow, either something's changed in Eclipse that I can't put my finger on or because I'm making a really silly error without knowing what it is, the Ant build from inside Eclipse keeps failing.
I've been trying all kinds of things to fix the Classpath, but nothing seems to work. This exact same build works with no changes from the command prompt. So, it's not a question of missing libraries - just finding them.
What's happening? Please help!
DETAILS:
Ant target 'compile':
<!-- Normal build of application -->
<target name="compile" depends="prepare,copy-resources">
<javac srcdir="src/java" destdir="${webinf.dir}/classes" debug="true">
<classpath refid="compile.classpath" />
</javac>
Error in execution of 'compile':
compile:
[javac] <PROJECT_LOC>\ant\build.xml:163: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 439 source files to C:\<src_root_folder>\WebContent\WEB-INF\classes
[javac] <PROJECT_LOC>\src\java\com\cs\service\rest\GeoCodeClient.java:32: error: package javax.xml.bind does not exist
[javac] import javax.xml.bind.JAXBException;
[javac] ^
[javac] <PROJECT_LOC>\src\java\com\cs\service\rest\GeoCodeClient.java:33: error: package javax.xml.bind does not exist
[javac] import javax.xml.bind.Marshaller;
[javac] ^
[javac] <PROJECT_LOC>>\src\java\com\cs\service\rest\GeoCodeClient.java:34: error: package javax.xml.bind does not exist
[javac] import javax.xml.bind.JAXBContext;
[javac] ^
[javac] <PROJECT_LOC>\src\java\com\cs\service\rest\GeoCodeClient.java:52: error: cannot find symbol
[javac] protected Marshaller marshaller;
[javac] ^
[javac] symbol: class Marshaller
[javac] location: class GeoCodeClient
[javac] <PROJECT_LOC>\src\java\com\cs\service\rest\GeoCodeClient.java:87: error: cannot find symbol
[javac] private Marshaller newMarshaller() {
[javac] ^
[javac] symbol: class Marshaller
[javac] location: class GeoCodeClient
[javac] <PROJECT_LOC>\src\java\com\cs\util\PasswordService.java:26: error: cannot find symbol
[javac] import sun.misc.BASE64Encoder;
[javac] ^
[javac] symbol: class BASE64Encoder
[javac] location: package sun.misc
...
...
...
[javac] <PROJECT_LOC>\src\java\com\cs\service\rest\GeoCodeClient.java:89: error: cannot find symbol
[javac] JAXBContext jc = JAXBContext
[javac] ^
[javac] symbol: class JAXBContext
[javac] location: class GeoCodeClient
[javac] <PROJECT_LOC>\src\java\com\cs\service\rest\GeoCodeClient.java:89: error: cannot find symbol
[javac] JAXBContext jc = JAXBContext
[javac] ^
[javac] symbol: variable JAXBContext
[javac] location: class GeoCodeClient
[javac] <PROJECT_LOC>\src\java\com\cs\service\rest\GeoCodeClient.java:92: error: cannot find symbol
[javac] marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
[javac] ^
[javac] symbol: variable Marshaller
[javac] location: class GeoCodeClient
[javac] <PROJECT_LOC>\src\java\com\cs\service\rest\GeoCodeClient.java:95: error: cannot find symbol
[javac] } catch (JAXBException jaxbe) {
[javac] ^
[javac] symbol: class JAXBException
[javac] location: class GeoCodeClient
[javac] <PROJECT_LOC>\src\java\com\cs\service\rest\GeoCodeClient.java:102: error: cannot access JAXBContext
[javac] RequestHeader header = factory.createRequestHeader();
[javac] ^
[javac] class file for javax.xml.bind.JAXBContext not found
[javac] <PROJECT_LOC>\src\java\com\cs\service\rest\GeoCodeClient.java:103: error: cannot access Element
[javac] header.setClientName(clientName);
[javac] ^
[javac] class file for javax.xml.bind.Element not found
[javac] <PROJECT_LOC>\src\java\com\cs\service\rest\GeoCodeClient.java:108: error: cannot find symbol
[javac] } catch (JAXBException jaxbe) {
[javac] ^
[javac] symbol: class JAXBException
[javac] location: class GeoCodeClient
[javac] <PROJECT_LOC>\src\java\com\cs\service\rest\GeoCodeClient.java:128: error: cannot find symbol
[javac] } catch (JAXBException jaxbe) {
[javac] ^
[javac] symbol: class JAXBException
[javac] location: class GeoCodeClient
...
...
...
[javac] <PROJECT_LOC>\src\java\com\cs\util\PasswordService.java:51: error: cannot find symbol
[javac] String hash = (new BASE64Encoder()).encode(raw);
[javac] ^
[javac] symbol: class BASE64Encoder
[javac] location: class PasswordService
[javac] <PROJECT_LOC>\src\java\com\cs\util\gis\DeCartaGeoCodeService.java:102: error: cannot find symbol
[javac] } catch (JAXBException e) {
[javac] ^
[javac] symbol: class JAXBException
[javac] location: class DeCartaGeoCodeService
[javac] <PROJECT_LOC>\src\java\com\cs\util\gis\DeCartaGeoCodeService.java:166: error: cannot find symbol
[javac] } catch (JAXBException e) {
[javac] ^
[javac] symbol: class JAXBException
[javac] location: class DeCartaGeoCodeService
[javac] <PROJECT_LOC>\src\java\com\cs\util\gis\DeCartaGeoCodeService.java:263: error: cannot find symbol
[javac] } catch (JAXBException e) {
[javac] ^
[javac] symbol: class JAXBException
[javac] location: class DeCartaGeoCodeService