Skip to content

Commit

Permalink
MJP-264 Merging all repos final work
Browse files Browse the repository at this point in the history
- usage of jaxb-maven-plugin in basics / annotate projects
- fixing build issues with jdk17 on basics / annotate projects
  • Loading branch information
Laurent SCHOELENS committed Jul 3, 2023
1 parent 487b98e commit 567d22a
Show file tree
Hide file tree
Showing 133 changed files with 1,202 additions and 2,088 deletions.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion maven-plugin/LICENSE → LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2006-2021, Alexey Valikov.
Copyright (c) 2006-2023, Alexey Valikov.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
153 changes: 131 additions & 22 deletions annotate/README.md → README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,126 @@
[![Maven Central](https://img.shields.io/maven-central/v/org.jvnet.jaxb2_commons/jaxb2-basics-annotate.svg)](https://github.com/highsource/jaxb2-annotate-plugin)
# JAXB Tools #
[![Maven Central](https://img.shields.io/maven-central/v/org.jvnet.jaxb/jaxb-maven-plugin.svg)](https://github.com/highsource/jaxb-tools)

jaxb2-annotate-plugin
=====================
Welcome to the JAXB Tools Project, the most advanced set of JAXB related tools featuring full Maven plugin for XML Schema compilation and a set of XJC plugins.
These tools are under [open source](https://github.com/highsource/jaxb2-tools/blob/master/LICENSE) license.

## JAXB Maven Plugin ##

JAXB Maven plugin `org.jvnet.jaxb:jaxb-maven-plugin`, the most advanced and feature-full Maven plugin for XML Schema compilation.

### Quick start ###

* Put your schemas (`*.xsd`) and bindings (`*.xjb`) into the `src/main/resources` folder.
* Add the plugin to your `pom.xml`:

```xml
<project ...>
...
<build>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb</groupId>
<artifactId>jaxb-maven-plugin</artifactId>
<version>2.0.0</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
...
</project>
```

#### JAXB Versions

The current version 2.X of this plugin supports only JAXB 2.3.

If you need an older JAXB version, you can use one of the following variants, which are no more supported :

* `org.jvnet.jaxb2.maven2:maven-jaxb20-plugin:0.15.2` - JAXB 2.0.
* `org.jvnet.jaxb2.maven2:maven-jaxb21-plugin:0.15.2` - JAXB 2.1.
* `org.jvnet.jaxb2.maven2:maven-jaxb22-plugin:0.15.1` - JAXB 2.2.

#### Java versions

Supported Java versions are `8`, and higher.

### [Documentation](https://github.com/highsource/jaxb-tools/wiki) ##

Please refer to the [wiki](https://github.com/highsource/jaxb-tools/wiki) for the full documentation.

* [User Guide](https://github.com/highsource/jaxb-tools/wiki/User-Guide)
* Maven Documentation (Work in progress)
* [Configuration Cheat Sheet](https://github.com/highsource/jaxb-tools/wiki/Configuration-Cheat-Sheet)
* [Common Pitfalls and Problems](https://github.com/highsource/jaxb-tools/wiki/Common-Pitfalls-and-Problems) (Work in progress)
* [Best Practices](https://github.com/highsource/jaxb-tools/wiki/Best-Practices) (Work in progress)
* [FAQ](https://github.com/highsource/jaxb-tools/wiki/FAQ)
* [Sample Projects](https://github.com/highsource/jaxb-tools/wiki/Sample-Projects)
* [Support](https://github.com/highsource/jaxb-tools/wiki/Support)
* [License](https://github.com/highsource/jaxb-tools/blob/master/LICENSE)
* [JAXB Eclipse Project](https://github.com/eclipse-ee4j/jaxb-ri)

### Related ###

This Maven plugin wraps and enhances the [JAXB](https://jaxb.java.net/) [Schema Compiler (XJC)](http://docs.oracle.com/javase/6/docs/technotes/tools/share/xjc.html) and allows
compiling XML Schemas (as well as WSDL, DTDs, RELAX NG) into Java classes in Maven builds.

> If you are interested in the Mojohaus JAXB2 Maven Plugin (`org.codehaus.mojo:jaxb2-maven-plugin`),
> please follow [this link](https://github.com/mojohaus/jaxb2-maven-plugin) to the corresponding website.
## JAXB2 Basics ##

JAXB2 Basics is a project which provides useful plugins and tools for [JAXB 2.x reference implementation](https://jaxb.java.net/).

### Documentation

Please refer to the [wiki](https://github.com/highsource/jaxb2-basics/wiki) for documentation - currently under migration to jaxb-tools repository.

JAXB2 Basics can only be used with JAXB/XJC 2.3.0 and higher. JAXB/XJC versions 2.2.x and earlier are no longer supported.

JAXB2 Basics can only be used with Java 1.8 and above.

### Using JAXB2 Basics

* [Using JAXB2 Basics Plugins](https://github.com/highsource/jaxb2-basics/wiki/Using-JAXB2-Basics-Plugins)

### JAXB2 Basics Plugins
* [SimpleEquals Plugin](https://github.com/highsource/jaxb2-basics/wiki/JAXB2-SimpleEquals-Plugin) - generates runtime-free reflection-free `equals(...)` methods.
* [SimpleHashCode Plugin](https://github.com/highsource/jaxb2-basics/wiki/JAXB2-SimpleHashCode-Plugin) - generates runtime-free reflection-free `hashCode()` methods.
* Equals Plugin - generates reflection-free strategic `equals(...)` method.
* HashCode Plugin - generates reflection-free strategic `hashCode()` method.
* ToString Plugin - generates reflection-free strategic `toString()` methods.
* Copyable Plugin - generates reflection-free strategic `copy(...)` deep copying.
* Mergeable Plugin - generates reflection-free strategic `merge(...)` methods to merge data from two source objects into the given object.
* Inheritance Plugin - makes schema-derived classes extend certain class or implement certain interfaces.
* Wildcard Plugin - allows you to specify the wildcard mode for the wildcard properties.
* AutoInheritance Plugin - makes classes derived from global elements or complex types extend or implement certain classes or interfaces automatically.
* [Setters Plugin](https://github.com/highsource/jaxb2-basics/wiki/JAXB2-Setters-Plugin) - generates setters for collections.
* [Simplify Plugin](https://github.com/highsource/jaxb2-basics/wiki/JAXB2-Simplify-Plugin) - simplifies weird properties like `aOrBOrC`.
* [EnumValue Plugin](https://github.com/highsource/jaxb2-basics/wiki/JAXB2-EnumValue-Plugin) - makes all the generated enums implement the `EnumValue<T>` interface.
* JAXBIndex Plugin - generated `jaxb.index` files listing schema-derived classes.
* [FixJAXB1058 Plugin](https://github.com/highsource/jaxb2-basics/wiki/JAXB2-FixJAXB1058-Plugin) - fixes [JAXB-1058](https://java.net/jira/browse/JAXB-1058).

### Credits ###

* Many thanks to **James Annesley** for his ideas and help with the [SimpleEquals Plugin](https://github.com/highsource/jaxb2-basics/wiki/JAXB2-SimpleEquals-Plugin) and the [SimpleHashCode Plugin](https://github.com/highsource/jaxb2-basics/wiki/JAXB2-SimpleHashCode-Plugin).

## JAXB Annotate Plugin ##
JAXB2 Annotate Plugin is capable of adding or removing arbitrary annotations to/from the generated sources.

Usage overview
--------------
### Usage overview

* Annotate your schema using binding files or directly in schema
* Add the plugin to the XJC classpath.
* Add your annotation classes to the XJC classpath.
* Activate the plugin using `-Xannotate`-switch.

Providing annotations
---------------------
### Providing annotations

You can annotate your schema-derived elements using normal Java annotation syntax.
([Old XML syntax](http://confluence.highsource.org/display/J2B/Annotate+Plugin) is still supported but no longer recommended.)
Expand All @@ -37,8 +143,6 @@ You can put your annotations directly in schema:
xmlns:annox="http://annox.dev.java.net"
jaxb:extensionBindingPrefixes="annox">



<xsd:complexType name="FooType">
<xsd:annotation>
<xsd:appinfo>
Expand Down Expand Up @@ -133,8 +237,7 @@ jaxb:extensionBindingPrefixes="xjc annox"
Note: yes, I know that `http://annox.dev.java.net` no longer exists. Changing this namespace would break old builds.
This is just a namespace, there must not necessarily be content there. Treat it as a logical identifier, nothing else.

Removing annotations
--------------
### Removing annotations

* Customize your schema using binding files or directly in schema
* Add the plugin to the XJC classpath.
Expand All @@ -150,8 +253,6 @@ You can remove annotations using customizations directly in schema:
xmlns:annox="http://annox.dev.java.net"
jaxb:extensionBindingPrefixes="annox">



<xsd:complexType name="FooType">
<xsd:annotation>
<xsd:appinfo>
Expand Down Expand Up @@ -227,9 +328,7 @@ jaxb:extensionBindingPrefixes="xjc annox"
Note: yes, I know that `http://annox.dev.java.net` no longer exists. Changing this namespace would break old builds.
This is just a namespace, there must not necessarily be content there. Treat it as a logical identifier, nothing else.


Using JAXB2 Annotate Plugin with Maven
--------------------------------------
### Using JAXB2 Annotate Plugin with Maven

* Add `org.jvnet.jaxb2_commons:jaxb2-basics-annotate` as XJC plugin
* Turn on the plugin using `-Xannotate` or `-XremoveAnnotation`switch
Expand All @@ -239,8 +338,8 @@ Example:

````xml
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<groupId>org.jvnet.jaxb</groupId>
<artifactId>jaxb-maven-plugin</artifactId>
<configuration>
<extension>true</extension>
<args>
Expand All @@ -261,10 +360,20 @@ Example:
</configuration>
</plugin>
````
See [this example](https://github.com/highsource/jaxb2-annotate-plugin/tree/master/tests/annox).
See [this example](https://github.com/highsource/jaxb-tools/tree/master/annotate/tests/annox).

Note that annotations are first compiled in the `annotations` module and the added to the classpath of the `maven-jaxb2-plugin` in the `schema` module:
Note that annotations are first compiled in the `annotations` module and the added to the classpath of the `jaxb-maven-plugin` in the `schema` module:

### Using JAXB2 Annotate Plugin with Ant

Using JAXB2 Annotate Plugin with Ant
------------------------------------
See [this example](https://github.com/highsource/jaxb2-annotate-plugin/blob/master/samples/annotate/project-build.xml).

## Disclaimer ##

This project is not developed, supported or in any other way affiliated with Apache. The `org.jvnet.jaxb:jaxb-maven-plugin` is not an Apache product (and does not pretend to be one), it is a completely independent development.

This project is also *not* developed by or affiliated with Oracle or Sun. Even if it is featured on [https://jaxb.java.net/](https://jaxb.java.net) pages,

**This plugin is in no way _official_ JAXB Maven plugin by Sun or Oracle.**

This is a completely indepentent development. [I](https://github.com/highsource) am *not* an Oracle employee.
26 changes: 0 additions & 26 deletions annotate/LICENSE

This file was deleted.

5 changes: 0 additions & 5 deletions annotate/full-build-9.bat

This file was deleted.

2 changes: 1 addition & 1 deletion annotate/plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<parent>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-annotate-plugin-project</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>2.0.3-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
Expand Down
Loading

0 comments on commit 567d22a

Please sign in to comment.