The Way around Xerces XML Problems in Java

More to come on a complete explanation later. This is a short journal.
A few configurations I’ve tried:

What works now:

Downloading and installing Maven.
Creating a base pom.xml file containing relevant project information should this ever get published, with just the basics.

To be Specific (from my Maven XML POM):

<modelVersion>4.0.0</modelVersion>
  <groupId>com.github.jazad136</groupId>
  <artifactId>answerml-releases</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>
  
  <repositories>
		<repository>
			<id>jakarta.oss.sonatype.org</id>
			<name>Jakarta OSS Sonatype Staging</name>
			<url>https://jakarta.oss.sonatype.org/content/repositories/staging</url>
		</repository>
  </repositories>
  
  <name>answerml-releases</name>
  <description>AnswerML serialization</description>
  
  <url>http://github.com/jazad136</url>
  <licenses>
    <license>
	<name>The Apache Software License, Version 2.0</name>
	<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
	<distribution>repo</distribution>
	</license>
  </licenses>
  
  <developers>
  <developer>
  	<id>jazad136</id>
  	<name>Jonathan A. Saddler</name>
  	<email>1129384+jazad136@users.noreply.github.com</email>
  	<organization>University of Nebraska, Lincoln, Department of Computer Science and Engineering</organization>
  	<organizationUrl>http://cse.unl.edu</organizationUrl>
  	<roles>
  	<role>maintainer</role>
  	</roles>
  	<timezone>UTC−06:00</timezone>
  	<url>http://cse.unl.edu/~jsaddle</url>
  </developer>
  </developers>
<build>
	  <plugins>
			<plugin>
			    <groupId>org.apache.maven.plugins</groupId>
			    <artifactId>maven-gpg-plugin</artifactId>
			    <version>1.6</version>
			    <executions><execution>
			        <id>sign-artifacts</id>
			        <phase>verify</phase>
			        <goals><goal>sign</goal></goals>
			    </execution></executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-source-plugin</artifactId>
				<version>3.0.1</version>
				<executions><execution>
					<id>attach-sources</id>
					<goals><goal>jar-no-fork</goal></goals>
				</execution></executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-javadoc-plugin</artifactId>
				<version>3.1.0</version>
				<executions><execution>
					<id>attach-javadocs</id>
					<goals><goal>jar</goal></goals>
				</execution></executions>
				<configuration>
		       		<doclint>none</doclint>
		    	</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
				<version>3.1.1</version>
		        <configuration>
		          	<archive>
		            	  <addMavenDescriptor>false</addMavenDescriptor>
		            	  <compress>true</compress>
		            	  <manifest>
		              	    <mainClass>edu.unl.cse.efs.app.EventFlowSlicer</mainClass>
		           		    <addClasspath>true</addClasspath>
		              	    <classpathPrefix>lib</classpathPrefix>
		            	  </manifest>
		          	</archive>
		        </configuration>
			</plugin>
	        <plugin>
			  <groupId>org.apache.maven.plugins</groupId>
			  <artifactId>maven-dependency-plugin</artifactId>
			  <executions>
				  <execution>
				    <id>copy-dependencies</id>
				    <phase>prepare-package</phase>
				    <goals><goal>copy-dependencies</goal></goals>
				    <configuration>
				      <outputDirectory>${project.build.directory}/lib</outputDirectory>
				      <overWriteReleases>false</overWriteReleases>
				      <overWriteSnapshots>false</overWriteSnapshots>
				      <overWriteIfNewer>true</overWriteIfNewer>
				    </configuration>
				  </execution>
			  </executions>
			</plugin>
			
			<plugin>
			    <artifactId>maven-assembly-plugin</artifactId>
			    <version>3.1.1</version>
			    <executions><execution>
			        <id>create-distro</id>
			        <phase>package</phase>
			        <goals><goal>single</goal></goals>
			        <configuration>
				    <descriptors><descriptor>src/main/resources/assemblies/zip-with-dependencies.xml</descriptor></descriptors> 
				    </configuration>
			    </execution></executions>
			</plugin>
	</plugins>
  </build>
<dependencies>
<!-- wait for next step -->
</dependencies>


Play with the “dependencyManagement” section. Add specific dependencies to ensure the file gets read in.

To be more specific:

<dependencies>
    <dependency>
        <groupId>jakarta.xml.bind</groupId>
        <artifactId>jakarta.xml.bind-api</artifactId>
        <version>3.0.0</version>
    </dependency>
    <dependency>
	    <groupId>org.glassfish.jaxb</groupId>
	    <artifactId>jaxb-runtime</artifactId>
	    <version>3.0.0</version>
	</dependency>
</dependencies>

A few websites I’ve used:

This Question helps as it shows what JAR files are added to the module path after including the dependencies above:
https://stackoverflow.com/questions/54632086/java-11-implementation-of-jaxb-api-has-not-been-found-on-module-path-or-classpa
And Specifically this answer: https://stackoverflow.com/a/66068044/2229917

Leave a comment

Design a site like this with WordPress.com
Get started