Skip to content

Commit

Permalink
[#429] Fixing error warning on javax classes not found
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentschoelens authored and mattrpav committed Oct 6, 2023
1 parent dcf47d5 commit e5a9ae1
Showing 1 changed file with 4 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1122,7 +1122,7 @@ public void setProject(MavenProject project) {
this.project = project;
}

private static final String XML_SCHEMA_CLASS_QNAME = "javax.xml.bind.annotation."
private static final String XML_SCHEMA_CLASS_QNAME = "jakarta.xml.bind.annotation."
+ XML_SCHEMA_CLASS_NAME;

public ArtifactResolver getArtifactResolver() {
Expand All @@ -1145,7 +1145,7 @@ public void setArtifactMetadataSource(
this.artifactMetadataSource = artifactMetadataSource;
}

private static final String XML_SCHEMA_RESOURCE_QNAME = "/javax/xml/bind/annotation/"
private static final String XML_SCHEMA_RESOURCE_QNAME = "/jakarta/xml/bind/annotation/"
+ XML_SCHEMA_RESOURCE_NAME;

public ArtifactFactory getArtifactFactory() {
Expand All @@ -1166,7 +1166,7 @@ public void setLocalRepository(ArtifactRepository localRepository) {
this.localRepository = localRepository;
}

private static final String XML_ELEMENT_REF_CLASS_QNAME = "javax.xml.bind.annotation."
private static final String XML_ELEMENT_REF_CLASS_QNAME = "jakarta.xml.bind.annotation."
+ XML_ELEMENT_REF_CLASS_NAME;

public MavenProjectBuilder getMavenProjectBuilder() {
Expand Down Expand Up @@ -1203,26 +1203,9 @@ protected void logApiConfiguration() {
location = draftLocation;
}
getLog().info("JAXB API is loaded from the [" + location + "].");

try {
xmlSchemaClass.getMethod("location");

final Class<?> xmlElementRefClass = Class
.forName(XML_ELEMENT_REF_CLASS_QNAME);

try {
xmlElementRefClass.getMethod("required");
getLog().info("Detected JAXB API version [2.2].");
} catch (NoSuchMethodException nsmex2) {
getLog().info("Detected JAXB API version [2.1].");
}
} catch (NoSuchMethodException nsmex1) {
getLog().info("Detected JAXB API version [2.0].");

}
} catch (ClassNotFoundException cnfex) {
getLog().error(
"Could not find JAXB 2.x API classes. Make sure JAXB 2.x API is on the classpath.");
"Could not find JAXB Jakarta API classes. Make sure JAXB Jakarta API is on the classpath.");
}
}

Expand Down

0 comments on commit e5a9ae1

Please sign in to comment.