@@ -1223,6 +1223,8 @@ public void setMavenSession(MavenSession mavenSession) {
12231223 private static final String XML_ELEMENT_REF_CLASS_QNAME = "javax.xml.bind.annotation."
12241224 + XML_ELEMENT_REF_CLASS_NAME ;
12251225
1226+ private static final String JAXB_CONTEXT_FACTORY_CLASS_QNAME = "javax.xml.bind.JAXBContextFactory" ;
1227+
12261228 public ProjectBuilder getMavenProjectBuilder () {
12271229 return mavenProjectBuilder ;
12281230 }
@@ -1258,22 +1260,24 @@ protected void logApiConfiguration() {
12581260 }
12591261 getLog ().info ("JAXB API is loaded from the [" + location + "]." );
12601262
1261- try {
1262- xmlSchemaClass .getMethod ("location" );
1263-
1264- final Class <?> xmlElementRefClass = Class
1265- .forName (XML_ELEMENT_REF_CLASS_QNAME );
1266-
1267- try {
1268- xmlElementRefClass .getMethod ("required" );
1269- getLog ().info ("Detected JAXB API version [2.2]." );
1270- } catch (NoSuchMethodException nsmex2 ) {
1271- getLog ().info ("Detected JAXB API version [2.1]." );
1272- }
1273- } catch (NoSuchMethodException nsmex1 ) {
1274- getLog ().info ("Detected JAXB API version [2.0]." );
1263+ try {
1264+ final Class <?> jaxbContextFactoryClass = Class .forName (JAXB_CONTEXT_FACTORY_CLASS_QNAME );
1265+ getLog ().info ("Detected JAXB API version [2.3]." );
1266+ } catch (final ClassNotFoundException cnfexc ) {
1267+ try {
1268+ xmlSchemaClass .getMethod ("location" );
1269+ final Class <?> xmlElementRefClass = Class .forName (XML_ELEMENT_REF_CLASS_QNAME );
12751270
1276- }
1271+ try {
1272+ xmlElementRefClass .getMethod ("required" );
1273+ getLog ().info ("Detected JAXB API version [2.2]." );
1274+ } catch (NoSuchMethodException nsmex2 ) {
1275+ getLog ().info ("Detected JAXB API version [2.1]." );
1276+ }
1277+ } catch (NoSuchMethodException nsmex1 ) {
1278+ getLog ().info ("Detected JAXB API version [2.0]." );
1279+ }
1280+ }
12771281 } catch (ClassNotFoundException cnfex ) {
12781282 getLog ().error (
12791283 "Could not find JAXB 2.x API classes. Make sure JAXB 2.x API is on the classpath." );
0 commit comments