forked from loafle/openapi-generator-original
[JaxrsResteasy] Fix EAP dependencies for Java 8 (#6058)
* Depend on Joda by default, like the default JAX-RS server * If Java 8 is specified add Jackson JSR-310 dependency and import in the JacksonConfig.
This commit is contained in:
parent
24d7700cd0
commit
dc800c79cc
@ -9,7 +9,12 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
{{#java8}}
|
||||||
|
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||||
|
{{/java8}}
|
||||||
|
{{^java8}}
|
||||||
import com.fasterxml.jackson.datatype.joda.JodaModule;
|
import com.fasterxml.jackson.datatype.joda.JodaModule;
|
||||||
|
{{/java8}}
|
||||||
|
|
||||||
@Provider
|
@Provider
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
@ -25,9 +30,9 @@ public class JacksonConfig implements ContextResolver<ObjectMapper> {
|
|||||||
{{#java8}}
|
{{#java8}}
|
||||||
this.objectMapper.registerModule(new JavaTimeModule());
|
this.objectMapper.registerModule(new JavaTimeModule());
|
||||||
{{/java8}}
|
{{/java8}}
|
||||||
{{#joda}}
|
{{^java8}}
|
||||||
this.objectMapper.registerModule(new JodaModule());
|
this.objectMapper.registerModule(new JodaModule());
|
||||||
{{/joda}}
|
{{/java8}}
|
||||||
|
|
||||||
// sample to convert any DateTime to readable timestamps
|
// sample to convert any DateTime to readable timestamps
|
||||||
//this.objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, true);
|
//this.objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, true);
|
||||||
|
@ -15,10 +15,16 @@ dependencies {
|
|||||||
providedCompile 'javax.annotation:javax.annotation-api:1.2'
|
providedCompile 'javax.annotation:javax.annotation-api:1.2'
|
||||||
providedCompile 'org.jboss.spec.javax.servlet:jboss-servlet-api_3.0_spec:1.0.0.Final'
|
providedCompile 'org.jboss.spec.javax.servlet:jboss-servlet-api_3.0_spec:1.0.0.Final'
|
||||||
compile 'org.jboss.resteasy:resteasy-jackson2-provider:3.0.11.Final'
|
compile 'org.jboss.resteasy:resteasy-jackson2-provider:3.0.11.Final'
|
||||||
{{#joda}}
|
{{#useBeanValidation}}
|
||||||
compile 'com.fasterxml.jackson.datatype:jackson-datatype-joda:2.4.1'
|
providedCompile 'javax.validation:validation-api:1.1.0.Final'
|
||||||
|
{{/useBeanValidation}}
|
||||||
|
{{^java8}}
|
||||||
|
compile 'com.fasterxml.jackson.datatype:jackson-datatype-joda:2.6.3'
|
||||||
compile 'joda-time:joda-time:2.7'
|
compile 'joda-time:joda-time:2.7'
|
||||||
{{/joda}}
|
{{/java8}}
|
||||||
|
{{#java8}}
|
||||||
|
compile 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.6.3'
|
||||||
|
{{/java8}}
|
||||||
testCompile 'junit:junit:4.12',
|
testCompile 'junit:junit:4.12',
|
||||||
'org.hamcrest:hamcrest-core:1.3'
|
'org.hamcrest:hamcrest-core:1.3'
|
||||||
}
|
}
|
||||||
|
@ -98,16 +98,6 @@
|
|||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
|
||||||
<artifactId>jackson-datatype-joda</artifactId>
|
|
||||||
<version>2.4.1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>joda-time</groupId>
|
|
||||||
<artifactId>joda-time</artifactId>
|
|
||||||
<version>2.7</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.swagger</groupId>
|
<groupId>io.swagger</groupId>
|
||||||
<artifactId>swagger-jaxrs</artifactId>
|
<artifactId>swagger-jaxrs</artifactId>
|
||||||
@ -140,27 +130,32 @@
|
|||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
{{#useBeanValidation}}
|
{{#useBeanValidation}}
|
||||||
<!-- Bean Validation API support -->
|
<!-- Bean Validation API support -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.validation</groupId>
|
<groupId>javax.validation</groupId>
|
||||||
<artifactId>validation-api</artifactId>
|
<artifactId>validation-api</artifactId>
|
||||||
<version>1.1.0.Final</version>
|
<version>1.1.0.Final</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
{{/useBeanValidation}}
|
{{/useBeanValidation}}
|
||||||
{{#joda}}
|
{{^java8}}
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
<groupId>joda-time</groupId>
|
||||||
<artifactId>jackson-datatype-joda</artifactId>
|
<artifactId>joda-time</artifactId>
|
||||||
<version>2.1.1</version>
|
<version>2.7</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
{{/joda}}
|
<dependency>
|
||||||
{{#java8}}
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
<dependency>
|
<artifactId>jackson-datatype-joda</artifactId>
|
||||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
<version>2.6.3</version>
|
||||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
</dependency>
|
||||||
<version>2.6.3</version>
|
{{/java8}}
|
||||||
</dependency>
|
{{#java8}}
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
|
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||||
|
<version>2.6.3</version>
|
||||||
|
</dependency>
|
||||||
{{/java8}}
|
{{/java8}}
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -15,7 +15,8 @@ dependencies {
|
|||||||
providedCompile 'javax.annotation:javax.annotation-api:1.2'
|
providedCompile 'javax.annotation:javax.annotation-api:1.2'
|
||||||
providedCompile 'org.jboss.spec.javax.servlet:jboss-servlet-api_3.0_spec:1.0.0.Final'
|
providedCompile 'org.jboss.spec.javax.servlet:jboss-servlet-api_3.0_spec:1.0.0.Final'
|
||||||
compile 'org.jboss.resteasy:resteasy-jackson2-provider:3.0.11.Final'
|
compile 'org.jboss.resteasy:resteasy-jackson2-provider:3.0.11.Final'
|
||||||
compile 'com.fasterxml.jackson.datatype:jackson-datatype-joda:2.4.1'
|
providedCompile 'javax.validation:validation-api:1.1.0.Final'
|
||||||
|
compile 'com.fasterxml.jackson.datatype:jackson-datatype-joda:2.6.3'
|
||||||
compile 'joda-time:joda-time:2.7'
|
compile 'joda-time:joda-time:2.7'
|
||||||
testCompile 'junit:junit:4.12',
|
testCompile 'junit:junit:4.12',
|
||||||
'org.hamcrest:hamcrest-core:1.3'
|
'org.hamcrest:hamcrest-core:1.3'
|
||||||
|
@ -98,16 +98,6 @@
|
|||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
|
||||||
<artifactId>jackson-datatype-joda</artifactId>
|
|
||||||
<version>2.4.1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>joda-time</groupId>
|
|
||||||
<artifactId>joda-time</artifactId>
|
|
||||||
<version>2.7</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.swagger</groupId>
|
<groupId>io.swagger</groupId>
|
||||||
<artifactId>swagger-jaxrs</artifactId>
|
<artifactId>swagger-jaxrs</artifactId>
|
||||||
@ -139,18 +129,23 @@
|
|||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- Bean Validation API support -->
|
<!-- Bean Validation API support -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.validation</groupId>
|
<groupId>javax.validation</groupId>
|
||||||
<artifactId>validation-api</artifactId>
|
<artifactId>validation-api</artifactId>
|
||||||
<version>1.1.0.Final</version>
|
<version>1.1.0.Final</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
<groupId>joda-time</groupId>
|
||||||
<artifactId>jackson-datatype-joda</artifactId>
|
<artifactId>joda-time</artifactId>
|
||||||
<version>2.1.1</version>
|
<version>2.7</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
|
<artifactId>jackson-datatype-joda</artifactId>
|
||||||
|
<version>2.6.3</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<repositories>
|
<repositories>
|
||||||
|
@ -15,6 +15,9 @@ dependencies {
|
|||||||
providedCompile 'javax.annotation:javax.annotation-api:1.2'
|
providedCompile 'javax.annotation:javax.annotation-api:1.2'
|
||||||
providedCompile 'org.jboss.spec.javax.servlet:jboss-servlet-api_3.0_spec:1.0.0.Final'
|
providedCompile 'org.jboss.spec.javax.servlet:jboss-servlet-api_3.0_spec:1.0.0.Final'
|
||||||
compile 'org.jboss.resteasy:resteasy-jackson2-provider:3.0.11.Final'
|
compile 'org.jboss.resteasy:resteasy-jackson2-provider:3.0.11.Final'
|
||||||
|
providedCompile 'javax.validation:validation-api:1.1.0.Final'
|
||||||
|
compile 'com.fasterxml.jackson.datatype:jackson-datatype-joda:2.6.3'
|
||||||
|
compile 'joda-time:joda-time:2.7'
|
||||||
testCompile 'junit:junit:4.12',
|
testCompile 'junit:junit:4.12',
|
||||||
'org.hamcrest:hamcrest-core:1.3'
|
'org.hamcrest:hamcrest-core:1.3'
|
||||||
}
|
}
|
||||||
|
@ -98,16 +98,6 @@
|
|||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
|
||||||
<artifactId>jackson-datatype-joda</artifactId>
|
|
||||||
<version>2.4.1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>joda-time</groupId>
|
|
||||||
<artifactId>joda-time</artifactId>
|
|
||||||
<version>2.7</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.swagger</groupId>
|
<groupId>io.swagger</groupId>
|
||||||
<artifactId>swagger-jaxrs</artifactId>
|
<artifactId>swagger-jaxrs</artifactId>
|
||||||
@ -139,13 +129,23 @@
|
|||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- Bean Validation API support -->
|
<!-- Bean Validation API support -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.validation</groupId>
|
<groupId>javax.validation</groupId>
|
||||||
<artifactId>validation-api</artifactId>
|
<artifactId>validation-api</artifactId>
|
||||||
<version>1.1.0.Final</version>
|
<version>1.1.0.Final</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>joda-time</groupId>
|
||||||
|
<artifactId>joda-time</artifactId>
|
||||||
|
<version>2.7</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
|
<artifactId>jackson-datatype-joda</artifactId>
|
||||||
|
<version>2.6.3</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<repositories>
|
<repositories>
|
||||||
|
@ -22,6 +22,7 @@ public class JacksonConfig implements ContextResolver<ObjectMapper> {
|
|||||||
public JacksonConfig() throws Exception {
|
public JacksonConfig() throws Exception {
|
||||||
this.objectMapper = new ObjectMapper();
|
this.objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
|
this.objectMapper.registerModule(new JodaModule());
|
||||||
|
|
||||||
// sample to convert any DateTime to readable timestamps
|
// sample to convert any DateTime to readable timestamps
|
||||||
//this.objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, true);
|
//this.objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user