#2076 - Remove JAXB as dependency of ebean-api

- Move JAXB detection to ebean-ddlgen
- JAXB as test dependency of ebean-core
This commit is contained in:
rob bygrave
2020-10-12 16:10:07 +13:00
parent 050a3e2368
commit c783f26340
7 changed files with 26 additions and 30 deletions
-8
View File
@@ -91,14 +91,6 @@
<optional>true</optional>
</dependency>
<!-- Provided scope to compile with java 11 -->
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.2</version>
<scope>provided</scope>
</dependency>
<!-- Provided scope so that the H2HistoryTrigger can live in Ebean core
and not require a separate module for it -->
<dependency>
@@ -62,14 +62,6 @@ public class ClassLoadConfig {
return isPresent("javax.annotation.PostConstruct");
}
/**
* Return true if javax JAXB is present (maybe not in java9).
* If not we don't try to parse or support 'extra ddl'.
*/
public boolean isJavaxJAXBPresent() {
return isPresent("javax.xml.bind.JAXBException");
}
/**
* Return true if Jackson annotations like JsonIgnore are present.
*/
+7 -8
View File
@@ -54,6 +54,13 @@
<version>12.4.1</version>
<scope>test</scope>
</dependency>
<!-- test scope for supporting ebean-ddlgen -->
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
@@ -112,14 +119,6 @@
<optional>true</optional>
</dependency>
<!-- Provided scope to compile with java 11 -->
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
@@ -216,10 +216,6 @@ public class InternalConfiguration {
}
private List<XmapEbean> readExternalMapping() {
//TODO: Remove the isJavaxJAXBPresent() check once this is external module
if (!config.getClassLoadConfig().isJavaxJAXBPresent()) {
return Collections.emptyList();
}
final XmapService xmapService = config.service(XmapService.class);
if (xmapService == null) {
return Collections.emptyList();
@@ -60,7 +60,7 @@ public class DdlGenerator implements SpiDdlGenerator {
public DdlGenerator(SpiEbeanServer server) {
this.server = server;
final DatabaseConfig config = server.getServerConfig();
this.jaxbPresent = config.getClassLoadConfig().isJavaxJAXBPresent();
this.jaxbPresent = Detect.isJAXBPresent(config);
this.generateDdl = config.isDdlGenerate();
this.extraDdl = config.isDdlExtra();
this.createOnly = config.isDdlCreateOnly();
@@ -0,0 +1,16 @@
package io.ebeaninternal.dbmigration;
import io.ebean.config.DatabaseConfig;
/**
* Detect existence of JAXB
*/
public class Detect {
/**
* Return true if JAXB is present.
*/
public static boolean isJAXBPresent(DatabaseConfig config) {
return config.getClassLoadConfig().isPresent("javax.xml.bind.JAXBException");
}
}
@@ -3,6 +3,7 @@ package io.ebeaninternal.dbmigration.model;
import io.ebean.config.DbConstraintNaming;
import io.ebean.config.dbplatform.DatabasePlatform;
import io.ebeaninternal.api.SpiEbeanServer;
import io.ebeaninternal.dbmigration.Detect;
import io.ebeaninternal.dbmigration.ddlgeneration.DdlHandler;
import io.ebeaninternal.dbmigration.ddlgeneration.DdlOptions;
import io.ebeaninternal.dbmigration.ddlgeneration.DdlWrite;
@@ -66,7 +67,7 @@ public class CurrentModel {
this.databasePlatform = server.getDatabasePlatform();
this.constraintNaming = constraintNaming;
this.platformTypes = platformTypes;
this.jaxbPresent = server.getServerConfig().getClassLoadConfig().isJavaxJAXBPresent();
this.jaxbPresent = Detect.isJAXBPresent(server.getServerConfig());
}
public DdlOptions getDdlOptions() {