Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

V016 #8

Merged
merged 26 commits into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
f813145
Replaced evolved binary group
phax Jan 8, 2023
f4006ac
[maven-release-plugin] prepare release jaxb-maven-plugin-project-0.16.0
phax Jan 8, 2023
1d59e2e
[maven-release-plugin] prepare for next development iteration
phax Jan 8, 2023
7ccdf65
[maven-release-plugin] rollback the release of jaxb-maven-plugin-proj…
phax Jan 8, 2023
144c1d0
[maven-release-plugin] prepare release jaxb-maven-plugin-project-0.16.0
phax Jan 8, 2023
d0c443a
[maven-release-plugin] prepare for next development iteration
phax Jan 8, 2023
c9db180
Reverted to 0.16.0-SNAPSHOT
phax Jan 8, 2023
8f5664b
SLF4J 2.x
phax Jan 8, 2023
1a9b308
[maven-release-plugin] prepare release jaxb-maven-plugin-project-0.16.0
phax Jan 8, 2023
c1338fe
[maven-release-plugin] prepare for next development iteration
phax Jan 8, 2023
dca8298
Next try
phax Jan 8, 2023
c975ea0
Using parent pom
phax Jan 8, 2023
f203603
[maven-release-plugin] prepare release jaxb-maven-plugin-project-0.16.0
phax Jan 8, 2023
3ac0ae4
[maven-release-plugin] prepare for next development iteration
phax Jan 8, 2023
e94f0e5
Added detection of 3.0/4.0 API
phax Jan 8, 2023
a63acb5
Improved debug logging
phax Jan 8, 2023
0514dee
Trying to fix a resource resolution error
phax Jan 9, 2023
61cef47
Moved back
phax Jan 9, 2023
fcf435b
Continued internal catalog resolver
phax Jan 9, 2023
c7ff2b6
Ctd
phax Jan 9, 2023
7fe0fa2
optimized
phax Jan 9, 2023
f059eaa
Ctd
phax Jan 9, 2023
a3c8b51
[maven-release-plugin] prepare release jaxb-maven-plugin-project-0.16.1
phax Jan 9, 2023
36bbc4f
[maven-release-plugin] prepare for next development iteration
phax Jan 9, 2023
c5d05fa
Updated docs
phax Jan 9, 2023
178d370
Ignore warning
phax Jan 9, 2023
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
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# JAXB Maven Plugin (jvnet)

