Closed dmak closed 6 years ago
I'm encountering this also with 2.3. Our jenkins server uses an older version of svn that adds .svn
directories on checkout of a project that uses jaxb2-maven-plugin to every folder including my jaxb source folder. I've added .svn
to the excludes but it doesn't work.
This is actually a user exception, in that xml
files are normally ignored when placed under the src/main/xsd
directory.
The following settings are used by default.
src/main/xsd
directory (including subdirectories) is expected to contain XSD files. src/main/xsd
directory are ignored. These are files whose file names match any of the Java RegExp patterns "README.*", "\.xml", "\.txt", "\.java", "\.scala", "\.mdo".These settings can be modified as described below.
The standard behavior can be overridden by a sources
and / or xjcSourceExcludeFilters
element given within the plugin configuration.
sources
element be present, only the files or directories given as source
sub-elements are scanned.xjcSourceExcludeFilters
element be present only the given Filters should be used to exclude found files from being included within the XJC compilation.This is illustrated in the plugin documentation - but copied below for clarity:
<configuration>
<!--
Include the sources from 3 locations:
1) a directory (including recursively finding all files in it)
2) an explicitly named file
3) a non-existent path, which is silently ignored
-->
<sources>
<source>src/main/some/other/xsds</source>
<source>src/main/foo/gnat.xsd</source>
<source>src/main/a/nonexistent/path</source>
</sources>
<!--
When providing xjcSourceExcludeFilters, the default exclude
Filter definitions are overridden by the Patterns supplied.
Any filter whose path ends with any of the Java Regular Expression Patterns
supplied will be excluded from the XJC sources. In this example,
files found under any of the source directories will be excluded from XJC
processing if their full paths end with '.xsd' or '.foo'
-->
<xjcSourceExcludeFilters>
<filter implementation="org.codehaus.mojo.jaxb2.shared.filters.pattern.PatternFileFilter">
<patterns>
<pattern>\.xsd</pattern>
<pattern>\.foo</pattern>
</patterns>
</filter>
</xjcSourceExcludeFilters>
</configuration>
Suppose in
xsd
folder I have several XSD files, plus XML files. The following configuration causes problem:The output is:
XML file is included for compilation (even thought it is supposed to be filtered out by build-in exclusion pattern) and compilation fails. The goal does not support
<schemaSourceExcludeFilters>
which should help. However the best is that<source>
supports patterns (<source>xsd/*.xsd</source>
).