Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generators Tweaks for Jakarta Option #1148

Merged
merged 3 commits into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public CharSequence getModelImports(Map<String, Object> templateData, Options op
if (withXml && jakarta) {
builder.append("import jakarta.xml.bind.annotation.*;\n");
} else if (withXml) {
builder.append("import jakarta.xml.bind.annotation.*;\n");
builder.append("import javax.xml.bind.annotation.*;\n");
}
if (parcelableModel) {
builder.append("import android.os.Parcelable;\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ public CodegenType getTag() {
public void processOpts() {
super.processOpts();

if (java11Mode) {
additionalProperties.put(JAKARTA, jakarta = true);
}

if (additionalProperties.containsKey(CodegenConstants.IMPL_FOLDER)) {
implFolder = (String) additionalProperties.get(CodegenConstants.IMPL_FOLDER);
}
Expand Down
7 changes: 6 additions & 1 deletion src/main/resources/handlebars/Java/build.gradle.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ if(hasProperty('target') && target == 'android') {
}

dependencies {
provided 'jakarta.annotation:jakarta.annotation-api:{{#jakarta}}2.1.1{{/jakarta}}{{^jakarta}}1.3.5{{/jakarta}}'
{{#jakarta}}
provided 'jakarta.annotation:jakarta.annotation-api:2.1.1'
{{/jakarta}}
{{^jakarta}}
provided 'javax.annotation:jsr250-api:1.0'
{{/jakarta}}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ if(hasProperty('target') && target == 'android') {
}

dependencies {
provided 'jakarta.annotation:jakarta.annotation-api:{{#jakarta}}2.1.1{{/jakarta}}{{^jakarta}}1.3.5{{/jakarta}}'
{{#jakarta}}
provided 'jakarta.annotation:jakarta.annotation-api:2.1.1'
{{/jakarta}}
{{^jakarta}}
provided 'javax.annotation:jsr250-api:1.0'
{{/jakarta}}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ if(hasProperty('target') && target == 'android') {
}

dependencies {
provided 'jakarta.annotation:jakarta.annotation-api:{{#jakarta}}2.1.1{{/jakarta}}{{^jakarta}}1.3.5{{/jakarta}}'
{{#jakarta}}
provided 'jakarta.annotation:jakarta.annotation-api:2.1.1'
{{/jakarta}}
{{^jakarta}}
provided 'javax.annotation:jsr250-api:1.0'
{{/jakarta}}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,12 +289,22 @@
{{/supportJava6}}
{{#useBeanValidation}}
<!-- Bean Validation API support -->
{{#jakarta}}
<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<version>{{#jakarta}}3.0.2{{/jakarta}}{{^jakarta}}2.0.2{{/jakarta}}</version>
<version>3.0.2</version>
<scope>provided</scope>
</dependency>
{{/jakarta}}
{{^jakarta}}
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
<scope>provided</scope>
</dependency>
{{/jakarta}}
{{/useBeanValidation}}
<!-- test dependencies -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ if(hasProperty('target') && target == 'android') {
}

dependencies {
provided 'jakarta.annotation:jakarta.annotation-api:{{#jakarta}}2.1.1{{/jakarta}}{{^jakarta}}1.3.5{{/jakarta}}'
{{#jakarta}}
provided 'jakarta.annotation:jakarta.annotation-api:2.1.1'
{{/jakarta}}
{{^jakarta}}
provided 'javax.annotation:jsr250-api:1.0'
{{/jakarta}}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,22 @@
{{/supportJava6}}
{{#useBeanValidation}}
<!-- Bean Validation API support -->
{{#jakarta}}
<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<version>{{#jakarta}}3.0.2{{/jakarta}}{{^jakarta}}2.0.2{{/jakarta}}</version>
<version>3.0.2</version>
<scope>provided</scope>
</dependency>
{{/jakarta}}
{{^jakarta}}
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
<scope>provided</scope>
</dependency>
{{/jakarta}}
{{/useBeanValidation}}
{{#performBeanValidation}}
<!-- Bean Validation Impl. used to perform BeanValidation -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ if(hasProperty('target') && target == 'android') {
}

dependencies {
provided 'jakarta.annotation:jakarta.annotation-api:{{#jakarta}}2.1.1{{/jakarta}}{{^jakarta}}1.3.5{{/jakarta}}'
{{#jakarta}}
provided 'jakarta.annotation:jakarta.annotation-api:2.1.1'
{{/jakarta}}
{{^jakarta}}
provided 'javax.annotation:jsr250-api:1.0'
{{/jakarta}}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ if(hasProperty('target') && target == 'android') {
}

dependencies {
provided 'jakarta.annotation:jakarta.annotation-api:{{#jakarta}}2.1.1{{/jakarta}}{{^jakarta}}1.3.5{{/jakarta}}'
{{#jakarta}}
provided 'jakarta.annotation:jakarta.annotation-api:2.1.1'
{{/jakarta}}
{{^jakarta}}
provided 'javax.annotation:jsr250-api:1.0'
{{/jakarta}}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ if(hasProperty('target') && target == 'android') {
}

dependencies {
provided 'jakarta.annotation:jakarta.annotation-api:{{#jakarta}}2.1.1{{/jakarta}}{{^jakarta}}1.3.5{{/jakarta}}'
{{#jakarta}}
provided 'jakarta.annotation:jakarta.annotation-api:2.1.1'
{{/jakarta}}
{{^jakarta}}
provided 'javax.annotation:jsr250-api:1.0'
{{/jakarta}}
}
}

Expand Down
12 changes: 11 additions & 1 deletion src/main/resources/handlebars/Java/pom.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -301,12 +301,22 @@
{{/supportJava6}}
{{#useBeanValidation}}
<!-- Bean Validation API support -->
{{#jakarta}}
<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<version>{{#jakarta}}3.0.2{{/jakarta}}{{^jakarta}}2.0.2{{/jakarta}}</version>
<version>3.0.2</version>
<scope>provided</scope>
</dependency>
{{/jakarta}}
{{^jakarta}}
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
<scope>provided</scope>
</dependency>
{{/jakarta}}
{{/useBeanValidation}}
{{#parcelableModel}}
<!-- Needed for Parcelable support-->
Expand Down
24 changes: 22 additions & 2 deletions src/main/resources/handlebars/JavaJaxRS/cxf-cdi/pom.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,22 @@
<dependencies>

<!-- https://mvnrepository.com/artifact/javax/javaee-api -->
{{#jakarta}}
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>{{#jakarta}}10.0.0{{/jakarta}}{{^jakarta}}8.0.0{{/jakarta}}</version>
<version>10.0.0</version>
<scope>provided</scope>
</dependency>
{{/jakarta}}
{{^jakarta}}
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
{{/jakarta}}

<!-- https://mvnrepository.com/artifact/org.apache.cxf/cxf-rt-frontend-jaxrs -->
<dependency>
Expand Down Expand Up @@ -88,12 +98,22 @@

{{#useBeanValidation}}
<!-- Bean Validation API support -->
{{#jakarta}}
<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<version>{{#jakarta}}3.0.2{{/jakarta}}{{^jakarta}}2.0.2{{/jakarta}}</version>
<version>3.0.2</version>
<scope>provided</scope>
</dependency>
{{/jakarta}}
{{^jakarta}}
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
<scope>provided</scope>
</dependency>
{{/jakarta}}
{{/useBeanValidation}}

</dependencies>
Expand Down
51 changes: 43 additions & 8 deletions src/main/resources/handlebars/JavaJaxRS/cxf/pom.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,22 @@
</configuration>
{{#useBeanValidation}}
<dependencies>
{{#jakarta}}
<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<version>${beanvalidation-version}</version>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<version>${beanvalidation-version}</version>
<scope>provided</scope>
</dependency>
{{/jakarta}}
{{^jakarta}}
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>${beanvalidation-version}</version>
<scope>provided</scope>
</dependency>
{{/jakarta}}
</dependencies>
{{/useBeanValidation}}
<executions>
Expand Down Expand Up @@ -127,12 +138,22 @@
</dependency>
{{#useBeanValidation}}
<!-- Bean Validation API support -->
{{#jakarta}}
<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<version>${beanvalidation-version}</version>
<scope>provided</scope>
</dependency>
{{/jakarta}}
{{^jakarta}}
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>${beanvalidation-version}</version>
<scope>provided</scope>
</dependency>
{{/jakarta}}
{{/useBeanValidation}}
<!-- CXF Client -->
<dependency>
Expand Down Expand Up @@ -194,21 +215,35 @@
<version>{{#jakarta}}8.0.0.Final{{/jakarta}}{{^jakarta}}5.2.2.Final{{/jakarta}}</version>
</dependency>
{{/useBeanValidationFeature}}
{{#jakarta}}
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>{{#jakarta}}4.0.0{{/jakarta}}{{^jakarta}}2.3.3{{/jakarta}}</version>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>{{#jakarta}}4.0.1{{/jakarta}}{{^jakarta}}2.3.7{{/jakarta}}</version>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>jakarta.activation</groupId>
<artifactId>jakarta.activation-api</artifactId>
<version>{{#jakarta}}2.1.0{{/jakarta}}{{^jakarta}}1.2.2{{/jakarta}}</version>
<version>2.1.0</version>
</dependency>
{{/jakarta}}
{{^jakarta}}
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.6</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
{{/jakarta}}
</dependencies>
<repositories>
<repository>
Expand All @@ -234,9 +269,9 @@
<logback-version>1.2.9</logback-version>
<servlet-api-version>2.5</servlet-api-version>
{{#useBeanValidation}}
<beanvalidation-version>{{#jakarta}}3.0.2{{/jakarta}}{{^jakarta}}2.0.2{{/jakarta}}</beanvalidation-version>
<beanvalidation-version>{{#jakarta}}3.0.2{{/jakarta}}{{^jakarta}}1.1.0.Final{{/jakarta}}</beanvalidation-version>
{{/useBeanValidation}}
<cxf-version>{{#jakarta}}4.0.0{{/jakarta}}{{^jakarta}}3.2.4.Final{{/jakarta}}</cxf-version>
<cxf-version>{{#jakarta}}4.0.0{{/jakarta}}{{^jakarta}}3.2.4{{/jakarta}}</cxf-version>
<jackson-jaxrs-version>2.9.1</jackson-jaxrs-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
Expand Down
Loading