jaxb2-annotate-plugin not working
java, jaxb, jaxb2-annotate-plugin, maven-plugin
Solution
I think the plugin is not activated. You're using `jaxb2-maven-plugin` and the use `configuration/plugins/plugin` to configure the `jaxb2-annotate-plugin`. The problem is, `plugins/plugin` is the configuration option of my `maven-jaxb2-plugin`, not the Codehaus `jaxb2-maven-plugin`.
Try to switch to `maven-jaxb2-plugin` or figure out how JAXB2 plugins are activated in `jaxb2-maven-plugin`.
Also use the newer version. You're trying to use the Java syntax, which is a quite recent development. Please use the actual version of the `jaxb2-annotate-plugin` (the current is 1.0.1).
Here's one of the test projects for the reference:
- https://github.com/highsource/jaxb2-annotate-plugin/tree/master/tests/issues
Your customizations look fine, any of the three should work.
Disclaimer: I'm the author of `jaxb2-annotate-plugin` and `maven-jaxb2-plugin`.
Problem
I want to generate "@java.lang.SuppressWarnings("all")" before the generated "Doc" class. Problem: jaxb2-annotate-plugin don't generate annotations. My pom.xml: ``` ... <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>jaxb2-maven-plugin</artifactId> <version>1.5</version> <executions> <execution> <id>xjc</id> <goals> <goal>xjc</goal> </goals> <configuration> <extension>true</extension> <arguments>-Xannotate</arguments> <args> <arg>-Xannotate</arg> </args> <plugins> <plugin> <groupId>org.jvnet.jaxb2_commons</groupId> <artifactId>jaxb2-basics-annotate</artifactId> </plugin> <plugin> <groupId>org.jvnet.jaxb2_commons</groupId> <artifactId>jaxb2-annotate-plugin-test-annox-annotations</artifactId> </plugin> </plugins> </configuration> </execution> </executions> <dependencies> <dependency> <groupId>org.jvnet.jaxb2_commons</groupId> <artifactId>jaxb2-basics-annotate</artifactId> <version>0.6.4</version> </dependency> <dependency> <groupId>com.sun.codemodel</groupId> <artifactId>codemodel</artifactId> <version>2.6</version> </dependency> </dependencies> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> </dependency> <dependency> <groupId>org.jvnet.jaxb2_commons</groupId> <artifactId>jaxb2-basics-annotate</artifactId> <version>0.6.4</version> </dependency> <dependency> <groupId>com.sun.codemodel</groupId> <artifactId>codemodel</artifactId> <version>2.6</version> </dependency> <dependency> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> <version>${jaxb-api.version}</version> </dependency> <dependency> <groupId>com.sun.xml.bind</groupId> <artifactId>jaxb-impl</artifactId> <version>${jaxb.version}</version> </dependency> <dependency> <groupId>com.sun.xml.bind</groupId> <artifactId>jaxb-xjc</artifactId> <version>${jaxb.version}</version> </dependency> </dependencies> <properties> <jaxb.version>2.2.5-2</jaxb.version> <jaxb-api.version>2.1</jaxb-api.version> </properties> ``` My XSD: ``` <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="..." targetNamespace="..." elementFormDefault="qualified" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:annox="http://annox.dev.java.net" jaxb:version="2.1" jaxb:extensionBindingPrefixes="annox"> <xs:element name="Doc"> <xs:complexType> <xs:annotation> <xs:appinfo> <annox:annotate>@java.lang.SuppressWarnings("all")</annox:annotate> <annox:annotateClass>@java.lang.SuppressWarnings("all") </annox:annotateClass> <annox:annotate target="class">@java.lang.SuppressWarnings("all") </annox:annotate> </xs:appinfo> </xs:annotation> <xs:sequence> <xs:element ref="info" /> </xs:sequence> </xs:complexType> </xs:element> ``` I tryed all of the three ways to generate "@java.lang.SuppressWarnings("all")" before Doc class