Commit c0432a84 authored by Emmanuel Bourg's avatar Emmanuel Bourg

New upstream version 0.14.0

parent 4d722561
......@@ -4,4 +4,5 @@
/std
**/.classpath
**/.project
**/.settings
\ No newline at end of file
**/.settings
target
\ No newline at end of file
......@@ -22,7 +22,7 @@ compiling XML Schemas (as well as WSDL, DTDs, RELAX NG) into Java classes in Mav
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.13.1</version>
<version>0.14.0</version>
<executions>
<execution>
<goals>
......@@ -38,6 +38,22 @@ compiling XML Schemas (as well as WSDL, DTDs, RELAX NG) into Java classes in Mav
</project>
```
### JAXB Versions
If you need a specific JAXB version, you can explicitly use one of the following variants:
* `org.jvnet.jaxb2.maven2:maven-jaxb20-plugin` - JAXB 2.0.
* `org.jvnet.jaxb2.maven2:maven-jaxb21-plugin` - JAXB 2.1.
* `org.jvnet.jaxb2.maven2:maven-jaxb22-plugin` - JAXB 2.2.
* `org.jvnet.jaxb2.maven2:maven-jaxb23-plugin` - JAXB 2.3.
* `org.jvnet.jaxb2.maven2:maven-jaxb2-plugin` - "most actual version", at the moment same as `org.jvnet.jaxb2.maven2:maven-jaxb23-plugin`.
### Java versions
Supported Java versions are `1.7`, `1.8`, `9` (only `maven-jaxb2-plugin` and `maven-jaxb23-plugin`).
Java version `1.6` is no longer supported (since version `0.14.0`).
## [Documentation](https://github.com/highsource/maven-jaxb2-plugin/wiki) ##
Please refer to the [wiki](https://github.com/highsource/maven-jaxb2-plugin/wiki) for the full documentation.
......@@ -60,6 +76,6 @@ This project is not developed, supported or in any other way affiliated with Apa
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_ JAXB2 Maven plugin by Oracle.**
**This plugin is in no way _official_ JAXB2 Maven plugin by Sun or Oracle.**
This is a completely indepentent development. [I](https://github.com/highsource) am *not* an Oracle employee.
This is a completely indepentent development. [I](https://github.com/highsource) am *not* an Oracle employee.
\ No newline at end of file
setlocal
set JAVA_HOME=%JAVA5_HOME%
call mvn -X clean install >std 2>err
endlocal
\ No newline at end of file
setlocal
set JAVA_HOME=%JAVA6_HOME%
call mvn -X clean install >std 2>err
endlocal
\ No newline at end of file
setlocal
set JAVA_HOME=%JAVA5_HOME%
call mvn -X -P samples,templates clean install >std 2>err
endlocal
\ No newline at end of file
setlocal
set JAVA_HOME=%JAVA6_HOME%
call mvn -DperformRelease -Psonatype-oss-release clean deploy
endlocal
\ No newline at end of file
setlocal
set JAVA_HOME=%JAVA5_HOME%
call mvn -X clean install >std 2>err
call mvn -X -DprepareRelease -DcontinuousIntegrationDeploy clean deploy &>std 2&>err
endlocal
\ No newline at end of file
......@@ -9,7 +9,7 @@
<parent>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin-project</artifactId>
<version>0.13.3</version>
<version>0.14.0</version>
</parent>
<dependencies>
<dependency>
......
setlocal
echo Setting JAVA_HOME to %JAVA6_HOME%.
set JAVA_HOME=%JAVA6_HOME%
call mvn clean install -Pall -DperformRelease
endlocal
\ No newline at end of file
setlocal
echo Setting JAVA_HOME to %JAVA7_HOME%.
set JAVA_HOME=%JAVA7_HOME%
call mvn clean install -Pall -DperformRelease
call mvn clean install -Pall,sonatype-oss-release -DperformRelease
endlocal
\ No newline at end of file
setlocal
echo Setting JAVA_HOME to %JAVA8_HOME%.
set JAVA_HOME=%JAVA8_HOME%
call mvn clean install -Pall -DperformRelease
call mvn clean install -Pall,sonatype-oss-release -DperformRelease
endlocal
\ No newline at end of file
setlocal
echo Setting JAVA_HOME to %JAVA9_HOME%.
set JAVA_HOME=%JAVA9_HOME%
call mvn clean install -Pall,sonatype-oss-release -DperformRelease
endlocal
\ No newline at end of file
setlocal
set JAVA_HOME=%JAVA5_HOME%
call mvn -X -Dsamples,templates,tests clean install >std 2>err
endlocal
\ No newline at end of file
setlocal
set JAVA_HOME=%JAVA6_HOME%
call mvn -DperformRelease -Psonatype-oss-release,samples,tests clean install
endlocal
\ No newline at end of file
......@@ -6,7 +6,7 @@
<parent>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin-project</artifactId>
<version>0.13.3</version>
<version>0.14.0</version>
</parent>
<prerequisites>
<maven>${maven.version}</maven>
......@@ -30,6 +30,10 @@
<artifactId>jaxb-xjc</artifactId>
<version>${jaxb20.version}</version>
</dependency>
<dependency>
<groupId>com.sun.activation</groupId>
<artifactId>javax.activation</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
......@@ -43,10 +47,16 @@
<build>
<plugins>
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
......@@ -62,6 +62,9 @@ public class OptionsFactory implements
System.setProperty("javax.xml.accessExternalDTD",
optionsConfiguration.getAccessExternalDTD());
}
if (optionsConfiguration.isEnableExternalEntityProcessing()) {
System.setProperty("enableExternalEntityProcessing", Boolean.TRUE.toString());
}
// options.contentForWildcard =
// optionsConfiguration.isContentForWildcard()
......
......@@ -6,7 +6,7 @@
<parent>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin-project</artifactId>
<version>0.13.3</version>
<version>0.14.0</version>
</parent>
<prerequisites>
<maven>${maven.version}</maven>
......@@ -42,6 +42,10 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.sun.activation</groupId>
<artifactId>javax.activation</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
......@@ -55,10 +59,16 @@
<build>
<plugins>
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
......@@ -65,6 +65,9 @@ public class OptionsFactory implements
System.setProperty("javax.xml.accessExternalDTD",
optionsConfiguration.getAccessExternalDTD());
}
if (optionsConfiguration.isEnableExternalEntityProcessing()) {
System.setProperty("enableExternalEntityProcessing", Boolean.TRUE.toString());
}
options.contentForWildcard = optionsConfiguration
.isContentForWildcard();
......
......@@ -6,7 +6,7 @@
<parent>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin-project</artifactId>
<version>0.13.3</version>
<version>0.14.0</version>
</parent>
<prerequisites>
<maven>${maven.version}</maven>
......@@ -23,19 +23,23 @@
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>${jaxb22.version}</version>
</dependency>
<!-- Start of jaxb-runtime dependencies -->
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-core</artifactId>
<version>${jaxb22.version}</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>${jaxb22.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>txw2</artifactId>
<version>${jaxb22.version}</version>
</dependency>
<dependency>
<groupId>com.sun.istack</groupId>
......@@ -49,11 +53,15 @@
<groupId>com.sun.xml.fastinfoset</groupId>
<artifactId>FastInfoset</artifactId>
</dependency>
<dependency>
<groupId>com.sun.activation</groupId>
<artifactId>javax.activation</artifactId>
</dependency>
<!-- End of jaxb-runtime dependencies -->
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-xjc</artifactId>
<version>${jaxb22.version}</version>
</dependency>
<!-- Start jaxb-xjc dependencies -->
<dependency>
......@@ -91,10 +99,16 @@
<build>
<plugins>
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
......@@ -73,6 +73,9 @@ public class OptionsFactory implements
System.setProperty("javax.xml.accessExternalDTD",
optionsConfiguration.getAccessExternalDTD());
}
if (optionsConfiguration.isEnableExternalEntityProcessing()) {
System.setProperty("enableExternalEntityProcessing", Boolean.TRUE.toString());
}
options.contentForWildcard = optionsConfiguration
.isContentForWildcard();
......@@ -122,10 +125,6 @@ public class OptionsFactory implements
return Language.XMLSCHEMA;
else if ("DTD".equalsIgnoreCase(schemaLanguage))
return Language.DTD;
else if ("RELAXNG".equalsIgnoreCase(schemaLanguage))
return Language.RELAXNG;
else if ("RELAXNG_COMPACT".equalsIgnoreCase(schemaLanguage))
return Language.RELAXNG_COMPACT;
else if ("WSDL".equalsIgnoreCase(schemaLanguage))
return Language.WSDL;
else {
......
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>maven-jaxb23-plugin</artifactId>
<packaging>maven-plugin</packaging>
<name>Maven JAXB 2.3.x Plugin</name>
<parent>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin-project</artifactId>
<version>0.14.0</version>
</parent>
<prerequisites>
<maven>${maven.version}</maven>
</prerequisites>
<dependencies>
<dependency>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin-core</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-xjc-jdk9</artifactId>
</dependency>
<dependency>
<groupId>com.sun.activation</groupId>
<artifactId>javax.activation</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-testing</groupId>
<artifactId>maven-plugin-testing-harness</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>${project.build.directory}/generated-resources/jaxb-xjc-runtime</directory>
<filtering>false</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-xjc</artifactId>
<version>${jaxb23.version}</version>
<classifier>sources</classifier>
<type>jar</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/generated-resources/jaxb-xjc-runtime</outputDirectory>
<includes>com/sun/tools/xjc/runtime/*.java</includes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
/**
*
*/
package org.jvnet.mjiip.v_2_3;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.io.Writer;
import org.apache.maven.plugin.logging.Log;
import com.sun.codemodel.CodeWriter;
import com.sun.codemodel.JPackage;
import com.sun.codemodel.writer.FilterCodeWriter;
public class LoggingCodeWriter extends FilterCodeWriter {
private final boolean verbose;
private final Log log;
public LoggingCodeWriter(CodeWriter output, Log log, boolean verbose) {
super(output);
this.log = log;
this.verbose = verbose;
}
public Writer openSource(JPackage pkg, String fileName) throws IOException {
if (verbose) {
if (pkg.isUnnamed())
log.info("XJC writing: " + fileName);
else
log.info("XJC writing: "
+ pkg.name().replace('.', File.separatorChar)
+ File.separatorChar + fileName);
}
return core.openSource(pkg, fileName);
}
public OutputStream openBinary(JPackage pkg, String fileName)
throws IOException {
if (verbose) {
if (pkg.isUnnamed())
log.info("XJC writing: " + fileName);
else
log.info("XJC writing: "
+ pkg.name().replace('.', File.separatorChar)
+ File.separatorChar + fileName);
}
return core.openBinary(pkg, fileName);
}
@Override
public void close() throws IOException {
core.close();
}
}
\ No newline at end of file
/**
*
*/
package org.jvnet.mjiip.v_2_3;
import org.apache.maven.plugin.logging.Log;
import org.xml.sax.SAXParseException;
import com.sun.tools.xjc.ErrorReceiver;
public class LoggingErrorReceiver extends ErrorReceiver {
private final Log log;
private final boolean verbose;
private final String messagePrefix;
public LoggingErrorReceiver(String messagePrefix, Log log, boolean verbose) {
this.log = log;
this.verbose = verbose;
this.messagePrefix = messagePrefix;
}
public void warning(SAXParseException saxex) {
log.warn(getMessage(saxex), saxex);
}
public void error(SAXParseException saxex) {
log.error(getMessage(saxex), saxex);
}
public void fatalError(SAXParseException saxex) {
log.error(getMessage(saxex), saxex);
}
public void info(SAXParseException saxex) {
if (verbose)
log.info(getMessage(saxex));
}
private String getMessage(SAXParseException ex) {
final int row = ex.getLineNumber();
final int col = ex.getColumnNumber();
final String sys = ex.getSystemId();
final String pub = ex.getPublicId();
return messagePrefix + "Location [" + (sys != null ? " " + sys : "")
+ (pub != null ? " " + pub : "")
+ (row > 0 ? "{" + row + (col > 0 ? "," + col : "") + "}" : "")
+ "].";
}
}
\ No newline at end of file
package org.jvnet.mjiip.v_2_3;
import java.nio.charset.Charset;
import java.nio.charset.IllegalCharsetNameException;
import java.text.MessageFormat;
import java.util.List;
import org.apache.maven.plugin.MojoExecutionException;
import org.jvnet.jaxb2.maven2.OptionsConfiguration;
import org.jvnet.jaxb2.maven2.util.StringUtils;
import org.xml.sax.InputSource;
import com.sun.tools.xjc.BadCommandLineException;
import com.sun.tools.xjc.Language;
import com.sun.tools.xjc.Options;
import com.sun.tools.xjc.api.SpecVersion;
public class OptionsFactory implements
org.jvnet.jaxb2.maven2.OptionsFactory<Options> {
/**
* Creates and initializes an instance of XJC options.
*
*/
public Options createOptions(OptionsConfiguration optionsConfiguration)
throws MojoExecutionException {
final Options options = new Options();
options.verbose = optionsConfiguration.isVerbose();
options.debugMode = optionsConfiguration.isDebugMode();
options.classpaths.addAll(optionsConfiguration.getPlugins());
options.target = SpecVersion.V2_2;
final String encoding = optionsConfiguration.getEncoding();
if (encoding != null) {
options.encoding = createEncoding(encoding);
}
options.setSchemaLanguage(createLanguage(optionsConfiguration
.getSchemaLanguage()));
options.entityResolver = optionsConfiguration.getEntityResolver();
for (InputSource grammar : optionsConfiguration.getGrammars()) {
options.addGrammar(grammar);
}
for (InputSource bindFile : optionsConfiguration.getBindFiles()) {
options.addBindFile(bindFile);
}
// Setup Other Options
options.defaultPackage = optionsConfiguration.getGeneratePackage();
options.targetDir = optionsConfiguration.getGenerateDirectory();
options.strictCheck = optionsConfiguration.isStrict();
options.readOnly = optionsConfiguration.isReadOnly();
options.packageLevelAnnotations = optionsConfiguration
.isPackageLevelAnnotations();
options.noFileHeader = optionsConfiguration.isNoFileHeader();
options.enableIntrospection = optionsConfiguration
.isEnableIntrospection();
options.disableXmlSecurity = optionsConfiguration
.isDisableXmlSecurity();
if (optionsConfiguration.getAccessExternalSchema() != null) {
System.setProperty("javax.xml.accessExternalSchema",
optionsConfiguration.getAccessExternalSchema());
}
if (optionsConfiguration.getAccessExternalDTD() != null) {
System.setProperty("javax.xml.accessExternalDTD",
optionsConfiguration.getAccessExternalDTD());
}
if (optionsConfiguration.isEnableExternalEntityProcessing()) {
System.setProperty("enableExternalEntityProcessing", Boolean.TRUE.toString());
}
options.contentForWildcard = optionsConfiguration
.isContentForWildcard();
if (optionsConfiguration.isExtension()) {
options.compatibilityMode = Options.EXTENSION;
}
final List<String> arguments = optionsConfiguration.getArguments();
try {
options.parseArguments(arguments.toArray(new String[arguments
.size()]));
}
catch (BadCommandLineException bclex) {
throw new MojoExecutionException("Error parsing the command line ["
+ arguments + "]", bclex);
}
return options;
}
private String createEncoding(String encoding)
throws MojoExecutionException {
if (encoding == null) {
return null;
}
try {
if (!Charset.isSupported(encoding)) {
throw new MojoExecutionException(MessageFormat.format(
"Unsupported encoding [{0}].", encoding));
}
return encoding;
} catch (IllegalCharsetNameException icne) {
throw new MojoExecutionException(MessageFormat.format(
"Unsupported encoding [{0}].", encoding));
}
}
private Language createLanguage(String schemaLanguage)
throws MojoExecutionException {
if (StringUtils.isEmpty(schemaLanguage)) {
return null;
} else if ("AUTODETECT".equalsIgnoreCase(schemaLanguage))
return null; // nothing, it is AUTDETECT by default.
else if ("XMLSCHEMA".equalsIgnoreCase(schemaLanguage))
return Language.XMLSCHEMA;
else if ("DTD".equalsIgnoreCase(schemaLanguage))
return Language.DTD;
else if ("WSDL".equalsIgnoreCase(schemaLanguage))
return Language.WSDL;
else {
throw new MojoExecutionException("Unknown schemaLanguage ["
+ schemaLanguage + "].");
}
}
}
package org.jvnet.mjiip.v_2_3;
import java.io.File;
import java.io.IOException;
import java.text.MessageFormat;
import java.util.Iterator;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.ResolutionScope;
import org.jvnet.jaxb2.maven2.RawXJC2Mojo;
import com.sun.codemodel.CodeWriter;
import com.sun.codemodel.JCodeModel;
import com.sun.codemodel.JDefinedClass;
import com.sun.codemodel.JPackage;
import com.sun.tools.xjc.ModelLoader;
import com.sun.tools.xjc.Options;
import com.sun.tools.xjc.model.Model;
import com.sun.tools.xjc.outline.Outline;
/**
* JAXB 2.x Mojo.
*
* @author Aleksei Valikov (valikov@gmx.net)
*/
@Mojo(name =