Skip to content

Commit

Permalink
Added a required runtime dependency to xjc
Browse files Browse the repository at this point in the history
  • Loading branch information
bjornvester committed Jun 16, 2023
1 parent 3763dc2 commit 69eb26f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ e.g. like this:

```kotlin
plugins {
id("com.github.bjornvester.xjc") version "1.7.0"
id("com.github.bjornvester.xjc") version "1.7.1"
}
```

Expand All @@ -49,7 +49,7 @@ Here is a list of all available properties:
| xjcVersion | Provider\<String> | "3.0.2" for jakarta / "2.3.8" for javax | The version of XJC to use. |
| defaultPackage | Provider\<String> | \[not set\] | The default package for the generated Java classes.<br>If empty, XJC will infer it from the namespace. |
| generateEpisode | Provider\<Boolean> | false | If true, generates an Episode file for the generated Java classes. |
| markGenerated | Provider\<Boolean> | true | If true, marks the generated code with the annotation `@javax.annotation.Generated`. |
| markGenerated | Provider\<Boolean> | false | If true, marks the generated code with the annotation `@javax.annotation.Generated`. |
| bindingFiles | FileCollection | \[empty\] | The binding files to use in the schema compiler |
| options | ListProperty\<String> | \[empty\] | Options to pass to either the XJC core, or to third party plugins in the `xjcPlugins` configuration |
| groups | NamedDomainObjectContainer | \[empty\] | Allows you to group a set of XSDs and generate sources with different configurations. Requires Gradle 7.0 or higher. See below for details. |
Expand Down Expand Up @@ -137,7 +137,7 @@ Note that while this annotation is found in the Java 8 SDK, it is not present in

### Generating episode files

XJC can generate an episode file, which is basically an extended binding file that specifies how the the schema types are associated with the generated Java
XJC can generate an episode file, which is basically an extended binding file that specifies how the schema types are associated with the generated Java
classes.

You can enable the generation using the generateEpisode property like this:
Expand All @@ -153,7 +153,7 @@ The file will be generated at META-INF/sun-jaxb.episode and added as a resource
### Consuming episode files

XJC can consume the episode files so that it is possible to compile java classes from a schema in one project, and consume it in XJC generators in other
projects so you don't have to compile the same schemas multiple times.
projects, so you don't have to compile the same schemas multiple times.
To do this, you need to add the jar file to the configuration named "xjcBindings".

For multi-projects, assuming the episode file is generated in a project called "test-producer", you can do this like this:
Expand Down
14 changes: 8 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

group = "com.github.bjornvester"
version = "1.7.0"
version = "1.7.1"

repositories {
mavenCentral()
Expand Down Expand Up @@ -45,11 +45,13 @@ gradlePlugin {
displayName = "Gradle XJC plugin"
tags.set(listOf("xjc", "jaxb", "xsd"))
description = """Changes:
|- Added support for the Gradle configuration cache.
|- It now defaults to XJC 3.x, generating source code using the jakarta namespace. This can be changed back to using javax with a configuration change.
|- Minor bump of default versions.
|- Added configurations "useJakarta" and "addCompilationDependencies".
|- Minimum required of version of Gradle is now 6.7 (up from 6.0).""".trimMargin()
|- Fixed a problem with a missing runtime dependency.
|Changelog from 1.7.0:
| - Added support for the Gradle configuration cache.
| - It now defaults to XJC 3.x, generating source code using the jakarta namespace. This can be changed back to using javax with a configuration change.
| - Minor bump of default versions.
| - Added configurations "useJakarta" and "addCompilationDependencies".
| - Minimum required of version of Gradle is now 6.7 (up from 6.0).""".trimMargin()
}
}
}
1 change: 1 addition & 0 deletions src/main/kotlin/com/github/bjornvester/xjc/XjcPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class XjcPlugin : Plugin<Project> {

xjcConfiguration.defaultDependencies {
addLater(extension.xjcVersion.map { project.dependencies.create("org.glassfish.jaxb:jaxb-xjc:$it") })
addLater(extension.xjcVersion.map { project.dependencies.create("org.glassfish.jaxb:jaxb-runtime:$it") })
}

project.configurations.named(JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME) {
Expand Down

0 comments on commit 69eb26f

Please sign in to comment.