XMLBEANS-486 - Provide Maven plugin
git-svn-id: https://svn.apache.org/repos/asf/xmlbeans/trunk@1886991 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/build.xml b/build.xml
index 3612b32..75ac5f8 100644
--- a/build.xml
+++ b/build.xml
@@ -145,6 +145,22 @@
<dependency prefix="hamcrest" artifact="org.hamcrest:hamcrest:2.2" usage="tests"/>
<dependency prefix="xerces" artifact="xerces:xercesImpl:2.12.0" usage="tests"/>
+ <!-- maven plugin dependencies -->
+ <dependency prefix="maven-core" artifact="org.apache.maven:maven-core:3.6.3" usage="maven-plugin"/>
+ <dependency prefix="maven-model" artifact="org.apache.maven:maven-model:3.6.3" usage="maven-plugin"/>
+ <dependency prefix="maven-plugin-api" artifact="org.apache.maven:maven-plugin-api:3.6.3" usage="maven-plugin"/>
+ <dependency prefix="maven-plugin-annotations" artifact="org.apache.maven.plugin-tools:maven-plugin-annotations:3.6.0" usage="maven-plugin"/>
+ <!-- only necessary to compile against JDK8 internals - for Java9+ there's a mulitmodule implementation -->
+ <dependency prefix="xml-resolver" artifact="com.sun.org.apache.xml.internal:resolver:20050927" usage="maven-plugin"/>
+
+ <path id="maven-plugin">
+ <pathelement location="${maven-core.jar}"/>
+ <pathelement location="${maven-model.jar}"/>
+ <pathelement location="${maven-plugin-api.jar}"/>
+ <pathelement location="${maven-plugin-annotations.jar}"/>
+ <pathelement location="${xml-resolver.jar}"/>
+ </path>
+
<path id="xmlbeans-test">
<pathelement location="build/classes"/>
<pathelement location="build/generated-resources"/>
@@ -161,6 +177,7 @@
<pathelement location="${xerces.jar}"/>
<pathelement location="${xml-apis.jar}" if:true="${isJava8}"/>
<pathelement location="${javaparser.core.jar}"/>
+ <path refid="maven-plugin"/>
</path>
<path id="sources">
@@ -202,6 +219,11 @@
<available file="${ant.jar}"/>
<available file="${ant-junit.jar}"/>
<available file="${ant-junit4.jar}"/>
+ <available file="${maven-core.jar}"/>
+ <available file="${maven-model.jar}"/>
+ <available file="${maven-plugin-api.jar}"/>
+ <available file="${maven-plugin-annotations.jar}"/>
+ <available file="${xml-resolver.jar}"/>
</and>
<isset property="disconnected"/>
</or>
@@ -233,7 +255,11 @@
<downloadfile dest="${ant.jar}" src="${ant.url}"/>
<downloadfile dest="${ant-junit.jar}" src="${ant-junit.url}"/>
<downloadfile dest="${ant-junit4.jar}" src="${ant-junit4.url}"/>
-
+ <downloadfile dest="${maven-core.jar}" src="${maven-core.url}"/>
+ <downloadfile dest="${maven-model.jar}" src="${maven-model.url}"/>
+ <downloadfile dest="${maven-plugin-api.jar}" src="${maven-plugin-api.url}"/>
+ <downloadfile dest="${maven-plugin-annotations.jar}" src="${maven-plugin-annotations.url}"/>
+ <downloadfile dest="${xml-resolver.jar}" src="${xml-resolver.url}"/>
</target>
<macrodef name="schemaComp">
@@ -289,6 +315,7 @@
<src path="@{srcDir}/org/apache/xmlbeans/metadata/system/@{schemaName}"/>
<classpath>
<pathelement location="${old.xmlbeans.jar}"/>
+ <path refid="maven-plugin"/>
</classpath>
</javac>
</sequential>
@@ -338,9 +365,6 @@
<replace dir="build/bootstrap/generated-sources" token=" set(org.apache.xmlbeans.StringEnumAbstractBase" value=" setEnumValue(org.apache.xmlbeans.StringEnumAbstractBase" includes="**/*.java"/>
<replace dir="build/bootstrap/generated-sources" token="java.util.List list" value="java.util.List<?> list" includes="**/*.java"/>
-
-
-
<mkdir dir="build/classes"/>
<mkdir dir="build/generated-sources"/>
<javac release="8"
@@ -360,6 +384,7 @@
<pathelement location="${saxon.jar}"/>
<pathelement location="${log4j-api.jar}"/>
<pathelement location="${javaparser.core.jar}"/>
+ <path refid="maven-plugin"/>
</classpath>
</javac>
<mkdir dir="build/generated-resources/org/apache/xmlbeans/impl/schema"/>
@@ -381,6 +406,7 @@
<pathelement location="build/classes"/>
<pathelement location="build/bootstrap/generated-resources"/>
<dirset dir="src/main/resources" includes="*" excludes="maven"/>
+ <path refid="maven-plugin"/>
</path>
<schemaCompProd classpathref="oldschemas" dest="build"/>
@@ -405,6 +431,7 @@
<classpath path="${log4j-api.jar}"/>
<classpath path="${javaparser.core.jar}"/>
<classpath path="${ant.jar}"/>
+ <classpath refid="maven-plugin"/>
</javac>
<javac release="9"
@@ -606,6 +633,7 @@
<classpath>
<pathelement location="build/classes"/>
<fileset dir="lib/main" includes="*.jar"/>
+ <fileset dir="lib/maven-plugin" includes="*.jar"/>
</classpath>
<excludepackage name="org.apache.xmlbeans.impl.repackage.*"/>
<excludepackage name="org.apache.xmlbeans.impl.xb.*"/>
@@ -616,14 +644,21 @@
</javadoc>
</target>
- <target name="package" depends="compile,javadocs" description="Builds our jars in the build directory">
+ <target name="package" depends="compile,javadocs" description="Builds our jars in the build directory"><!-- -->
+ <copy todir="build/maven">
+ <fileset dir="src/main/resources/maven"/>
+ <filterset>
+ <filter token="VERSION" value="${version.base}"/>
+ </filterset>
+ </copy>
<jar jarfile="build/xmlbeans-${version.base}.jar" update="false" index="true" duplicate="preserve">
<fileset dir="build/classes" excludes="org/apache/xmlbeans/impl/schema/TypeSystemHolder.template"/>
<fileset dir="." includes="LICENSE.txt,NOTICE.txt"/>
<fileset dir="build/generated-resources"/>
- <zipfileset dir="src/main/multimodule/java9" prefix="META-INF/versions/9" excludes="*.java"/>
+ <zipfileset dir="src/main/multimodule/java9" prefix="META-INF/versions/9" excludes="**/*.java"/>
+ <zipfileset dir="build/maven" prefix="META-INF/maven"/>
<mappedresources>
- <fileset dir="src/main/resources" excludes="maven"/>
+ <fileset dir="src/main/resources" excludes="maven/**"/>
<cutdirsmapper dirs="1"/>
</mappedresources>
<manifest>
@@ -846,7 +881,7 @@
</target>
<target name="mvn-install" depends="maven.ant.tasks-check,package" description="Install XmlBeans artifacts into the local repository. Equivalent of 'mvn install'">
- <copy file="${basedir}/src/main/resources/maven/pom.xml" todir="${basedir}/build" filtering="true">
+ <copy file="${basedir}/src/main/resources/maven/org.apache.xmlbeans/xmlbeans/pom.xml" todir="${basedir}/build" filtering="true">
<filterset>
<filter token="VERSION" value="${version.base}"/>
</filterset>
diff --git a/maven-plugin/INSTRUCTIONS.txt b/maven-plugin/INSTRUCTIONS.txt
deleted file mode 100644
index cb01d48..0000000
--- a/maven-plugin/INSTRUCTIONS.txt
+++ /dev/null
@@ -1,68 +0,0 @@
-Some brief instructions for using the maven xmlbeans2 plugin
-
-1. Include something like this in your maven.xml:
-namespace declaration:
-
- xmlns:xmlbeans="xmlbeans:maven"
-
- <preGoal name="java:compile">
- <xmlbeans:schema2java
- sourcedir="${basedir}/src"
- sourceschema="j2ee_1_4schema/application_1_4.xsd,j2ee_1_4schema/j2ee_jaxrpc_mapping_1_1.xsd,j2ee_1_3schema/connector_1_0.xsd"
- xmlconfigs="${basedir}/src/conf/xmlconfig.xml"
- targetdir="${basedir}/target/xmlbeans"
- cataloglocation="${basedir}/src/catalog/resolver-catalog.xml"/>
- </preGoal>
-
-where
-
-sourcedir is a base directory for the list in sourceschema
-sourceschema is a comma-delimited list of all the schemas you want to compile
-xmlconfigs points to your xmlconfig.xml file
-targetdir is where you want generated java source to appear
-cataloglocation is the location of an entity resolver catalog to use for resolving namespace to schema locations.
-
-The generated binary files, both .xsd and the TypeHolder class, will end up in the target/classes directory.
-
-In addition, you can add precompiled schemas to the "schema classpath" by including them as
-dependencies in project.xml with a properties tag like this:
-
- <dependency>
- <groupId>geronimo</groupId>
- <artifactId>geronimo-naming-builder</artifactId>
- <version>${pom.currentVersion}</version>
- <properties>
- <xmlbeans>true</xmlbeans>
- </properties>
- </dependency>
-
-You will probably also want to add a dependency on the plugin to your project.xml file and the other dependencies if you use xmlbeans in unit tests:
-
- <dependency>
- <groupId>xmlbeans</groupId>
- <artifactId>xmlbeans-maven-plugin</artifactId>
- <version>2.0-beta1</version>
- <type>plugin</type>
- </dependency>
-
- <!-- needed for xmlbeans runtime-->
- <dependency>
- <groupId>xmlbeans</groupId>
- <artifactId>xbean</artifactId>
- <version>${xmlbeans_version}</version>
- </dependency>
-
- <dependency>
- <groupId>stax</groupId>
- <artifactId>stax</artifactId>
- <version>${stax_version}</version>
- </dependency>
-
- <dependency>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- <version>${stax_api_version}</version>
- </dependency>
-
-
-
diff --git a/maven-plugin/LICENSE.txt b/maven-plugin/LICENSE.txt
deleted file mode 100644
index 6b0b127..0000000
--- a/maven-plugin/LICENSE.txt
+++ /dev/null
@@ -1,203 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
diff --git a/maven-plugin/NOTICE.txt b/maven-plugin/NOTICE.txt
deleted file mode 100644
index 439eb83..0000000
--- a/maven-plugin/NOTICE.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/maven-plugin/plugin.jelly b/maven-plugin/plugin.jelly
deleted file mode 100644
index c543ee7..0000000
--- a/maven-plugin/plugin.jelly
+++ /dev/null
@@ -1,104 +0,0 @@
-<?xml version="1.0"?>
-<!--
-
- Copyright 2004-2005 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<!-- ================================================================== -->
-<!-- xmlbeans v2 maven plugin -->
-<!-- ================================================================== -->
-<project xmlns:j="jelly:core"
- xmlns:u="jelly:util"
- xmlns:ant="jelly:ant"
- xmlns:maven="jelly:maven"
- xmlns:define="jelly:define"
- xmlns:xmlbeans="xmlbeans2:maven"
- >
-
- <define:taglib uri="xmlbeans2:maven">
- <define:jellybean
- name="SchemaCompilerWrapper"
- className="org.apache.xmlbeans.maven.SchemaCompilerWrapper"
- method="compileSchemas"/>
-
-
- <define:tag name="schema2java" xmlns="jelly:ant">
-
- <j:if test="${context.getVariable('maven.xmlbeans2.targetdir') == null}">
- <fail>Missing required attribute: maven.xmlbeans2.targetdir</fail>
- </j:if>
- <j:if test="${context.getVariable('maven.xmlbeans2.sourcedir') == null}">
- <fail>Missing required attribute: maven.xmlbeans2.sourcedir</fail>
- </j:if>
- <j:if test="${context.getVariable('maven.xmlbeans2.sourceschema') == null}">
- <fail>Missing required attribute: maven.xmlbeans2.sourceschema</fail>
- </j:if>
- <j:if test="${context.getVariable('maven.xmlbeans2.xmlconfigs') == null}">
- <fail>Missing required attribute: maven.xmlbeans2.xmlconfigs</fail>
- </j:if>
- <!-- set up classpath for already-compiled schemas -->
- <j:forEach var="artifact" items="${pom.artifacts}">
- <j:set var="dependency" value="${artifact.dependency}"/>
- <j:if test="${dependency.getProperty('xmlbeans') == 'true'}">
- <j:set var="xmlbeans.classpath" value="${xmlbeans.classpath},${artifact.path}"/>
- </j:if>
- </j:forEach>
-
- <j:jelly xmlns="jelly:ant">
-
- <j:set var="uptodatePropName" value="xmlbeans.uptodate"/>
- <j:expr value="${context.setVariable(uptodatePropName, null)}"/>
- <j:set var="uptodateFile" value="${maven.xmlbeans2.targetdir}/tstamp"/>
-
- <uptodate property="${uptodatePropName}"
- targetfile="${uptodateFile}">
- <srcfiles dir="${maven.xmlbeans2.sourcedir}"
- includes="${maven.xmlbeans2.sourceschema}"/>
- </uptodate>
-
-
- <xmlbeans:SchemaCompilerWrapper
- sourceDir="${maven.xmlbeans2.sourcedir}"
- sourceSchemas="${maven.xmlbeans2.sourceschema}"
- xmlConfigs="${maven.xmlbeans2.xmlconfigs}"
- javaTargetDir="${maven.xmlbeans2.targetdir}"
- classTargetDir="${maven.build.dest}"
- catalogLocation="${maven.xmlbeans2.cataloglocation}"
- classPath="${xmlbeans.classpath}"
- resources="${pom.build.resources}"
- buildSchemas="${context.getVariable(uptodatePropName) == null}"
- baseSchemaLocation="${maven.xmlbeans2.baseSchemaLocation}"
- />
- <j:if test="${context.getVariable(uptodatePropName) == null}">
- <touch file="${uptodateFile}"/>
- </j:if>
-
- <path id="maven.xmlbeans.compile.src.set"
- location="${maven.xmlbeans2.targetdir}"/>
- <j:if test="${context.antProject.getReference('maven.compile.src.set') != null}">
- <maven:addPath id="maven.compile.src.set"
- refid="maven.xmlbeans.compile.src.set"/>
- </j:if>
- <j:if test="${context.antProject.getReference('maven.compile.src.set') == null}">
- <echo message="Maven cannot find the generated sources unless you provide a dummy source directory in project.xml"/>
- </j:if>
-
- </j:jelly>
- </define:tag>
-
-
- </define:taglib>
-
-</project>
\ No newline at end of file
diff --git a/maven-plugin/plugin.properties b/maven-plugin/plugin.properties
deleted file mode 100644
index d942678..0000000
--- a/maven-plugin/plugin.properties
+++ /dev/null
@@ -1,50 +0,0 @@
-# Copyright 2003-2005 The Apache Software Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-#These properties can be set in a project.properties file or in an invocation in maven.xml
-#dependencies marked with the property <xmlbeans>true</xmlbeans> will get included in the xmlbeans classpath
-#so you can reuse your xmlbeans generated classes.
-
-#a typical invocation looks like:
-#<project default="default"
-# xmlns:xmlbeans="xmlbeans2:maven">
-#
-# <preGoal name="java:compile">
-# <xmlbeans:schema2java
-# maven.xmlbeans2.sourceschema="application_1_4.xsd,j2ee_jaxrpc_mapping_1_1.xsd"
-# maven.xmlbeans2.cataloglocation="${basedir}/src/catalog/resolver-catalog.xml"/>
-# </preGoal>
-
-
-#base location for schemas to compile
-maven.xmlbeans2.sourcedir=${basedir}/src/schema
-
-#comma separated list of schemas to compile, relative to sourcedir above. You must specify this explicitly
-maven.xmlbeans2.sourceschema=
-
-#location of the xmlbeans configuration file
-maven.xmlbeans2.xmlconfigs=${basedir}/src/schema/xmlconfig.xml
-
-#location of an xml catalog. If you use one, you must specify the location yourself.
-maven.xmlbeans2.cataloglocation=
-
-#target directory for generated java code. Binary artifacts are place directly into target/classes.
-maven.xmlbeans2.targetdir=${basedir}/target/xmlbeans
-
-#default base location where schemas will be copied. Unlike the ant task,
-#they will include the path of the schema listed in the sourceSchemas parameter.
-maven.xmlbeans2.baseSchemaLocation=schemaorg_apache_xmlbeans/src
-
-
-
diff --git a/maven-plugin/project.properties b/maven-plugin/project.properties
deleted file mode 100644
index b51959b..0000000
--- a/maven-plugin/project.properties
+++ /dev/null
@@ -1,28 +0,0 @@
-# Copyright 2003-2005 The Apache Software Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-maven.multiproject.type=plugin
-
-maven.repo.central=apache.org
-maven.repo.central.directory=/www/cvs.apache.org/repository
-
-maven.remote.group=apcvs
-
-maven.compile.source=1.4
-maven.compile.target=1.4
-#maven.compile.deprecation=true
-maven.compile.debug=true
-maven.compile.optimize=true
-
-
diff --git a/maven-plugin/project.xml b/maven-plugin/project.xml
deleted file mode 100644
index 2d7937a..0000000
--- a/maven-plugin/project.xml
+++ /dev/null
@@ -1,88 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-
- Copyright 2004 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<project>
- <pomVersion>3</pomVersion>
-
- <groupId>xmlbeans</groupId>
- <id>xmlbeans-maven-plugin</id>
- <currentVersion>2.0.0-beta1</currentVersion>
- <name>xmlbeans maven plugin</name>
- <organization>
- <name>Apache Software Foundation</name>
- <url>http://www.apache.org/</url>
- <logo></logo>
- </organization>
- <inceptionYear>2004</inceptionYear>
- <package>org.apache.xmlbeans.maven</package>
- <logo></logo>
-
- <dependencies>
- <dependency>
- <groupId>xml-resolver</groupId>
- <artifactId>xml-resolver</artifactId>
- <version>1.1</version>
- </dependency>
-
- <dependency>
- <groupId>xmlbeans</groupId>
- <artifactId>xbean</artifactId>
- <version>2.0.0</version>
- </dependency>
-
- <dependency>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- <version>1.0</version>
- </dependency>
-
- <dependency>
- <groupId>maven</groupId>
- <artifactId>maven</artifactId>
- <version>1.0.2</version>
- </dependency>
-
- </dependencies>
-
- <build>
- <sourceDirectory>src/java</sourceDirectory>
- <unitTestSourceDirectory>src/test</unitTestSourceDirectory>
-
- <unitTest>
- <includes>
- <include>**/*Test.java</include>
- </includes>
- </unitTest>
-
- <resources>
- <resource>
- <directory>src/plugin-resources</directory>
- <targetPath>plugin-resources</targetPath>
- </resource>
- <resource>
- <directory>.</directory>
- <includes>
- <include>plugin.jelly</include>
- <include>plugin.properties</include>
- <include>project.properties</include>
- <include>project.xml</include>
- </includes>
- </resource>
- </resources>
- </build>
-</project>
diff --git a/maven-plugin/src/java/org/apache/xmlbeans/maven/SchemaCompilerWrapper.java b/maven-plugin/src/java/org/apache/xmlbeans/maven/SchemaCompilerWrapper.java
deleted file mode 100644
index 5bc4261..0000000
--- a/maven-plugin/src/java/org/apache/xmlbeans/maven/SchemaCompilerWrapper.java
+++ /dev/null
@@ -1,270 +0,0 @@
-/**
- *
- * Copyright 2003-2005 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.xmlbeans.maven;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.apache.maven.project.Resource;
-import org.apache.xml.resolver.CatalogManager;
-import org.apache.xml.resolver.tools.CatalogResolver;
-import org.apache.xmlbeans.impl.tool.SchemaCompiler;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-
-/**
- *
- *
- * @version $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $
- *
- * */
-public class SchemaCompilerWrapper {
-
- private String sourceDir;
- private String sourceSchemas;
- private String xmlConfigs;
- private String javaTargetDir;
- private String classTargetDir;
- private String catalogLocation;
- private String classPath;
- private List resources;
- private boolean buildSchemas;
- //this copy should not end in /
- private String baseSchemaLocation = "schemaorg_apache_xmlbeans/src";
-
- public String getSourceDir() {
- return sourceDir;
- }
-
- public void setSourceDir(String sourceDir) {
- this.sourceDir = sourceDir;
- }
-
- public String getSourceSchemas() {
- return sourceSchemas;
- }
-
- public void setSourceSchemas(String sourceSchemas) {
- this.sourceSchemas = sourceSchemas;
- }
-
- public String getXmlConfigs() {
- return xmlConfigs;
- }
-
- public void setXmlConfigs(String xmlConfigs) {
- this.xmlConfigs = xmlConfigs;
- }
-
- public String getJavaTargetDir() {
- return javaTargetDir;
- }
-
- public void setJavaTargetDir(String javaTargetDir) {
- this.javaTargetDir = javaTargetDir;
- }
-
- public String getClassTargetDir() {
- return classTargetDir;
- }
-
- public void setClassTargetDir(String classTargetDir) {
- this.classTargetDir = classTargetDir;
- }
-
- public String getCatalogLocation() {
- return catalogLocation;
- }
-
- public void setCatalogLocation(String catalogLocation) {
- this.catalogLocation = catalogLocation;
- }
-
- public String getClassPath() {
- return classPath;
- }
-
- public void setClassPath(String classPath) {
- this.classPath = classPath;
- }
-
- public List getResources() {
- return resources;
- }
-
- public void setResources(List resources) {
- this.resources = resources;
- }
-
- public boolean isBuildSchemas() {
- return buildSchemas;
- }
-
- public void setBuildSchemas(boolean buildSchemas) {
- this.buildSchemas = buildSchemas;
- }
-
- public String getBaseSchemaLocation() {
- return baseSchemaLocation;
- }
-
- public void setBaseSchemaLocation(String baseSchemaLocation) {
- if (baseSchemaLocation != null && !(baseSchemaLocation.length() == 0)) {
- this.baseSchemaLocation = baseSchemaLocation;
- }
- }
-
- public void compileSchemas() throws Exception {
- List schemas = new ArrayList();
- File base = new File(sourceDir);
- Resource resource = new Resource();
- resource.setDirectory(sourceDir);
- resource.setTargetPath(baseSchemaLocation);
- for (StringTokenizer st = new StringTokenizer(sourceSchemas, ","); st.hasMoreTokens();) {
- String schemaName = st.nextToken();
- schemas.add(new File(base, schemaName));
- resource.addInclude(schemaName);
- }
- resources.add(resource);
- if (buildSchemas) {
- List configs = new ArrayList();
-
- if (xmlConfigs != null) {
- for (StringTokenizer st = new StringTokenizer(xmlConfigs, ","); st.hasMoreTokens();) {
- String configName = st.nextToken();
- configs.add(new File(configName));
- }
- }
- List classPathList = new ArrayList();
- List urls = new ArrayList();
- if (classPath != null) {
- for (StringTokenizer st = new StringTokenizer(classPath, ","); st.hasMoreTokens();) {
- String classpathElement = st.nextToken();
- File file = new File(classpathElement);
- classPathList.add(file);
- urls.add(file.toURL());
- System.out.println("Adding to classpath: " + file);
- }
- }
- ClassLoader cl = new URLClassLoader((URL[]) urls.toArray(new URL[] {}));
- EntityResolver entityResolver = null;
- if (catalogLocation != null) {
- CatalogManager catalogManager = CatalogManager.getStaticManager();
- catalogManager.setCatalogFiles(catalogLocation);
- entityResolver = new CatalogResolver();
- }
- URI sourceDirURI = new File(sourceDir).toURI();
- entityResolver = new PassThroughResolver(cl, entityResolver, sourceDirURI, baseSchemaLocation);
-
- SchemaCompiler.Parameters params = new SchemaCompiler.Parameters();
- params.setBaseDir(null);
- params.setXsdFiles((File[])schemas.toArray(new File[] {}));
- params.setWsdlFiles(new File[] {});
- params.setJavaFiles(new File[] {});
- params.setConfigFiles((File[])configs.toArray(new File[] {}));
- params.setClasspath((File[])classPathList.toArray(new File[] {}));
- params.setOutputJar(null);
- params.setName(null);
- params.setSrcDir(new File(javaTargetDir));
- params.setClassesDir(new File(classTargetDir));
- params.setCompiler(null);
- params.setMemoryInitialSize(null);
- params.setMemoryMaximumSize(null);
- params.setNojavac(true);
- params.setQuiet(false);
- params.setVerbose(true);
- params.setDownload(false);
- params.setNoUpa(false);
- params.setNoPvr(false);
- params.setDebug(true);
- params.setErrorListener(new ArrayList());
- params.setRepackage(null);
- params.setExtensions(null);
- params.setMdefNamespaces(null);
- params.setEntityResolver(entityResolver);
-
- boolean result = SchemaCompiler.compile(params);
- if (!result) {
- Collection errors = params.getErrorListener();
- for (Iterator iterator = errors.iterator(); iterator.hasNext();) {
- Object o = (Object) iterator.next();
- System.out.println("xmlbeans error: " + o);
- }
- throw new Exception("Schema compilation failed");
- }
- }
-
- }
-
- private static class PassThroughResolver implements EntityResolver {
- private final ClassLoader cl;
- private final EntityResolver delegate;
- private final URI sourceDir;
- //this copy has an / appended
- private final String baseSchemaLocation;
-
- public PassThroughResolver(ClassLoader cl, EntityResolver delegate, URI sourceDir, String baseSchemaLocation) {
- this.cl = cl;
- this.delegate = delegate;
- this.sourceDir = sourceDir;
- this.baseSchemaLocation = baseSchemaLocation + "/";
- }
- public InputSource resolveEntity(String publicId,
- String systemId)
- throws SAXException, IOException {
- if (delegate != null) {
- InputSource is = delegate.resolveEntity(publicId, systemId);
- if (is != null) {
- return is;
- }
- }
- System.out.println("Could not resolve publicId: " + publicId + ", systemId: " + systemId + " from catalog");
- String localSystemId;
- try {
- localSystemId = sourceDir.relativize(new URI(systemId)).toString();
- } catch (URISyntaxException e) {
- throw (IOException)new IOException("Could not relativeize systemId").initCause(e);
- }
- InputStream in = cl.getResourceAsStream(localSystemId);
- if (in != null) {
- System.out.println("found in classpath at: " + localSystemId);
- return new InputSource(in);
- }
- in = cl.getResourceAsStream(baseSchemaLocation + localSystemId);
- if (in != null) {
- System.out.println("found in classpath at: META-INF/" + localSystemId);
- return new InputSource(in);
- }
- System.out.println("Not found in classpath, looking in current directory: " + systemId);
- return new InputSource(systemId);
- }
-
- }
-}
diff --git a/src/main/java/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java b/src/main/java/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java
index aa5c756..70b32be 100644
--- a/src/main/java/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java
+++ b/src/main/java/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java
@@ -1560,7 +1560,9 @@
String arrayName = propertyName + "Array";
printJavaDoc("Gets " + (xget ? "(as xml) " : "") + "a List of " + propdesc + "s");
- emit("@Override");
+ if (!opt.isCompileNoAnnotations()) {
+ emit("@Override");
+ }
emit("public java.util.List<" + wrappedType + "> " + (xget ? "xget" : "get") + propertyName + "List() {");
startBlock();
@@ -1624,7 +1626,9 @@
if (bmList == null || bmList.contains(BeanMethod.GET)) {
// Value getProp()
printJavaDoc((several ? "Gets first " : "Gets the ") + propdesc);
- emit("@Override");
+ if (!opt.isCompileNoAnnotations()) {
+ emit("@Override");
+ }
emit("public " + type + " get" + propertyName + "() {");
startBlock();
emitImplementationPreamble();
@@ -1653,7 +1657,9 @@
if (!xmltype && (bmList == null || bmList.contains(BeanMethod.XGET))) {
// Value xgetProp()
printJavaDoc((several ? "Gets (as xml) first " : "Gets (as xml) the ") + propdesc);
- emit("@Override");
+ if (!opt.isCompileNoAnnotations()) {
+ emit("@Override");
+ }
emit("public " + xtype + " xget" + propertyName + "() {");
startBlock();
emitImplementationPreamble();
@@ -1675,7 +1681,9 @@
if (nillable && (bmList == null || bmList.contains(BeanMethod.IS_NIL))) {
// boolean isNilProp()
printJavaDoc((several ? "Tests for nil first " : "Tests for nil ") + propdesc);
- emit("@Override");
+ if (!opt.isCompileNoAnnotations()) {
+ emit("@Override");
+ }
emit("public boolean isNil" + propertyName + "() {");
startBlock();
emitImplementationPreamble();
@@ -1691,7 +1699,9 @@
if (prop.extendsJavaOption() && (bmList == null || bmList.contains(BeanMethod.IS_SET))) {
// boolean isSetProp()
printJavaDoc((several ? "True if has at least one " : "True if has ") + propdesc);
- emit("@Override");
+ if (!opt.isCompileNoAnnotations()) {
+ emit("@Override");
+ }
emit("public boolean isSet" + propertyName + "() {");
startBlock();
@@ -1722,7 +1732,9 @@
if (bmList == null || bmList.contains(BeanMethod.GET_ARRAY)) {
// Value[] getProp()
printJavaDoc("Gets array of all " + propdesc + "s");
- emit("@Override");
+ if (!opt.isCompileNoAnnotations()) {
+ emit("@Override");
+ }
emit("public " + type + "[] get" + arrayName + "() {");
startBlock();
@@ -1734,7 +1746,9 @@
if (bmList == null || bmList.contains(BeanMethod.GET_IDX)) {
// Value getProp(int i)
printJavaDoc("Gets ith " + propdesc);
- emit("@Override");
+ if (!opt.isCompileNoAnnotations()) {
+ emit("@Override");
+ }
emit("public " + type + " get" + arrayName + "(int i) {");
startBlock();
emitImplementationPreamble();
@@ -1753,7 +1767,9 @@
if (!xmltype && (bmList == null || bmList.contains(BeanMethod.XGET_ARRAY))) {
// Value[] xgetProp()
printJavaDoc("Gets (as xml) array of all " + propdesc + "s");
- emit("@Override");
+ if (!opt.isCompileNoAnnotations()) {
+ emit("@Override");
+ }
emit("public " + xtype + "[] xget" + arrayName + "() {");
startBlock();
emit("return xgetArray(" + setIdentifier + ", " + xtype + "[]::new);");
@@ -1763,7 +1779,9 @@
if (!xmltype && (bmList == null || bmList.contains(BeanMethod.XGET_IDX))) {
// Value xgetProp(int i)
printJavaDoc("Gets (as xml) ith " + propdesc);
- emit("@Override");
+ if (!opt.isCompileNoAnnotations()) {
+ emit("@Override");
+ }
emit("public " + xtype + " xget" + arrayName + "(int i) {");
startBlock();
emitImplementationPreamble();
@@ -1776,7 +1794,9 @@
if (nillable && (bmList == null || bmList.contains(BeanMethod.IS_NIL_IDX))) {
// boolean isNil(int i);
printJavaDoc("Tests for nil ith " + propdesc);
- emit("@Override");
+ if (!opt.isCompileNoAnnotations()) {
+ emit("@Override");
+ }
emit("public boolean isNil" + arrayName + "(int i) {");
startBlock();
emitImplementationPreamble();
@@ -1789,7 +1809,9 @@
// int countProp();
if (bmList == null || bmList.contains(BeanMethod.SIZE_OF_ARRAY)) {
printJavaDoc("Returns number of " + propdesc);
- emit("@Override");
+ if (!opt.isCompileNoAnnotations()) {
+ emit("@Override");
+ }
emit("public int sizeOf" + arrayName + "() {");
startBlock();
emitImplementationPreamble();
@@ -1828,7 +1850,9 @@
if (bmList == null || bmList.contains(BeanMethod.SET)) {
// void setProp(Value v);
printJavaDoc((several ? "Sets first " : "Sets the ") + propdesc);
- emit("@Override");
+ if (!opt.isCompileNoAnnotations()) {
+ emit("@Override");
+ }
emit("public void set" + propertyName + "(" + type + " " + safeVarName + ") {");
startBlock();
if (xmltype && !isSubstGroup && !isAttr) {
@@ -1850,7 +1874,9 @@
if (!xmltype && (bmList == null || bmList.contains(BeanMethod.XSET))) {
// void xsetProp(Value v)
printJavaDoc((several ? "Sets (as xml) first " : "Sets (as xml) the ") + propdesc);
- emit("@Override");
+ if (!opt.isCompileNoAnnotations()) {
+ emit("@Override");
+ }
emit("public void xset" + propertyName + "(" + xtype + " " + safeVarName + ") {");
startBlock();
emitImplementationPreamble();
@@ -1866,7 +1892,9 @@
if (xmltype && !several && (bmList == null || bmList.contains(BeanMethod.ADD_NEW))) {
// Value addNewProp()
printJavaDoc("Appends and returns a new empty " + propdesc);
- emit("@Override");
+ if (!opt.isCompileNoAnnotations()) {
+ emit("@Override");
+ }
emit("public " + xtype + " addNew" + propertyName + "() {");
startBlock();
emitImplementationPreamble();
@@ -1881,7 +1909,9 @@
if (nillable && (bmList == null || bmList.contains(BeanMethod.SET_NIL))) {
printJavaDoc((several ? "Nils the first " : "Nils the ") + propdesc);
- emit("@Override");
+ if (!opt.isCompileNoAnnotations()) {
+ emit("@Override");
+ }
emit("public void setNil" + propertyName + "() {");
startBlock();
emitImplementationPreamble();
@@ -1896,7 +1926,9 @@
if (prop.extendsJavaOption() && (bmList == null || bmList.contains(BeanMethod.UNSET))) {
printJavaDoc((several ? "Removes first " : "Unsets the ") + propdesc);
- emit("@Override");
+ if (!opt.isCompileNoAnnotations()) {
+ emit("@Override");
+ }
emit("public void unset" + propertyName + "() {");
startBlock();
emitImplementationPreamble();
@@ -1917,7 +1949,9 @@
if (bmList == null || bmList.contains(BeanMethod.SET_ARRAY)) {
if (xmltype) {
printJavaDoc("Sets array of all " + propdesc + " WARNING: This method is not atomicaly synchronized.");
- emit("@Override");
+ if (!opt.isCompileNoAnnotations()) {
+ emit("@Override");
+ }
emit("public void set" + arrayName + "(" + type + "[] " + safeVarName + "Array) {");
startBlock();
// do not use synchronize (monitor()) { and GlobalLock inside } !!! deadlock
@@ -1944,7 +1978,9 @@
endBlock();
} else {
printJavaDoc("Sets array of all " + propdesc);
- emit("@Override");
+ if (!opt.isCompileNoAnnotations()) {
+ emit("@Override");
+ }
emit("public void set" + arrayName + "(" + type + "[] " + safeVarName + "Array) {");
startBlock();
emitImplementationPreamble();
@@ -1986,7 +2022,9 @@
if (bmList == null || bmList.contains(BeanMethod.SET_IDX)) {
printJavaDoc("Sets ith " + propdesc);
- emit("@Override");
+ if (!opt.isCompileNoAnnotations()) {
+ emit("@Override");
+ }
emit("public void set" + arrayName + "(int i, " + type + " " + safeVarName + ") {");
startBlock();
if (xmltype && !isSubstGroup) {
@@ -2007,7 +2045,9 @@
if (!xmltype && (bmList == null || bmList.contains(BeanMethod.XSET_ARRAY))) {
printJavaDoc("Sets (as xml) array of all " + propdesc);
- emit("@Override");
+ if (!opt.isCompileNoAnnotations()) {
+ emit("@Override");
+ }
emit("public void xset" + arrayName + "(" + xtype + "[]" + safeVarName + "Array) {");
startBlock();
emitImplementationPreamble();
@@ -2020,7 +2060,9 @@
if (!xmltype && (bmList == null || bmList.contains(BeanMethod.XSET_IDX))) {
printJavaDoc("Sets (as xml) ith " + propdesc);
- emit("@Override");
+ if (!opt.isCompileNoAnnotations()) {
+ emit("@Override");
+ }
emit("public void xset" + arrayName + "(int i, " + xtype + " " + safeVarName + ") {");
startBlock();
emitImplementationPreamble();
@@ -2034,7 +2076,9 @@
if (nillable && (bmList == null || bmList.contains(BeanMethod.SET_NIL_IDX))) {
printJavaDoc("Nils the ith " + propdesc);
- emit("@Override");
+ if (!opt.isCompileNoAnnotations()) {
+ emit("@Override");
+ }
emit("public void setNil" + arrayName + "(int i) {");
startBlock();
emitImplementationPreamble();
@@ -2048,7 +2092,9 @@
if (!xmltype && (bmList == null || bmList.contains(BeanMethod.INSERT_IDX))) {
printJavaDoc("Inserts the value as the ith " + propdesc);
- emit("@Override");
+ if (!opt.isCompileNoAnnotations()) {
+ emit("@Override");
+ }
emit("public void insert" + propertyName + "(int i, " + type + " " + safeVarName + ") {");
startBlock();
emitImplementationPreamble();
@@ -2071,7 +2117,9 @@
if (!xmltype && (bmList == null || bmList.contains(BeanMethod.ADD))) {
printJavaDoc("Appends the value as the last " + propdesc);
- emit("@Override");
+ if (!opt.isCompileNoAnnotations()) {
+ emit("@Override");
+ }
emit("public void add" + propertyName + "(" + type + " " + safeVarName + ") {");
startBlock();
emitImplementationPreamble();
@@ -2086,7 +2134,9 @@
if (bmList == null || bmList.contains(BeanMethod.INSERT_NEW_IDX)) {
printJavaDoc("Inserts and returns a new empty value (as xml) as the ith " + propdesc);
- emit("@Override");
+ if (!opt.isCompileNoAnnotations()) {
+ emit("@Override");
+ }
emit("public " + xtype + " insertNew" + propertyName + "(int i) {");
startBlock();
emitImplementationPreamble();
@@ -2107,7 +2157,9 @@
if (bmList == null || bmList.contains(BeanMethod.ADD_NEW)) {
printJavaDoc("Appends and returns a new empty value (as xml) as the last " + propdesc);
- emit("@Override");
+ if (!opt.isCompileNoAnnotations()) {
+ emit("@Override");
+ }
emit("public " + xtype + " addNew" + propertyName + "() {");
startBlock();
emitImplementationPreamble();
@@ -2122,7 +2174,9 @@
if (bmList == null || bmList.contains(BeanMethod.REMOVE_IDX)) {
printJavaDoc("Removes the ith " + propdesc);
- emit("@Override");
+ if (!opt.isCompileNoAnnotations()) {
+ emit("@Override");
+ }
emit("public void remove" + propertyName + "(int i) {");
startBlock();
emitImplementationPreamble();
diff --git a/src/main/java/org/apache/xmlbeans/impl/schema/StscState.java b/src/main/java/org/apache/xmlbeans/impl/schema/StscState.java
index f9227c9..0367917 100644
--- a/src/main/java/org/apache/xmlbeans/impl/schema/StscState.java
+++ b/src/main/java/org/apache/xmlbeans/impl/schema/StscState.java
@@ -502,7 +502,7 @@
}
/**
- * True if no particle valid (restriciton) option is set
+ * True if no particle valid (restriction) option is set
*/
public boolean noPvr() {
return _noPvr;
diff --git a/src/main/java/org/apache/xmlbeans/impl/tool/MavenPlugin.java b/src/main/java/org/apache/xmlbeans/impl/tool/MavenPlugin.java
new file mode 100644
index 0000000..b83eb5e
--- /dev/null
+++ b/src/main/java/org/apache/xmlbeans/impl/tool/MavenPlugin.java
@@ -0,0 +1,407 @@
+/* Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.xmlbeans.impl.tool;
+
+import org.apache.maven.model.Resource;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.project.MavenProject;
+import org.apache.xmlbeans.XmlError;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.*;
+import java.util.*;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import static org.apache.xmlbeans.impl.tool.SchemaCompiler.parsePartialMethods;
+
+@SuppressWarnings("unused")
+@Mojo(name = "compile", defaultPhase = LifecyclePhase.GENERATE_SOURCES)
+public class MavenPlugin extends AbstractMojo {
+ // ******************************************************************************************
+ // As we don't use the maven plugin-plugin, the defaultValues and others need to be manually
+ // copied into resources/maven/plugin.xml
+ // ******************************************************************************************
+
+ /** The maven project */
+ @Parameter( readonly = true, defaultValue = "${project}" )
+ private MavenProject project;
+
+ /** sourceDir is a base directory for the list in sourceschema */
+ @Parameter( defaultValue = "${project.basedir}/src/main/schema" )
+ private String sourceDir;
+
+ /** sourceSchemas is a comma-delimited list of all the schemas you want to compile */
+ @Parameter( defaultValue = "*.xsd,*.wsdl" )
+ private String sourceSchemas;
+
+ /** xmlConfigs points to your xmlconfig.xml file */
+ @Parameter( defaultValue = "${project.basedir}/src/schema/xmlconfig.xml" )
+ private String xmlConfigs;
+
+ /** javaTargetdir is where you want generated java source to appear */
+ @Parameter( defaultValue = "${project.basedir}/target/generated-sources" )
+ private String javaTargetDir;
+
+ /** classTargetDir is where you want compiled class files to appear */
+ @Parameter( defaultValue = "${project.basedir}/target/generated-resources" )
+ private String classTargetDir;
+
+ /** catalogLocation is the location of an entity resolver catalog to use for resolving namespace to schema locations. */
+ @Parameter
+ private String catalogLocation;
+
+ @Parameter
+ private String classPath;
+
+ @Parameter
+ private List<Resource> resources;
+
+ /** buildSchemas sets build process of the generated sources */
+ @Parameter(defaultValue = "true")
+ private boolean buildSchemas;
+
+ /** destination directory of the copied xsd files - default: schemaorg_apache_xmlbeans/src */
+ @Parameter( defaultValue = "schemaorg_apache_xmlbeans/src" )
+ private String baseSchemaLocation;
+
+ /** schema system name - default: ${project.artifactId} */
+ @Parameter( defaultValue = "${project.artifactId}" )
+ private String name;
+
+ /** verbose output - default: false */
+ @Parameter( defaultValue = "false" )
+ private boolean verbose;
+
+ /** no output - default: true */
+ @Parameter( defaultValue = "true" )
+ private boolean quite;
+
+ /** deactivate unique particle attribution - default: false */
+ @Parameter( defaultValue = "false" )
+ private boolean noUpa;
+
+ /** deactivate particle valid (restriction) - default: false */
+ @Parameter( defaultValue = "false" )
+ private boolean noPvr;
+
+ /** deactivate annotation generation - default: false */
+ @Parameter( defaultValue = "false" )
+ private boolean noAnn;
+
+ /** do not validate contents of documentation-tags - default: false */
+ @Parameter( defaultValue = "false" )
+ private boolean noVDoc;
+
+ /** Metadata package name. If explicitly set empty, generates to org.apache.xmlbeans.metadata - default: ${project.groupId}.${project.artifactId}.metadata */
+ @Parameter( defaultValue = "${project.groupId}.${project.artifactId}.metadata" )
+ private String repackage;
+
+ /**
+ * If this option is set, then the schema compiler will permit and
+ * ignore multiple definitions of the same component (element, attribute,
+ * type, etc) names in the given namespaces. If multiple definitions
+ * with the same name appear, the definitions that happen to be processed
+ * last will be ignored.
+ *
+ * a comma-seperated list of namespace URIs
+ */
+ @Parameter
+ private String mdefNamespaces;
+
+ /**
+ * Only generate a subset of the bean methods. Comma-seperated list of the following method types:
+ * GET, XGET, IS_SET, IS_NIL, IS_NIL_IDX, SET, SET_NIL, SET_NIL_IDX, XSET, UNSET,
+ * GET_ARRAY, XGET_ARRAY, GET_IDX, XGET_IDX, XSET_ARRAY, XSET_IDX,
+ * SIZE_OF_ARRAY, SET_ARRAY, SET_IDX,
+ * INSERT_IDX, INSERT_NEW_IDX,
+ * ADD, ADD_NEW, REMOVE_IDX,
+ * GET_LIST, XGET_LIST, SET_LIST,
+ * INSTANCE_TYPE
+ *
+ * Example: "ALL,-GET_LIST,-XGET_LIST" excludes GET_LIST and XGET_LIST methods
+ */
+ @Parameter
+ private String partialMethods;
+
+
+
+ /*
+ public String getSourceDir() {
+ return sourceDir;
+ }
+
+ public void setSourceDir(String sourceDir) {
+ this.sourceDir = sourceDir;
+ }
+
+ public String getSourceSchemas() {
+ return sourceSchemas;
+ }
+
+ public void setSourceSchemas(String sourceSchemas) {
+ this.sourceSchemas = sourceSchemas;
+ }
+
+ public String getXmlConfigs() {
+ return xmlConfigs;
+ }
+
+ public void setXmlConfigs(String xmlConfigs) {
+ this.xmlConfigs = xmlConfigs;
+ }
+
+ public String getJavaTargetDir() {
+ return javaTargetDir;
+ }
+
+ public void setJavaTargetDir(String javaTargetDir) {
+ this.javaTargetDir = javaTargetDir;
+ }
+
+ public String getClassTargetDir() {
+ return classTargetDir;
+ }
+
+ public void setClassTargetDir(String classTargetDir) {
+ this.classTargetDir = classTargetDir;
+ }
+
+ public String getCatalogLocation() {
+ return catalogLocation;
+ }
+
+ public void setCatalogLocation(String catalogLocation) {
+ this.catalogLocation = catalogLocation;
+ }
+
+ public String getClassPath() {
+ return classPath;
+ }
+
+ public void setClassPath(String classPath) {
+ this.classPath = classPath;
+ }
+
+ public List<Resource> getResources() {
+ return resources;
+ }
+
+ public void setResources(List<Resource> resources) {
+ this.resources = resources;
+ }
+
+ public boolean isBuildSchemas() {
+ return buildSchemas;
+ }
+
+ public void setBuildSchemas(boolean buildSchemas) {
+ this.buildSchemas = buildSchemas;
+ }
+
+ public String getBaseSchemaLocation() {
+ return baseSchemaLocation;
+ }
+
+ public void setBaseSchemaLocation(String baseSchemaLocation) {
+ if (baseSchemaLocation != null && !(baseSchemaLocation.length() == 0)) {
+ this.baseSchemaLocation = baseSchemaLocation;
+ }
+ }*/
+
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ if (sourceDir == null || sourceDir.isEmpty() || !new File(sourceDir).isDirectory()) {
+ throw new MojoFailureException("Set configuration <sourceDir> (='"+sourceDir+"') to a valid directory containing *.xsd,*.wsdl files.");
+ }
+
+ if (baseSchemaLocation == null || baseSchemaLocation.isEmpty()) {
+ throw new MojoFailureException("baseSchemaLocation is empty");
+ }
+
+ if (sourceSchemas == null) {
+ getLog().debug("sourceSchemas is null");
+ }
+
+ if (classPath == null) {
+ getLog().debug("classPath is null");
+ }
+
+ List<File> xsds = new ArrayList<>();
+ List<File> wsdls = new ArrayList<>();
+ File base = new File(sourceDir);
+ Resource resource = new Resource();
+ resource.setDirectory(sourceDir);
+ resource.setTargetPath(baseSchemaLocation);
+
+ // if sourceSchemas is not specified use all found schemas
+ // otherwise convert comma-separated string to regex including glob parameter
+ Pattern pat = Pattern.compile(sourceSchemas == null ? ".*" :
+ "(" + sourceSchemas
+ .replace(",","|")
+ .replace(".", "\\.")
+ .replace("*",".*") +
+ ")");
+
+ File[] schemaFiles = Objects.requireNonNull(base.listFiles((dir, name) ->
+ !name.endsWith(".xsdconfig") && pat.matcher(name).matches()));
+ for (File sf : schemaFiles) {
+ (sf.getName().endsWith(".wsdl") ? wsdls : xsds).add(sf);
+ resource.addInclude(sf.getName());
+ }
+
+ resources = Collections.singletonList(resource);
+
+ if (buildSchemas) {
+ List<File> configs = (xmlConfigs == null || xmlConfigs.isEmpty()) ? Collections.emptyList()
+ : Stream.of(xmlConfigs.split(",")).flatMap(s ->
+ Stream.of(new File(s), new File(base, s)).filter(File::exists)
+ ).collect(Collectors.toList());
+
+ List<File> classPathList = new ArrayList<>();
+ List<URL> urls = new ArrayList<>();
+ if (classPath != null) {
+ for (String classpathElement : classPath.split(",")) {
+ File file = new File(classpathElement);
+ classPathList.add(file);
+ try {
+ urls.add(file.toURI().toURL());
+ } catch (MalformedURLException e) {
+ throw new MojoFailureException("invalid classpath: "+file, e);
+ }
+ }
+ }
+ ClassLoader cl = new URLClassLoader(urls.toArray(new URL[0]));
+ EntityResolver entityResolver = MavenPluginResolver.getResolver(catalogLocation);
+ URI sourceDirURI = new File(sourceDir).toURI();
+ entityResolver = new PassThroughResolver(cl, entityResolver, sourceDirURI, baseSchemaLocation);
+
+ Parameters params = new Parameters();
+ if (!xsds.isEmpty()) {
+ params.setXsdFiles(xsds.toArray(new File[0]));
+ }
+ if (!wsdls.isEmpty()) {
+ params.setWsdlFiles(wsdls.toArray(new File[0]));
+ }
+ if (!configs.isEmpty()) {
+ params.setConfigFiles(configs.toArray(new File[0]));
+ }
+ if (!classPathList.isEmpty()) {
+ params.setClasspath(classPathList.toArray(new File[0]));
+ }
+ params.setName(name);
+ params.setSrcDir(new File(javaTargetDir));
+ params.setClassesDir(new File(classTargetDir));
+ params.setNojavac(true);
+ params.setVerbose(verbose);
+ params.setEntityResolver(entityResolver);
+ params.setQuiet(quite);
+ params.setNoUpa(noUpa);
+ params.setNoPvr(noPvr);
+ params.setNoAnn(noAnn);
+ params.setNoVDoc(noVDoc);
+ if (repackage != null && !repackage.isEmpty()) {
+ params.setRepackage("org.apache.xmlbeans.metadata:"+repackage);
+ }
+ if (mdefNamespaces != null && !mdefNamespaces.isEmpty()) {
+ params.setMdefNamespaces(new HashSet<>(Arrays.asList(mdefNamespaces.split(","))));
+ }
+ List<XmlError> errorList = new ArrayList<>();
+ params.setErrorListener(errorList);
+
+ if (partialMethods != null && !partialMethods.isEmpty()) {
+ params.setPartialMethods(parsePartialMethods(partialMethods));
+ }
+// params.setBaseDir(null);
+// params.setJavaFiles(new File[0]);
+// params.setCompiler(null);
+// params.setMemoryInitialSize(null);
+// params.setMemoryMaximumSize(null);
+// params.setOutputJar(null);
+// params.setDownload(false);
+// params.setDebug(debug);
+// params.setExtensions(null);
+
+ boolean result = SchemaCompiler.compile(params);
+
+ if (!result) {
+ throw new MojoFailureException("Schema compilation failed!\n"+
+ errorList.stream().map(XmlError::toString).collect(Collectors.joining("\n"))
+ );
+ }
+
+ Resource genResource = new Resource();
+ genResource.setDirectory(classTargetDir);
+ project.addResource(genResource);
+ project.addCompileSourceRoot(javaTargetDir);
+ }
+
+ }
+
+ private static class PassThroughResolver implements EntityResolver {
+ private final ClassLoader cl;
+ private final EntityResolver delegate;
+ private final URI sourceDir;
+ //this copy has an / appended
+ private final String baseSchemaLocation;
+
+ public PassThroughResolver(ClassLoader cl, EntityResolver delegate, URI sourceDir, String baseSchemaLocation) {
+ this.cl = cl;
+ this.delegate = delegate;
+ this.sourceDir = sourceDir;
+ this.baseSchemaLocation = baseSchemaLocation + "/";
+ }
+
+ public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
+ if (delegate != null) {
+ InputSource is = delegate.resolveEntity(publicId, systemId);
+ if (is != null) {
+ return is;
+ }
+ }
+ System.out.println("Could not resolve publicId: " + publicId + ", systemId: " + systemId + " from catalog");
+ String localSystemId;
+ try {
+ localSystemId = sourceDir.relativize(new URI(systemId)).toString();
+ } catch (URISyntaxException e) {
+ throw new IOException("Could not relativeize systemId", e);
+ }
+ InputStream in = cl.getResourceAsStream(localSystemId);
+ if (in != null) {
+ System.out.println("found in classpath at: " + localSystemId);
+ return new InputSource(in);
+ }
+ in = cl.getResourceAsStream(baseSchemaLocation + localSystemId);
+ if (in != null) {
+ System.out.println("found in classpath at: META-INF/" + localSystemId);
+ return new InputSource(in);
+ }
+ System.out.println("Not found in classpath, looking in current directory: " + systemId);
+ return new InputSource(systemId);
+ }
+ }
+
+}
diff --git a/src/main/java/org/apache/xmlbeans/impl/tool/MavenPluginHelp.java b/src/main/java/org/apache/xmlbeans/impl/tool/MavenPluginHelp.java
new file mode 100644
index 0000000..cc491f1
--- /dev/null
+++ b/src/main/java/org/apache/xmlbeans/impl/tool/MavenPluginHelp.java
@@ -0,0 +1,378 @@
+/* Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.xmlbeans.impl.tool;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Display help information on xmlbeans-maven-plugin.<br>
+ * Call <code>mvn xmlbeans.plugin:help -Ddetail=true -Dgoal=<goal-name></code> to display parameter details.
+ */
+@Mojo(name = "help", requiresProject = false, threadSafe = true)
+public class MavenPluginHelp extends AbstractMojo {
+ // ******************************************************************************************
+ // As we don't use the maven plugin-plugin, the defaultValues and others need to be manually
+ // copied into resources/maven/plugin-help.xml
+ // ******************************************************************************************
+
+
+ /**
+ * If <code>true</code>, display all settable properties for each goal.
+ */
+ @Parameter(property = "detail", defaultValue = "false")
+ private boolean detail;
+
+ /**
+ * The name of the goal for which to show help. If unspecified, all goals will be displayed.
+ */
+ @Parameter(property = "goal")
+ private java.lang.String goal;
+
+ /**
+ * The maximum length of a display line, should be positive.
+ */
+ @Parameter(property = "lineLength", defaultValue = "80")
+ private int lineLength;
+
+ /**
+ * The number of spaces per indentation level, should be positive.
+ */
+ @Parameter(property = "indentSize", defaultValue = "2")
+ private int indentSize;
+
+ // groupId/artifactId/plugin-help.xml
+ private static final String PLUGIN_HELP_PATH = "/META-INF/maven/plugin.xml";
+
+ private static final int DEFAULT_LINE_LENGTH = 80;
+
+ private Document build() throws MojoExecutionException {
+ getLog().debug("load plugin-help.xml: " + PLUGIN_HELP_PATH);
+ try (InputStream is = getClass().getResourceAsStream(PLUGIN_HELP_PATH)) {
+ DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
+ return dBuilder.parse(is);
+ } catch (IOException | ParserConfigurationException | SAXException e) {
+ throw new MojoExecutionException(e.getMessage(), e);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void execute() throws MojoExecutionException {
+ if (lineLength <= 0) {
+ getLog().warn("The parameter 'lineLength' should be positive, using '80' as default.");
+ lineLength = DEFAULT_LINE_LENGTH;
+ }
+ if (indentSize <= 0) {
+ getLog().warn("The parameter 'indentSize' should be positive, using '2' as default.");
+ indentSize = 2;
+ }
+
+ Document doc = build();
+
+ StringBuilder sb = new StringBuilder();
+ Node plugin = getSingleChild(doc, "plugin");
+
+
+ String name = getValue(plugin, "name");
+ String version = getValue(plugin, "version");
+ String id = getValue(plugin, "groupId") + ":" + getValue(plugin, "artifactId") + ":" + version;
+ if (isNotEmpty(name) && !name.contains(id)) {
+ append(sb, name + " " + version, 0);
+ } else {
+ if (isNotEmpty(name)) {
+ append(sb, name, 0);
+ } else {
+ append(sb, id, 0);
+ }
+ }
+ append(sb, getValue(plugin, "description"), 1);
+ append(sb, "", 0);
+
+ //<goalPrefix>plugin</goalPrefix>
+ String goalPrefix = getValue(plugin, "goalPrefix");
+
+ Node mojos1 = getSingleChild(plugin, "mojos");
+
+ List<Node> mojos = findNamedChild(mojos1, "mojo");
+
+ if (goal == null || goal.length() <= 0) {
+ append(sb, "This plugin has " + mojos.size() + (mojos.size() > 1 ? " goals:" : " goal:"), 0);
+ append(sb, "", 0);
+ }
+
+ for (Node mojo : mojos) {
+ writeGoal(sb, goalPrefix, (Element) mojo);
+ }
+
+ if (getLog().isInfoEnabled()) {
+ getLog().info(sb.toString());
+ }
+ }
+
+
+ private static boolean isNotEmpty(String string) {
+ return string != null && string.length() > 0;
+ }
+
+ private String getValue(Node node, String elementName)
+ throws MojoExecutionException {
+ return getSingleChild(node, elementName).getTextContent();
+ }
+
+ private Node getSingleChild(Node node, String elementName)
+ throws MojoExecutionException {
+ List<Node> namedChild = findNamedChild(node, elementName);
+ if (namedChild.isEmpty()) {
+ throw new MojoExecutionException("Could not find " + elementName + " in plugin-help.xml");
+ }
+ if (namedChild.size() > 1) {
+ throw new MojoExecutionException("Multiple " + elementName + " in plugin-help.xml");
+ }
+ return namedChild.get(0);
+ }
+
+ private List<Node> findNamedChild(Node node, String elementName) {
+ List<Node> result = new ArrayList<>();
+ NodeList childNodes = node.getChildNodes();
+ for (int i = 0; i < childNodes.getLength(); i++) {
+ Node item = childNodes.item(i);
+ if (elementName.equals(item.getNodeName())) {
+ result.add(item);
+ }
+ }
+ return result;
+ }
+
+ private Node findSingleChild(Node node, String elementName)
+ throws MojoExecutionException {
+ List<Node> elementsByTagName = findNamedChild(node, elementName);
+ if (elementsByTagName.isEmpty()) {
+ return null;
+ }
+ if (elementsByTagName.size() > 1) {
+ throw new MojoExecutionException("Multiple " + elementName + "in plugin-help.xml");
+ }
+ return elementsByTagName.get(0);
+ }
+
+ private void writeGoal(StringBuilder sb, String goalPrefix, Element mojo)
+ throws MojoExecutionException {
+ String mojoGoal = getValue(mojo, "goal");
+ Node configurationElement = findSingleChild(mojo, "configuration");
+ Node description = findSingleChild(mojo, "description");
+ if (goal == null || goal.length() <= 0 || mojoGoal.equals(goal)) {
+ append(sb, goalPrefix + ":" + mojoGoal, 0);
+ Node deprecated = findSingleChild(mojo, "deprecated");
+ if ((deprecated != null) && isNotEmpty(deprecated.getTextContent())) {
+ append(sb, "Deprecated. " + deprecated.getTextContent(), 1);
+ if (detail && description != null) {
+ append(sb, "", 0);
+ append(sb, description.getTextContent(), 1);
+ }
+ } else if (description != null) {
+ append(sb, description.getTextContent(), 1);
+ }
+ append(sb, "", 0);
+
+ if (detail) {
+ Node parametersNode = getSingleChild(mojo, "parameters");
+ List<Node> parameters = findNamedChild(parametersNode, "parameter");
+ append(sb, "Available parameters:", 1);
+ append(sb, "", 0);
+
+ for (Node parameter : parameters) {
+ writeParameter(sb, parameter, configurationElement);
+ }
+ }
+ }
+ }
+
+ private void writeParameter(StringBuilder sb, Node parameter, Node configurationElement)
+ throws MojoExecutionException {
+ String parameterName = getValue(parameter, "name");
+ String parameterDescription = getValue(parameter, "description");
+
+ Element fieldConfigurationElement = null;
+ if (configurationElement != null) {
+ fieldConfigurationElement = (Element) findSingleChild(configurationElement, parameterName);
+ }
+
+ String parameterDefaultValue = "";
+ if (fieldConfigurationElement != null && fieldConfigurationElement.hasAttribute("default-value")) {
+ parameterDefaultValue = " (Default: " + fieldConfigurationElement.getAttribute("default-value") + ")";
+ }
+ append(sb, parameterName + parameterDefaultValue, 2);
+ Node deprecated = findSingleChild(parameter, "deprecated");
+ if ((deprecated != null) && isNotEmpty(deprecated.getTextContent())) {
+ append(sb, "Deprecated. " + deprecated.getTextContent(), 3);
+ append(sb, "", 0);
+ }
+ append(sb, parameterDescription, 3);
+ if ("true".equals(getValue(parameter, "required"))) {
+ append(sb, "Required: Yes", 3);
+ }
+ if ((fieldConfigurationElement != null) && isNotEmpty(fieldConfigurationElement.getTextContent())) {
+ String property = getPropertyFromExpression(fieldConfigurationElement.getTextContent());
+ append(sb, "User property: " + property, 3);
+ }
+
+ append(sb, "", 0);
+ }
+
+ /**
+ * <p>Repeat a String <code>n</code> times to form a new string.</p>
+ *
+ * @param str String to repeat
+ * @param repeat number of times to repeat str
+ * @return String with repeated String
+ * @throws NegativeArraySizeException if <code>repeat < 0</code>
+ * @throws NullPointerException if str is <code>null</code>
+ */
+ private static String repeat(String str, int repeat) {
+ StringBuilder buffer = new StringBuilder(repeat * str.length());
+
+ for (int i = 0; i < repeat; i++) {
+ buffer.append(str);
+ }
+
+ return buffer.toString();
+ }
+
+ /**
+ * Append a description to the buffer by respecting the indentSize and lineLength parameters.
+ * <b>Note</b>: The last character is always a new line.
+ *
+ * @param sb The buffer to append the description, not <code>null</code>.
+ * @param description The description, not <code>null</code>.
+ * @param indent The base indentation level of each line, must not be negative.
+ */
+ private void append(StringBuilder sb, String description, int indent) {
+ for (String line : toLines(description, indent, indentSize, lineLength)) {
+ sb.append(line).append('\n');
+ }
+ }
+
+ /**
+ * Splits the specified text into lines of convenient display length.
+ *
+ * @param text The text to split into lines, must not be <code>null</code>.
+ * @param indent The base indentation level of each line, must not be negative.
+ * @param indentSize The size of each indentation, must not be negative.
+ * @param lineLength The length of the line, must not be negative.
+ * @return The sequence of display lines, never <code>null</code>.
+ * @throws NegativeArraySizeException if <code>indent < 0</code>
+ */
+ private static List<String> toLines(String text, int indent, int indentSize, int lineLength) {
+ List<String> lines = new ArrayList<>();
+
+ String ind = repeat("\t", indent);
+
+ String[] plainLines = text.split("(\r\n)|(\r)|(\n)");
+
+ for (String plainLine : plainLines) {
+ toLines(lines, ind + plainLine, indentSize, lineLength);
+ }
+
+ return lines;
+ }
+
+ /**
+ * Adds the specified line to the output sequence, performing line wrapping if necessary.
+ *
+ * @param lines The sequence of display lines, must not be <code>null</code>.
+ * @param line The line to add, must not be <code>null</code>.
+ * @param indentSize The size of each indentation, must not be negative.
+ * @param lineLength The length of the line, must not be negative.
+ */
+ private static void toLines(List<String> lines, String line, int indentSize, int lineLength) {
+ int lineIndent = getIndentLevel(line);
+ StringBuilder buf = new StringBuilder(256);
+
+ String[] tokens = line.split(" +");
+
+ for (String token : tokens) {
+ if (buf.length() > 0) {
+ if (buf.length() + token.length() >= lineLength) {
+ lines.add(buf.toString());
+ buf.setLength(0);
+ buf.append(repeat(" ", lineIndent * indentSize));
+ } else {
+ buf.append(' ');
+ }
+ }
+
+ for (int j = 0; j < token.length(); j++) {
+ char c = token.charAt(j);
+ if (c == '\t') {
+ buf.append(repeat(" ", indentSize - buf.length() % indentSize));
+ } else if (c == '\u00A0') {
+ buf.append(' ');
+ } else {
+ buf.append(c);
+ }
+ }
+ }
+ lines.add(buf.toString());
+ }
+
+ /**
+ * Gets the indentation level of the specified line.
+ *
+ * @param line The line whose indentation level should be retrieved, must not be <code>null</code>.
+ * @return The indentation level of the line.
+ */
+ private static int getIndentLevel(String line) {
+ int level = 0;
+ for (int i = 0; i < line.length() && line.charAt(i) == '\t'; i++) {
+ level++;
+ }
+ for (int i = level + 1; i <= level + 4 && i < line.length(); i++) {
+ if (line.charAt(i) == '\t') {
+ level++;
+ break;
+ }
+ }
+ return level;
+ }
+
+ private String getPropertyFromExpression(String expression) {
+ if (expression != null && expression.startsWith("${") && expression.endsWith("}")
+ && !expression.substring(2).contains("${")) {
+ // expression="${xxx}" -> property="xxx"
+ return expression.substring(2, expression.length() - 1);
+ }
+ // no property can be extracted
+ return null;
+ }
+}
diff --git a/src/main/java/org/apache/xmlbeans/impl/tool/MavenPluginResolver.java b/src/main/java/org/apache/xmlbeans/impl/tool/MavenPluginResolver.java
new file mode 100644
index 0000000..a707fc0
--- /dev/null
+++ b/src/main/java/org/apache/xmlbeans/impl/tool/MavenPluginResolver.java
@@ -0,0 +1,34 @@
+/* Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.xmlbeans.impl.tool;
+
+import com.sun.org.apache.xml.internal.resolver.CatalogManager;
+import com.sun.org.apache.xml.internal.resolver.tools.CatalogResolver;
+import org.xml.sax.EntityResolver;
+
+/**
+ * Helper class for XML catalogs, which is provided as Java 8 and Java 9+ version (multi release)
+ */
+public class MavenPluginResolver {
+ public static EntityResolver getResolver(String catalogLocation) {
+ if (catalogLocation == null) {
+ return null;
+ }
+ CatalogManager catalogManager = CatalogManager.getStaticManager();
+ catalogManager.setCatalogFiles(catalogLocation);
+ return new CatalogResolver(catalogManager);
+ }
+}
diff --git a/src/main/java/org/apache/xmlbeans/impl/tool/SchemaCompiler.java b/src/main/java/org/apache/xmlbeans/impl/tool/SchemaCompiler.java
index 164c1c1..8411e2b 100644
--- a/src/main/java/org/apache/xmlbeans/impl/tool/SchemaCompiler.java
+++ b/src/main/java/org/apache/xmlbeans/impl/tool/SchemaCompiler.java
@@ -639,7 +639,7 @@
long start = System.currentTimeMillis();
- // Calculate the usenames based on the relativized filenames on the filesystem
+ // Calculate the basenames based on the relativized filenames on the filesystem
if (baseDir == null) {
String userDir = SystemProperties.getProperty("user.dir");
assert (userDir != null);
@@ -686,6 +686,7 @@
options.setSchemaCodePrinter(codePrinter);
}
options.setCompilePartialMethod(partialMethods);
+ options.setCompileNoAnnotations(noAnn);
// save .xsb files
system.save(filer);
diff --git a/src/main/java/org/apache/xmlbeans/impl/tool/XMLBean.java b/src/main/java/org/apache/xmlbeans/impl/tool/XMLBean.java
index ecb4d82..e7736b5 100644
--- a/src/main/java/org/apache/xmlbeans/impl/tool/XMLBean.java
+++ b/src/main/java/org/apache/xmlbeans/impl/tool/XMLBean.java
@@ -46,6 +46,7 @@
* for instructions on FileSets if you are unfamiliar with their usage.
*/
+@SuppressWarnings("unused")
public class XMLBean extends MatchingTask {
private final List<FileSet> schemas = new ArrayList<>();
@@ -101,7 +102,7 @@
//required
if (schemas.size() == 0
&& schema == null
- && fileset.getDir(project) == null) {
+ && fileset.getDir(getProject()) == null) {
String msg = "The 'schema' or 'dir' attribute or a nested fileset is required.";
if (failonerror) {
throw new BuildException(msg);
@@ -129,12 +130,12 @@
}
}
- if (fileset.getDir(project) != null) {
+ if (fileset.getDir(getProject()) != null) {
schemas.add(fileset);
}
for (FileSet fs : schemas) {
- FileScanner scanner = fs.getDirectoryScanner(project);
+ FileScanner scanner = fs.getDirectoryScanner(getProject());
File basedir = scanner.getBasedir();
String[] paths = scanner.getIncludedFiles();
@@ -190,7 +191,7 @@
// use the system classpath if user didn't provide any
if (classpath == null) {
- classpath = new Path(project);
+ classpath = new Path(getProject());
classpath.concatSystemClasspath();
}
@@ -239,7 +240,7 @@
// compile the source
Javac javac = new Javac();
- javac.setProject(project);
+ javac.setProject(getProject());
javac.setTaskName(getTaskName());
javac.setClasspath(classpath);
if (compiler != null) {
@@ -258,7 +259,7 @@
javac.setIncludeantruntime(includeAntRuntime);
javac.setIncludejavaruntime(includeJavaRuntime);
javac.setNowarn(nowarn);
- javac.setSrcdir(new Path(project, srcgendir.getAbsolutePath()));
+ javac.setSrcdir(new Path(getProject(), srcgendir.getAbsolutePath()));
if (memoryInitialSize != null) {
javac.setMemoryInitialSize(memoryInitialSize);
}
@@ -277,7 +278,7 @@
if (destfile != null) {
// jar the compiled classes
Jar jar = new Jar();
- jar.setProject(project);
+ jar.setProject(getProject());
jar.setTaskName(getTaskName());
jar.setBasedir(classgendir);
jar.setDestFile(destfile);
@@ -363,7 +364,7 @@
*/
public Path createClasspath() {
if (classpath == null) {
- classpath = new Path(project);
+ classpath = new Path(getProject());
}
return classpath.createPath();
}
@@ -375,7 +376,7 @@
*/
public void setClasspathRef(Reference classpathref) {
if (classpath == null) {
- classpath = new Path(project);
+ classpath = new Path(getProject());
}
classpath.createPath().setRefid(classpathref);
@@ -803,7 +804,7 @@
public ErrorLogger(boolean noisy) {
_noisy = noisy;
- _baseURI = uriFromFile(project.getBaseDir());
+ _baseURI = uriFromFile(getProject().getBaseDir());
}
public boolean add(XmlError err) {
diff --git a/src/main/java/org/apache/xmlbeans/impl/xpath/saxon/SaxonXPathEngine.java b/src/main/java/org/apache/xmlbeans/impl/xpath/saxon/SaxonXPathEngine.java
index ba64c5e..3a28ebf 100644
--- a/src/main/java/org/apache/xmlbeans/impl/xpath/saxon/SaxonXPathEngine.java
+++ b/src/main/java/org/apache/xmlbeans/impl/xpath/saxon/SaxonXPathEngine.java
@@ -32,7 +32,7 @@
public class SaxonXPathEngine extends XPathExecutionContext implements XPathEngine {
// full datetime format: yyyy-MM-dd'T'HH:mm:ss'Z'
- private final DateFormat xmlDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+ private final DateFormat xmlDateFormat = new SimpleDateFormat("yyyy-MM-dd", java.util.Locale.ROOT);
private Cur _cur;
private SaxonXPath _engine;
diff --git a/src/main/multimodule/java9/org/apache/xmlbeans/impl/tool/MavenPluginResolver.class b/src/main/multimodule/java9/org/apache/xmlbeans/impl/tool/MavenPluginResolver.class
new file mode 100644
index 0000000..7534b04
--- /dev/null
+++ b/src/main/multimodule/java9/org/apache/xmlbeans/impl/tool/MavenPluginResolver.class
Binary files differ
diff --git a/src/main/multimodule/java9/org/apache/xmlbeans/impl/tool/MavenPluginResolver.java b/src/main/multimodule/java9/org/apache/xmlbeans/impl/tool/MavenPluginResolver.java
new file mode 100644
index 0000000..2152a98
--- /dev/null
+++ b/src/main/multimodule/java9/org/apache/xmlbeans/impl/tool/MavenPluginResolver.java
@@ -0,0 +1,40 @@
+/* Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.xmlbeans.impl.tool;
+
+import org.xml.sax.EntityResolver;
+
+import javax.xml.catalog.Catalog;
+import javax.xml.catalog.CatalogFeatures;
+import javax.xml.catalog.CatalogManager;
+import java.io.File;
+
+/**
+ * Helper class for XML catalogs, which is provided as Java 8 and Java 9+ version (multi release)
+ */
+public class MavenPluginResolver {
+ public static EntityResolver getResolver(String catalogLocation) {
+ if (catalogLocation == null) {
+ return null;
+ }
+
+ CatalogFeatures features = CatalogFeatures.builder()
+ .with(CatalogFeatures.Feature.PREFER, "system")
+ .build();
+ Catalog catalog = CatalogManager.catalog(features, new File(catalogLocation).toURI());
+ return CatalogManager.catalogResolver(catalog);
+ }
+}
diff --git a/src/main/resources/maven/pom.xml b/src/main/resources/maven/org.apache.xmlbeans/xmlbeans/pom.xml
similarity index 84%
rename from src/main/resources/maven/pom.xml
rename to src/main/resources/maven/org.apache.xmlbeans/xmlbeans/pom.xml
index eab851b..2765537 100644
--- a/src/main/resources/maven/pom.xml
+++ b/src/main/resources/maven/org.apache.xmlbeans/xmlbeans/pom.xml
@@ -100,6 +100,26 @@
<version>3.18.0</version>
<scope>provided</scope>
</dependency>
+
+ <!-- dependencies for xmlbeans maven plugin -->
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>3.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-model</artifactId>
+ <version>3.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-annotations</artifactId>
+ <version>3.4</version>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<profiles>
diff --git a/src/main/resources/maven/plugin.xml b/src/main/resources/maven/plugin.xml
new file mode 100644
index 0000000..a68020c
--- /dev/null
+++ b/src/main/resources/maven/plugin.xml
@@ -0,0 +1,484 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+
+<plugin>
+ <name>xmlbeans</name>
+ <description></description>
+ <groupId>org.apache.xmlbeans</groupId>
+ <artifactId>xmlbeans</artifactId>
+ <version>@VERSION@</version>
+ <goalPrefix>xmlbeans.plugin</goalPrefix>
+ <isolatedRealm>false</isolatedRealm>
+ <inheritedByDefault>true</inheritedByDefault>
+ <mojos>
+ <mojo>
+ <goal>help</goal>
+ <description>Display help information on xmlbeans-maven-plugin.<br>
+ Call <code>mvn xmlbeans.plugin:help -Ddetail=true -Dgoal=&lt;goal-name&gt;</code> to display parameter details.</description>
+ <requiresDirectInvocation>false</requiresDirectInvocation>
+ <requiresProject>false</requiresProject>
+ <requiresReports>false</requiresReports>
+ <aggregator>false</aggregator>
+ <requiresOnline>false</requiresOnline>
+ <inheritedByDefault>true</inheritedByDefault>
+ <implementation>org.apache.xmlbeans.impl.tool.MavenPluginHelp</implementation>
+ <language>java</language>
+ <instantiationStrategy>per-lookup</instantiationStrategy>
+ <executionStrategy>once-per-session</executionStrategy>
+ <threadSafe>true</threadSafe>
+ <parameters>
+ <parameter>
+ <name>detail</name>
+ <type>boolean</type>
+ <required>false</required>
+ <editable>true</editable>
+ <description>If <code>true</code>, display all settable properties for each goal.</description>
+ </parameter>
+ <parameter>
+ <name>goal</name>
+ <type>java.lang.String</type>
+ <required>false</required>
+ <editable>true</editable>
+ <description>The name of the goal for which to show help. If unspecified, all goals will be displayed.</description>
+ </parameter>
+ <parameter>
+ <name>indentSize</name>
+ <type>int</type>
+ <required>false</required>
+ <editable>true</editable>
+ <description>The number of spaces per indentation level, should be positive.</description>
+ </parameter>
+ <parameter>
+ <name>lineLength</name>
+ <type>int</type>
+ <required>false</required>
+ <editable>true</editable>
+ <description>The maximum length of a display line, should be positive.</description>
+ </parameter>
+ </parameters>
+ <configuration>
+ <detail implementation="boolean" default-value="false">${detail}</detail>
+ <goal implementation="java.lang.String">${goal}</goal>
+ <indentSize implementation="int" default-value="2">${indentSize}</indentSize>
+ <lineLength implementation="int" default-value="80">${lineLength}</lineLength>
+ </configuration>
+ </mojo>
+ <mojo>
+ <goal>compile</goal>
+ <requiresDirectInvocation>false</requiresDirectInvocation>
+ <requiresProject>false</requiresProject>
+ <requiresReports>false</requiresReports>
+ <aggregator>false</aggregator>
+ <requiresOnline>false</requiresOnline>
+ <inheritedByDefault>true</inheritedByDefault>
+ <phase>generate-sources</phase>
+ <executePhase>generate-sources</executePhase>
+ <executeGoal>compile</executeGoal>
+ <implementation>org.apache.xmlbeans.impl.tool.MavenPlugin</implementation>
+ <language>java</language>
+ <instantiationStrategy>per-lookup</instantiationStrategy>
+ <executionStrategy>once-per-session</executionStrategy>
+ <threadSafe>false</threadSafe>
+ <parameters>
+ <parameter>
+ <name>project</name>
+ <type>org.apache.maven.project.MavenProject</type>
+ <required>true</required>
+ <editable>false</editable>
+ <description>reference to the project</description>
+ </parameter>
+ <parameter>
+ <name>baseSchemaLocation</name>
+ <type>java.lang.String</type>
+ <required>false</required>
+ <editable>true</editable>
+ <description>destination directory of the copied xsd files</description>
+ </parameter>
+ <parameter>
+ <name>buildSchemas</name>
+ <type>boolean</type>
+ <required>false</required>
+ <editable>true</editable>
+ <description>buildSchemas sets build process of the generated sources</description>
+ </parameter>
+ <parameter>
+ <name>catalogLocation</name>
+ <type>java.lang.String</type>
+ <required>false</required>
+ <editable>true</editable>
+ <description>catalogLocation is the location of an entity resolver catalog to use for resolving namespace to schema locations.</description>
+ </parameter>
+ <parameter>
+ <name>classPath</name>
+ <type>java.lang.String</type>
+ <required>false</required>
+ <editable>true</editable>
+ <description></description>
+ </parameter>
+ <parameter>
+ <name>classTargetDir</name>
+ <type>java.lang.String</type>
+ <required>false</required>
+ <editable>true</editable>
+ <description>classTargetDir is where you want compiled class files to appear</description>
+ </parameter>
+ <parameter>
+ <name>javaTargetDir</name>
+ <type>java.lang.String</type>
+ <required>false</required>
+ <editable>true</editable>
+ <description>javaTargetdir is where you want generated java source to appear</description>
+ </parameter>
+ <parameter>
+ <name>resources</name>
+ <type>java.util.List</type>
+ <required>false</required>
+ <editable>true</editable>
+ <description></description>
+ </parameter>
+ <parameter>
+ <name>sourceDir</name>
+ <type>java.lang.String</type>
+ <required>false</required>
+ <editable>true</editable>
+ <description>sourceDir is a base directory for the list in sourceschema</description>
+ </parameter>
+ <parameter>
+ <name>sourceSchemas</name>
+ <type>java.lang.String</type>
+ <required>false</required>
+ <editable>true</editable>
+ <description>sourceSchemas is a comma-delimited list of all the schemas you want to compile</description>
+ </parameter>
+ <parameter>
+ <name>xmlConfigs</name>
+ <type>java.lang.String</type>
+ <required>false</required>
+ <editable>true</editable>
+ <description>xmlConfigs points to your xmlconfig.xml file</description>
+ </parameter>
+ <parameter>
+ <name>name</name>
+ <type>java.lang.String</type>
+ <required>false</required>
+ <editable>true</editable>
+ <description>schema system name</description>
+ </parameter>
+ <parameter>
+ <name>repackage</name>
+ <type>java.lang.String</type>
+ <required>false</required>
+ <editable>true</editable>
+ <description>Metadata package name. If explicitly set empty, generates to org.apache.xmlbeans.metadata</description>
+ </parameter>
+ <parameter>
+ <name>mdefNamespaces</name>
+ <type>java.lang.String</type>
+ <required>false</required>
+ <editable>true</editable>
+ <description>
+ If this option is set, then the schema compiler will permit and
+ ignore multiple definitions of the same component (element, attribute,
+ type, etc) names in the given namespaces. If multiple definitions
+ with the same name appear, the definitions that happen to be processed
+ last will be ignored.
+
+ a comma-seperated list of namespace URIs
+ </description>
+ </parameter>
+ <parameter>
+ <name>partialMethods</name>
+ <type>java.lang.String</type>
+ <required>false</required>
+ <editable>true</editable>
+ <description>
+ Only generate a subset of the bean methods. Comma-seperated list of the following method types:
+ GET, XGET, IS_SET, IS_NIL, IS_NIL_IDX, SET, SET_NIL, SET_NIL_IDX, XSET, UNSET,
+ GET_ARRAY, XGET_ARRAY, GET_IDX, XGET_IDX, XSET_ARRAY, XSET_IDX,
+ SIZE_OF_ARRAY, SET_ARRAY, SET_IDX,
+ INSERT_IDX, INSERT_NEW_IDX,
+ ADD, ADD_NEW, REMOVE_IDX,
+ GET_LIST, XGET_LIST, SET_LIST,
+ INSTANCE_TYPE
+
+ Example: "ALL,-GET_LIST,-XGET_LIST" excludes GET_LIST and XGET_LIST methods
+ </description>
+ </parameter>
+ <parameter>
+ <name>verbose</name>
+ <type>boolean</type>
+ <required>false</required>
+ <editable>true</editable>
+ <description>verbose output</description>
+ </parameter>
+ <parameter>
+ <name>quite</name>
+ <type>boolean</type>
+ <required>false</required>
+ <editable>true</editable>
+ <description>no output</description>
+ </parameter>
+ <parameter>
+ <name>noUpa</name>
+ <type>boolean</type>
+ <required>false</required>
+ <editable>true</editable>
+ <description>deactivate unique particle attribution</description>
+ </parameter>
+ <parameter>
+ <name>noPvr</name>
+ <type>boolean</type>
+ <required>false</required>
+ <editable>true</editable>
+ <description>deactivate particle valid (restriction)</description>
+ </parameter>
+ <parameter>
+ <name>noAnn</name>
+ <type>boolean</type>
+ <required>false</required>
+ <editable>true</editable>
+ <description>deactivate annotation generation</description>
+ </parameter>
+ <parameter>
+ <name>noVDoc</name>
+ <type>boolean</type>
+ <required>false</required>
+ <editable>true</editable>
+ <description>do not validate contents of documentation-tags</description>
+ </parameter>
+ </parameters>
+ <configuration>
+ <project implementation="org.apache.maven.project.MavenProject" default-value="${project}"/>
+ <buildSchemas implementation="boolean" default-value="true"/>
+ <sourceDir implementation="java.lang.String" default-value="${project.basedir}/src/main/schema"/>
+ <sourceSchemas implementation="java.lang.String" default-value="*.xsd,*.wsdl"/>
+ <xmlConfigs implementation="java.lang.String" default-value="${project.basedir}/src/schema/xmlconfig.xml"/>
+ <javaTargetDir implementation="java.lang.String" default-value="${project.basedir}/target/generated-sources"/>
+ <classTargetDir implementation="java.lang.String" default-value="${project.basedir}/target/generated-resources"/>
+ <baseSchemaLocation implementation="java.lang.String" default-value="schemaorg_apache_xmlbeans/src"/>
+ <name implementation="java.lang.String" default-value="${project.artifactId}"/>
+ <repackage implementation="java.lang.String" default-value="${project.groupId}.${project.artifactId}.metadata"/>
+ <verbose implementation="boolean" default-value="false"/>
+ <quite implementation="boolean" default-value="true"/>
+ <noUpa implementation="boolean" default-value="false"/>
+ <noPvr implementation="boolean" default-value="false"/>
+ <noAnn implementation="boolean" default-value="false"/>
+ <noVDoc implementation="boolean" default-value="false"/>
+ </configuration>
+ </mojo>
+ </mojos>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>3.6.1</version>
+ </dependency>
+<!-- <dependency>-->
+<!-- <groupId>org.apache.maven</groupId>-->
+<!-- <artifactId>maven-model</artifactId>-->
+<!-- <version>3.6.1</version>-->
+<!-- </dependency>-->
+<!-- <dependency>-->
+<!-- <groupId>org.apache.maven</groupId>-->
+<!-- <artifactId>maven-artifact</artifactId>-->
+<!-- <version>3.6.1</version>-->
+<!-- </dependency>-->
+<!-- <dependency>-->
+<!-- <groupId>org.apache.commons</groupId>-->
+<!-- <artifactId>commons-lang3</artifactId>-->
+<!-- <version>3.8.1</version>-->
+<!-- </dependency>-->
+<!-- <dependency>-->
+<!-- <groupId>org.eclipse.sisu</groupId>-->
+<!-- <artifactId>org.eclipse.sisu.plexus</artifactId>-->
+<!-- <version>0.3.3</version>-->
+<!-- </dependency>-->
+<!-- <dependency>-->
+<!-- <groupId>javax.enterprise</groupId>-->
+<!-- <artifactId>cdi-api</artifactId>-->
+<!-- <version>1.0</version>-->
+<!-- </dependency>-->
+<!-- <dependency>-->
+<!-- <groupId>javax.annotation</groupId>-->
+<!-- <artifactId>jsr250-api</artifactId>-->
+<!-- <version>1.0</version>-->
+<!-- </dependency>-->
+<!-- <dependency>-->
+<!-- <groupId>javax.inject</groupId>-->
+<!-- <artifactId>javax.inject</artifactId>-->
+<!-- <version>1</version>-->
+<!-- </dependency>-->
+<!-- <dependency>-->
+<!-- <groupId>org.eclipse.sisu</groupId>-->
+<!-- <artifactId>org.eclipse.sisu.inject</artifactId>-->
+<!-- <version>0.3.3</version>-->
+<!-- </dependency>-->
+<!-- <dependency>-->
+<!-- <groupId>org.codehaus.plexus</groupId>-->
+<!-- <artifactId>plexus-component-annotations</artifactId>-->
+<!-- <version>1.5.5</version>-->
+<!-- </dependency>-->
+<!-- <dependency>-->
+<!-- <groupId>org.codehaus.plexus</groupId>-->
+<!-- <artifactId>plexus-utils</artifactId>-->
+<!-- <version>3.2.0</version>-->
+<!-- </dependency>-->
+<!-- <dependency>-->
+<!-- <groupId>org.codehaus.plexus</groupId>-->
+<!-- <artifactId>plexus-classworlds</artifactId>-->
+<!-- <version>2.6.0</version>-->
+<!-- </dependency>-->
+<!-- <dependency>-->
+<!-- <groupId>org.apache.maven.shared</groupId>-->
+<!-- <artifactId>file-management</artifactId>-->
+<!-- <version>3.0.0</version>-->
+<!-- </dependency>-->
+<!-- <dependency>-->
+<!-- <groupId>org.apache.maven.shared</groupId>-->
+<!-- <artifactId>maven-shared-io</artifactId>-->
+<!-- <version>3.0.0</version>-->
+<!-- </dependency>-->
+<!-- <dependency>-->
+<!-- <groupId>org.apache.maven</groupId>-->
+<!-- <artifactId>maven-compat</artifactId>-->
+<!-- <version>3.0</version>-->
+<!-- </dependency>-->
+<!-- <dependency>-->
+<!-- <groupId>org.apache.maven</groupId>-->
+<!-- <artifactId>maven-model-builder</artifactId>-->
+<!-- <version>3.0</version>-->
+<!-- </dependency>-->
+<!-- <dependency>-->
+<!-- <groupId>org.apache.maven</groupId>-->
+<!-- <artifactId>maven-settings</artifactId>-->
+<!-- <version>3.0</version>-->
+<!-- </dependency>-->
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-core</artifactId>
+ <version>3.0</version>
+ </dependency>
+<!-- <dependency>-->
+<!-- <groupId>org.apache.maven</groupId>-->
+<!-- <artifactId>maven-settings-builder</artifactId>-->
+<!-- <version>3.0</version>-->
+<!-- </dependency>-->
+<!-- <dependency>-->
+<!-- <groupId>org.apache.maven</groupId>-->
+<!-- <artifactId>maven-repository-metadata</artifactId>-->
+<!-- <version>3.0</version>-->
+<!-- </dependency>-->
+<!-- <dependency>-->
+<!-- <groupId>org.apache.maven</groupId>-->
+<!-- <artifactId>maven-aether-provider</artifactId>-->
+<!-- <version>3.0</version>-->
+<!-- </dependency>-->
+<!-- <dependency>-->
+<!-- <groupId>org.sonatype.aether</groupId>-->
+<!-- <artifactId>aether-impl</artifactId>-->
+<!-- <version>1.7</version>-->
+<!-- </dependency>-->
+<!-- <dependency>-->
+<!-- <groupId>org.sonatype.aether</groupId>-->
+<!-- <artifactId>aether-spi</artifactId>-->
+<!-- <version>1.7</version>-->
+<!-- </dependency>-->
+<!-- <dependency>-->
+<!-- <groupId>org.sonatype.aether</groupId>-->
+<!-- <artifactId>aether-api</artifactId>-->
+<!-- <version>1.7</version>-->
+<!-- </dependency>-->
+<!-- <dependency>-->
+<!-- <groupId>org.sonatype.aether</groupId>-->
+<!-- <artifactId>aether-util</artifactId>-->
+<!-- <version>1.7</version>-->
+<!-- </dependency>-->
+<!-- <dependency>-->
+<!-- <groupId>org.sonatype.plexus</groupId>-->
+<!-- <artifactId>plexus-sec-dispatcher</artifactId>-->
+<!-- <version>1.3</version>-->
+<!-- </dependency>-->
+<!-- <dependency>-->
+<!-- <groupId>org.sonatype.plexus</groupId>-->
+<!-- <artifactId>plexus-cipher</artifactId>-->
+<!-- <version>1.4</version>-->
+<!-- </dependency>-->
+<!-- <dependency>-->
+<!-- <groupId>org.codehaus.plexus</groupId>-->
+<!-- <artifactId>plexus-interpolation</artifactId>-->
+<!-- <version>1.14</version>-->
+<!-- </dependency>-->
+<!-- <dependency>-->
+<!-- <groupId>org.sonatype.sisu</groupId>-->
+<!-- <artifactId>sisu-inject-plexus</artifactId>-->
+<!-- <version>1.4.2</version>-->
+<!-- </dependency>-->
+<!-- <dependency>-->
+<!-- <groupId>org.sonatype.sisu</groupId>-->
+<!-- <artifactId>sisu-inject-bean</artifactId>-->
+<!-- <version>1.4.2</version>-->
+<!-- </dependency>-->
+<!-- <dependency>-->
+<!-- <groupId>org.sonatype.sisu</groupId>-->
+<!-- <artifactId>sisu-guice</artifactId>-->
+<!-- <version>2.1.7</version>-->
+<!-- </dependency>-->
+<!-- <dependency>-->
+<!-- <groupId>org.apache.maven.wagon</groupId>-->
+<!-- <artifactId>wagon-provider-api</artifactId>-->
+<!-- <version>2.10</version>-->
+<!-- </dependency>-->
+<!-- <dependency>-->
+<!-- <groupId>org.apache.maven.shared</groupId>-->
+<!-- <artifactId>maven-shared-utils</artifactId>-->
+<!-- <version>3.0.0</version>-->
+<!-- </dependency>-->
+<!-- <dependency>-->
+<!-- <groupId>commons-io</groupId>-->
+<!-- <artifactId>commons-io</artifactId>-->
+<!-- <version>2.4</version>-->
+<!-- </dependency>-->
+<!-- <dependency>-->
+<!-- <groupId>com.google.code.findbugs</groupId>-->
+<!-- <artifactId>jsr305</artifactId>-->
+<!-- <version>2.0.1</version>-->
+<!-- </dependency>-->
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-api</artifactId>
+ <version>2.14.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-core</artifactId>
+ <version>2.14.0</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.saxon</groupId>
+ <artifactId>Saxon-HE</artifactId>
+ <version>10.3</version>
+ </dependency>
+ <dependency>
+ <groupId>com.github.javaparser</groupId>
+ <artifactId>javaparser-core</artifactId>
+ <version>3.18.0</version>
+ </dependency>
+ </dependencies>
+</plugin>
\ No newline at end of file