[![CI](https://github.com/evolvedbinary/maven-jaxb2-plugin/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/evolvedbinary/jvnet-jaxb-maven-plugin/actions/workflows/ci.yml)
[![Maven Central](https://img.shields.io/maven-central/v/com.evolvedbinary.maven.jvnet/jaxb-maven-plugin-project.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.evolvedbinary.maven.jvnet%22%20AND%20a:%22jaxb-maven-plugin-project%22)
[![Maven Central](https://img.shields.io/maven-central/v/com.helger.maven/jaxb-maven-plugin-project.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.helger.maven%22%20AND%20a:%22jaxb-maven-plugin-project%22)
[![License](https://img.shields.io/badge/license-BSD%202-blue.svg)](https://opensource.org/licenses/BSD-2-Clause)

* **Supports JAXB 2, JAXB 3 and JAXB 4.**
Expand Down Expand Up @@ -47,7 +47,7 @@ compiling XML Schemas (as well as WSDL, DTDs, RELAX NG) into Java classes in Mav
<plugins>
...
<plugin>
<groupId>com.evolvedbinary.maven.jvnet</groupId>
<groupId>com.helger.maven</groupId>
<artifactId>jaxb40-maven-plugin</artifactId>
<version>0.16.0</version>
<executions>
Expand Down Expand Up @@ -75,11 +75,11 @@ Use: `<artifactId>jaxb2-maven-plugin</artifactId>` instead.

If you need a specific JAXB version, you can explicitly use one of the following variants:

* `com.evolvedbinary.maven.jvnet:jaxb40-maven-plugin` - JAXB 4.0.
* `com.evolvedbinary.maven.jvnet:jaxb30-maven-plugin` - JAXB 3.0.
* `com.evolvedbinary.maven.jvnet:jaxb23-maven-plugin` - JAXB 2.3.
* `com.evolvedbinary.maven.jvnet:jaxb22-maven-plugin` - JAXB 2.2.
* `com.evolvedbinary.maven.jvnet:jaxb2-maven-plugin` - "latest 2.x version"; at the moment this is same as `com.evolvedbinary.maven.jvnet:jaxb23-maven-plugin`.
* `com.helger.maven:jaxb40-maven-plugin` - JAXB 4.0.
* `com.helger.maven:jaxb30-maven-plugin` - JAXB 3.0.
* `com.helger.maven:jaxb23-maven-plugin` - JAXB 2.3.
* `com.helger.maven:jaxb22-maven-plugin` - JAXB 2.2.
* `com.helger.maven:jaxb2-maven-plugin` - "latest 2.x version"; at the moment this is same as `com.helger.maven:jaxb23-maven-plugin`.

### Java versions

Expand Down
2 changes: 1 addition & 1 deletion dist/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.evolvedbinary.maven.jvnet</groupId>
<groupId>com.helger.maven</groupId>
<artifactId>jaxb-maven-plugin-project</artifactId>
<version>0.16.0-SNAPSHOT</version>
</parent>
Expand Down
4 changes: 2 additions & 2 deletions plugin-2.2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.evolvedbinary.maven.jvnet</groupId>
<groupId>com.helger.maven</groupId>
<artifactId>jaxb-maven-plugin-project</artifactId>
<version>0.16.0-SNAPSHOT</version>
<version>0.16.2-SNAPSHOT</version>
</parent>

<artifactId>jaxb22-maven-plugin</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions plugin-2.3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.evolvedbinary.maven.jvnet</groupId>
<groupId>com.helger.maven</groupId>
<artifactId>jaxb-maven-plugin-project</artifactId>
<version>0.16.0-SNAPSHOT</version>
<version>0.16.2-SNAPSHOT</version>
</parent>

<artifactId>jaxb23-maven-plugin</artifactId>
Expand Down
6 changes: 3 additions & 3 deletions plugin-3.0/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.evolvedbinary.maven.jvnet</groupId>
<groupId>com.helger.maven</groupId>
<artifactId>jaxb-maven-plugin-project</artifactId>
<version>0.16.0-SNAPSHOT</version>
<version>0.16.2-SNAPSHOT</version>
</parent>

<artifactId>jaxb30-maven-plugin</artifactId>
Expand Down Expand Up @@ -40,7 +40,7 @@
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>txw2</artifactId>
<version>${jaxb30.version}</version>
<version>${jaxb30.version}</version><!--$NO-MVN-MAN-VER$-->
</dependency>

<dependency>
Expand Down
16 changes: 9 additions & 7 deletions plugin-3.0/src/main/java/org/jvnet/mjiip/v_3_0/XJC30Mojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
* @author Aleksei Valikov (valikov@gmx.net)
*/
@Mojo (name = "generate",
defaultPhase = LifecyclePhase.GENERATE_SOURCES,
requiresDependencyResolution = ResolutionScope.COMPILE,
threadSafe = true)
defaultPhase = LifecyclePhase.GENERATE_SOURCES,
requiresDependencyResolution = ResolutionScope.COMPILE,
threadSafe = true)
public class XJC30Mojo extends RawXJC3Mojo<Options>
{

Expand All @@ -53,12 +53,11 @@ public void doExecute (final Options options) throws MojoExecutionException
final Model model = loadModel (options);
final Outline outline = generateCode (model);
writeCode (outline);

}

protected Model loadModel (final Options options) throws MojoExecutionException
{
if (getVerbose ())
if (getLog ().isDebugEnabled ())
{
final InputSource [] aGrammars = options.getGrammars ();
getLog ().debug ("Parsing " + aGrammars.length + " input schema(s)...");
Expand All @@ -83,11 +82,14 @@ protected Model loadModel (final Options options) throws MojoExecutionException
{
// Fake check
final InputSource [] schemas = options.getGrammars ();
getLog ().debug ("Starting SchemaConstraintChecker");
if (getLog ().isDebugEnabled ())
getLog ().debug ("Starting SchemaConstraintChecker");

if (!SchemaConstraintChecker.check (schemas, er, getEntityResolver (), false))
getLog ().error ("SchemaConstraintChecker failed");
else
getLog ().debug ("SchemaConstraintChecker finished successfully");
if (getLog ().isDebugEnabled ())
getLog ().debug ("SchemaConstraintChecker finished successfully");
}

final Model model = ModelLoader.load (options, new JCodeModel (), er);
Expand Down
6 changes: 3 additions & 3 deletions plugin-4.0/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.evolvedbinary.maven.jvnet</groupId>
<groupId>com.helger.maven</groupId>
<artifactId>jaxb-maven-plugin-project</artifactId>
<version>0.16.0-SNAPSHOT</version>
<version>0.16.2-SNAPSHOT</version>
</parent>

<artifactId>jaxb40-maven-plugin</artifactId>
Expand Down Expand Up @@ -36,7 +36,7 @@
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>txw2</artifactId>
<version>${jaxb40.version}</version>
<version>${jaxb40.version}</version><!--$NO-MVN-MAN-VER$-->
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
Expand Down
91 changes: 91 additions & 0 deletions plugin-4.0/src/test/java/org/jvnet/mjiip/v_4_0/MainDummyTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
package org.jvnet.mjiip.v_4_0;

import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;

import org.apache.maven.plugin.logging.Log;
import org.apache.maven.plugin.logging.SystemStreamLog;
import org.jvnet.jaxb2.maven2.IDependencyResourceResolver;
import org.jvnet.jaxb2.maven2.resolver.CatalogManager;
import org.jvnet.jaxb2.maven2.resolver.tools.MavenCatalogResolver;
import org.jvnet.jaxb2.maven2.resolver.tools.ReResolvingEntityResolverWrapper;

import com.sun.codemodel.JCodeModel;
import com.sun.tools.xjc.Language;
import com.sun.tools.xjc.ModelLoader;
import com.sun.tools.xjc.Options;
import com.sun.tools.xjc.model.Model;

public class MainDummyTest
{
public static void main (final String [] args) throws Exception
{
final Log log = new SystemStreamLog ()
{
@Override
public boolean isDebugEnabled ()
{
return true;
}
};

final LoggingErrorReceiver er = new LoggingErrorReceiver ("Error while parsing schema(s).", log, true);
final Options options = new Options ();
options.setSchemaLanguage (Language.XMLSCHEMA);
options.strictCheck = false;
options.compatibilityMode = Options.EXTENSION;
final MavenCatalogResolver catalogResolver;
{
final CatalogManager catalogManager = new CatalogManager ();
catalogManager.setIgnoreMissingProperties (true);
catalogManager.setUseStaticCatalog (false);
catalogManager.setVerbosity (Integer.MAX_VALUE);
final IDependencyResourceResolver dependencyResourceResolver = dependencyResource -> {
if (false)
System.err.println ("TODO " + dependencyResource);
try
{
final String sVersion = dependencyResource.getVersion () != null ? dependencyResource.getVersion ()
: dependencyResource.getArtifactId ()
.startsWith ("ph-xsds-") ? "3.0.0"
: "6.7.1-SNAPSHOT";
final String sUrl = "jar:file:/C:/Users/phili/.m2/repository/" +
dependencyResource.getGroupId ().replace ('.', '/') +
"/" +
dependencyResource.getArtifactId () +
"/" +
sVersion +
"/" +
dependencyResource.getArtifactId () +
"-" +
sVersion +
".jar!/" +
dependencyResource.getResource ();
System.err.println ("Resolved to " + sUrl);
return new URL (sUrl);
}
catch (final MalformedURLException ex)
{
throw new IllegalStateException ("Invalid URL", ex);
}
};
catalogResolver = new MavenCatalogResolver (catalogManager, dependencyResourceResolver, log);
options.entityResolver = new ReResolvingEntityResolverWrapper (catalogResolver, log);
}

// Parse catalog
final File fCat = new File ("C:\\dev\\git\\ph-ubl\\ph-ubltr\\src\\main\\jaxb\\catalog-ubltr.txt");
catalogResolver.getCatalog ().parseCatalog (fCat.toURI ().toURL ());

// Don't add catalog

// After the rest
final String sPath = "C:\\dev\\git\\ph-ubl\\ph-ubltr\\src\\main\\resources\\schemas\\ubltr";
options.addGrammar (new File (sPath, "Envelope/Package_1_2.xsd"));
options.addGrammar (new File (sPath, "HRXML/UserAccount.xsd"));
options.addBindFile (new File ("C:\\dev\\git\\ph-ubl\\ph-ubltr\\src\\main\\jaxb\\bindings-ubltr.xjb"));

final Model model = ModelLoader.load (options, new JCodeModel (), er);
}
}
13 changes: 8 additions & 5 deletions plugin-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.evolvedbinary.maven.jvnet</groupId>
<groupId>com.helger.maven</groupId>
<artifactId>jaxb-maven-plugin-project</artifactId>
<version>0.16.0-SNAPSHOT</version>
<version>0.16.2-SNAPSHOT</version>
</parent>

<artifactId>jaxb-maven-plugin-core</artifactId>
Expand Down Expand Up @@ -35,11 +35,14 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<!--
<dependency>
<groupId>org.netbeans.external</groupId>
<artifactId>resolver-1.2</artifactId>
<version>RELEASE160</version>
<groupId>xml-resolver</groupId>
<artifactId>xml-resolver</artifactId>
<version>1.2</version>
</dependency>
-->

<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>txw2</artifactId>
Expand Down
Loading