xml-maven-plugin-xml-maven-plugin-1.0.1/0000755000175000017500000000000012635321500017241 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/README.md0000644000175000017500000000072012635321500020517 0ustar eugeneeugen# MojoHaus XML Maven Plugin This is the [xml-maven-plugin](http://www.mojohaus.org/xml-maven-plugin/). [![Build Status](https://travis-ci.org/mojohaus/xml-maven-plugin.svg?branch=master)](https://travis-ci.org/mojohaus/xml-maven-plugin) ## Releasing * Make sure `gpg-agent` is running. * Execute `mvn -B release:prepare release:perform` For publishing the site do the following: ``` cd target/checkout mvn verify site site:stage scm-publish:publish-scm ``` xml-maven-plugin-xml-maven-plugin-1.0.1/.travis.yml0000644000175000017500000000040112635321500021345 0ustar eugeneeugenlanguage: java # Enable container-based infrastructure # see http://docs.travis-ci.com/user/workers/container-based-infrastructure/ sudo: false jdk: - openjdk6 - openjdk7 - oraclejdk8 cache: directories: - $HOME/.m2/repository script: - mvn clean verifyxml-maven-plugin-xml-maven-plugin-1.0.1/NOTICE.txt0000644000175000017500000000024512635321500020764 0ustar eugeneeugenMaven XML Plugin Copyright 2007 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). xml-maven-plugin-xml-maven-plugin-1.0.1/src/0000755000175000017500000000000012635321500020030 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/changes/0000755000175000017500000000000012635321500021440 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/changes/changes.xml0000644000175000017500000001513012635321500023572 0ustar eugeneeugen Changes in the Maven XML Plugin Fixed an NPE when specifying the schema via public ID. Wrong property name in documentation (transformation.html) Disabled proxy password logging. Also reduced logging level of proxy info from "info" to "debug". The ResourceManager is now used when loading stylesheets or resolving included files, thus enabling use of classpath resources. Documentation fix: Replace ReplaceRegExpFileMapper with RegExpFileMapper. Catalogs can now be specified as URL's, not only as files. The resolver does now attempt to use the namespace URI and not only the public ID. Add support for in-place transformation. Added catalog file example to the docs. External DTD's are no longer downloaded when checking for well formedness. Provide log output with log-level INFO for the processing of any input file. Added the possibility to set a transformers output properties. If a transformation sets or validation sets base directory is missing, then a warning is logged now, and the build no longer fails. This allows to configure the plugin in a parent POM. It is now configurable, whether the Resolver creates validating parsers. A parameter for specifying the transformer implementation has been added. Added support for the resource: protocol. Fixed a misleading error message. Add support for XSLT parameters when transforming. SAXSource is now used instead of StreamSource, in order to ensure that the resolver is used. XML schema validation wasn't turned on by the ValidateMojo. The plugin does now honor the Maven proxy settings. Added support for file mappers when transforming files. Added docs for using an XSLT 2.0 compliant processor. Added support for resolving resources through the classloader. Add use of the default excludes. Also add the configuration parameter skipDefaultExcludes for turning them off. Absolute paths have been unsupported. The plugin does now check, whether the generated files are uptodate. Initial release xml-maven-plugin-xml-maven-plugin-1.0.1/src/main/0000755000175000017500000000000012635321500020754 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/0000755000175000017500000000000012635321500021675 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/0000755000175000017500000000000012635321500022464 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/0000755000175000017500000000000012635321500024257 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/0000755000175000017500000000000012635321500025223 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/0000755000175000017500000000000012635321500026023 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/transformer/0000755000175000017500000000000012635321500030365 5ustar eugeneeugen././@LongLink0000644000000000000000000000015300000000000011602 Lustar rootrootxml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/transformer/NameValuePair.javaxml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/transformer/NameValuePai0000644000175000017500000000271212635321500032621 0ustar eugeneeugenpackage org.codehaus.mojo.xml.transformer; /* * 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. */ /** * An instance of this class is used to specify an output property. */ public class NameValuePair { private String name, value; /** * Returns the parameter name. */ public String getName() { return this.name; } /** * Sets the parameter name. */ public void setName( String pName ) { name = pName; } /** * Returns the parameter value. */ public String getValue() { return this.value; } /** * Sets the parameter value. */ public void setValue( String pValue ) { value = pValue; } } ././@LongLink0000644000000000000000000000015700000000000011606 Lustar rootrootxml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/transformer/TransformationSet.javaxml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/transformer/Transformati0000644000175000017500000001613412635321500032766 0ustar eugeneeugenpackage org.codehaus.mojo.xml.transformer; /* * 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. */ import java.io.File; import org.codehaus.plexus.components.io.filemappers.FileMapper; /** * An instance of this class is used to specify a set of files, which are transformed by a common XSLT stylesheet. */ public class TransformationSet { private String stylesheet; private File dir; private File outputDir; private boolean addedToClasspath; private String[] includes; private String[] excludes; private boolean skipDefaultExcludes; private String[] otherDepends; private NameValuePair[] parameters; private NameValuePair[] features; private NameValuePair[] attributes; private NameValuePair[] outputProperties; private FileMapper[] fileMappers; private boolean validating; /** * Sets patterns of files, which are being excluded from the transformation set. */ public void setExcludes( String[] pExcludes ) { excludes = pExcludes; } /** * Sets patterns of files, which are being included into the transformation set. */ public void setIncludes( String[] pIncludes ) { includes = pIncludes; } /** * Sets patterns of additional files, which are being considered for the uptodate check. */ public void setOtherDepends( String[] pOtherDepends ) { otherDepends = pOtherDepends; } /** * Sets the stylesheet parameters. */ public void setParameters( NameValuePair[] pParameters ) { parameters = pParameters; } /** * Returns a directory, which is scanned for files to transform. */ public File getDir() { return dir; } /** * Returns patterns of files, which are being excluded from the transformation set. */ public String[] getExcludes() { return excludes; } /** * Returns patterns of files, which are being included into the transformation set. */ public String[] getIncludes() { return includes; } /** * Returns patterns of additional files, which are being considered for the uptodate check. */ public String[] getOtherDepends() { return otherDepends; } /** * Returns the output directory, where the generated files are being placed. Defaults to * {project.build.directory}/generated-resources/xml/xslt. */ public File getOutputDir() { return outputDir; } /** * Returns the stylesheet parameters. */ public NameValuePair[] getParameters() { return parameters; } /** * Returns the XSLT stylesheet, which is being used to control the transformation. */ public String getStylesheet() { return stylesheet; } /** * Returns, whether the output directory is added to the classpath. Defaults to false. */ public boolean isAddedToClasspath() { return addedToClasspath; } /** * Returns, whether Maven's default excludes are being ignored. Defaults to false (Default excludes are being used). * * @return {@link #skipDefaultExcludes} */ public boolean isSkipDefaultExcludes() { return skipDefaultExcludes; } /** * Sets, whether the output directory is added to the classpath. Defaults to false. * * @param addedToClasspath true/false. */ public void setAddedToClasspath( boolean addedToClasspath ) { this.addedToClasspath = addedToClasspath; } /** * Sets the name of a directory, which is scanned for files to transform. */ public void setDir( File pDir ) { dir = pDir; } /** * Sets the output directory, where the generated files are being placed. Defaults to * {project.build.directory}/generated-resources/xml/xslt. */ public void setOutputDir( File pOutputDir ) { outputDir = pOutputDir; } /** * Sets, whether Maven's default excludes are being ignored. Defaults to false (Default excludes are being used). */ public void setSkipDefaultExcludes( boolean pSkipDefaultExcludes ) { skipDefaultExcludes = pSkipDefaultExcludes; } /** * Sets the XSLT stylesheet, which is being used to control the transformation. */ public void setStylesheet( String pStylesheet ) { stylesheet = pStylesheet; } /** * Returns a set of file mappers, which are being used to convert the generated files name. */ public FileMapper[] getFileMappers() { return fileMappers; } /** * Sets a set of file mappers, which are being used to convert the generated files name. */ public void setFileMappers( FileMapper[] pFileMappers ) { fileMappers = pFileMappers; } /** * Returns, whether the transformer should create validating XML parsers for reading XML documents. The default * value is false. */ public boolean isValidating() { return validating; } /** * Sets, whether the transformer should create validating XML parsers for reading XML documents. The default value * is false. */ public void setValidating( boolean pValidating ) { validating = pValidating; } /** * Returns the transformers output properties. */ public NameValuePair[] getOutputProperties() { return outputProperties; } /** * Sets the transformers output properties. */ public void setOutputProperties( NameValuePair[] pOutputProperties ) { outputProperties = pOutputProperties; } /** * Returns the features, which should be set on the transformer factory. */ public NameValuePair[] getFeatures() { return features; } /** * Sets the features, which should be set on the transformer factory. */ public void setFeatures( NameValuePair[] pFeatures ) { features = pFeatures; } /** * Returns the attributes, which should be set on the transformer factory. */ public NameValuePair[] getAttributes() { return attributes; } /** * Sets the attributes, which should be set on the transformer factory. */ public void setAttributes( NameValuePair[] pAttributes ) { attributes = pAttributes; } } xml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/LSInputImpl.java0000644000175000017500000000507312635321500031053 0ustar eugeneeugenpackage org.codehaus.mojo.xml; /* * 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. */ import java.io.InputStream; import java.io.Reader; import org.w3c.dom.ls.LSInput; /** * Implementation of {@link LSInput}, for use by the {@link Resolver}. */ class LSInputImpl implements LSInput { private String baseURI, encoding, systemId, publicId, stringData; private InputStream byteStream; private Reader characterStream; private boolean certifiedText; public String getBaseURI() { return baseURI; } public InputStream getByteStream() { return byteStream; } public boolean getCertifiedText() { return certifiedText; } public Reader getCharacterStream() { return characterStream; } public String getEncoding() { return encoding; } public String getPublicId() { return publicId; } public String getStringData() { return stringData; } public String getSystemId() { return systemId; } public void setBaseURI( String pBaseURI ) { baseURI = pBaseURI; } public void setByteStream( InputStream pByteStream ) { byteStream = pByteStream; } public void setCertifiedText( boolean pCertifiedText ) { certifiedText = pCertifiedText; } public void setCharacterStream( Reader pCharacterStream ) { characterStream = pCharacterStream; } public void setEncoding( String pEncoding ) { encoding = pEncoding; } public void setPublicId( String pPublicId ) { publicId = pPublicId; } public void setStringData( String pStringData ) { stringData = pStringData; } public void setSystemId( String pSystemId ) { systemId = pSystemId; } } xml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/TransformMojo.java0000644000175000017500000005416412635321500031500 0ustar eugeneeugenpackage org.codehaus.mojo.xml; /* * 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. */ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import java.util.ArrayList; import java.util.Date; import java.util.Iterator; import java.util.List; import javax.xml.transform.Source; import javax.xml.transform.Templates; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.stream.StreamResult; import org.apache.maven.model.Resource; 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.codehaus.mojo.xml.transformer.NameValuePair; import org.codehaus.mojo.xml.transformer.TransformationSet; import org.codehaus.plexus.components.io.filemappers.FileMapper; import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.IOUtil; import org.xml.sax.InputSource; /** * The TransformMojo is used for transforming a set of files using a common stylesheet. */ @Mojo( defaultPhase = LifecyclePhase.GENERATE_RESOURCES, name = "transform", threadSafe = true ) public class TransformMojo extends AbstractXmlMojo { /** * Specifies one or more sets of files, which are being transformed. */ @Parameter private TransformationSet[] transformationSets; /** * Whether creating the transformed files should be forced. */ @Parameter( property = "xml.forceCreation", defaultValue = "false" ) private boolean forceCreation; /** * Transformer factory use. By default, the systems default transformer factory is used. If you use this feature * you must use at least jdk 1.6 */ @Parameter( property = "xml.transformerFactory" ) private String transformerFactory; private void setFeature( TransformerFactory pTransformerFactory, String name, Boolean value ) throws MojoExecutionException { // Try to use the method setFeature, which isn't available until JAXP 1.3 Method m; try { m = pTransformerFactory.getClass().getMethod( "setFeature", new Class[] { String.class, boolean.class } ); } catch ( NoSuchMethodException e ) { m = null; } if ( m == null ) { // Not available, try to use setAttribute pTransformerFactory.setAttribute( name, value ); } else { try { m.invoke( pTransformerFactory, new Object[] { name, value } ); } catch ( IllegalAccessException e ) { throw new MojoExecutionException( e.getMessage(), e ); } catch ( InvocationTargetException e ) { Throwable t = e.getTargetException(); throw new MojoExecutionException( t.getMessage(), t ); } } } private Templates getTemplate( Resolver pResolver, Source stylesheet, TransformationSet transformationSet ) throws MojoExecutionException, MojoFailureException { TransformerFactory tf = getTransformerFactory(); if ( pResolver != null ) { tf.setURIResolver( pResolver ); } NameValuePair[] features = transformationSet.getFeatures(); if ( features != null ) { for ( int i = 0; i < features.length; i++ ) { final NameValuePair feature = features[i]; final String name = feature.getName(); if ( name == null || name.length() == 0 ) { throw new MojoFailureException( "A features name is missing or empty." ); } final String value = feature.getValue(); if ( value == null ) { throw new MojoFailureException( "No value specified for feature " + name ); } setFeature( tf, name, Boolean.valueOf( value ) ); } } NameValuePair[] attributes = transformationSet.getAttributes(); if ( attributes != null ) { for ( int i = 0; i < attributes.length; i++ ) { final NameValuePair attribute = attributes[i]; final String name = attribute.getName(); if ( name == null || name.length() == 0 ) { throw new MojoFailureException( "An attributes name is missing or empty." ); } final String value = attribute.getValue(); if ( value == null ) { throw new MojoFailureException( "No value specified for attribute " + name ); } tf.setAttribute( name, value ); } } try { return tf.newTemplates( stylesheet ); } catch ( TransformerConfigurationException e ) { throw new MojoExecutionException( "Failed to parse stylesheet " + stylesheet + ": " + e.getMessage(), e ); } } /** * Creates a new instance of {@link TransformerFactory}. */ private TransformerFactory getTransformerFactory() throws MojoFailureException, MojoExecutionException { if ( transformerFactory == null ) { return TransformerFactory.newInstance(); } try { return newTransformerFactory( transformerFactory, Thread.currentThread().getContextClassLoader() ); } catch ( NoSuchMethodException exception ) { throw new MojoFailureException( "JDK6 required when using transformerFactory parameter" ); } catch ( IllegalAccessException exception ) { throw new MojoExecutionException( "Cannot instantiate transformer factory", exception ); } catch ( InvocationTargetException exception ) { throw new MojoExecutionException( "Cannot instantiate transformer factory", exception ); } } // public for use by unit test public static TransformerFactory newTransformerFactory( String factoryClassName, ClassLoader classLoader ) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { // use reflection to avoid JAXP 1.4 (and hence JDK6) requirement Class[] methodTypes = new Class[] { String.class, ClassLoader.class }; Method method = TransformerFactory.class.getDeclaredMethod( "newInstance", methodTypes ); Object[] methodArgs = new Object[] { factoryClassName, classLoader }; return (TransformerFactory) method.invoke( null, methodArgs ); } private File getFile( File pDir, String pFile ) { if ( new File( pFile ).isAbsolute() ) { throw new IllegalStateException( "Output/Input file names must not be absolute." ); } return new File( pDir, pFile ); } private File getDir( File pDir ) { if ( pDir == null ) { return getBasedir(); } return asAbsoluteFile( pDir ); } private void addToClasspath( File pOutputDir ) { MavenProject project = getProject(); for ( Iterator iter = project.getResources().iterator(); iter.hasNext(); ) { Resource resource = iter.next(); if ( resource.getDirectory().equals( pOutputDir ) ) { return; } } Resource resource = new Resource(); resource.setDirectory( pOutputDir.getPath() ); resource.setFiltering( false ); project.addResource( resource ); } private File getOutputDir( File pOutputDir ) { if ( pOutputDir == null ) { MavenProject project = getProject(); String dir = project.getBuild().getDirectory(); if ( dir == null ) { throw new IllegalStateException( "The projects build directory is null." ); } dir += "/generated-resources/xml/xslt"; return asAbsoluteFile( new File( dir ) ); } return asAbsoluteFile( pOutputDir ); } private static String getAllExMsgs( Throwable ex, boolean includeExName ) { StringBuffer sb = new StringBuffer( ( includeExName ? ex.toString() : ex.getLocalizedMessage() ) ); while ( ( ex = ex.getCause() ) != null ) { sb.append( "\nCaused by: " + ex.toString() ); } return sb.toString(); } /** * @param files the fileNames or URLs to scan their lastModified timestamp. * @param oldest if true, returns the latest modificationDate of all files, otherwise returns the earliest. * @return the older or younger last modification timestamp of all files. */ protected long findLastModified( List/* */ files, boolean oldest ) { long timeStamp = ( oldest ? Long.MIN_VALUE : Long.MAX_VALUE ); for ( Iterator it = files.iterator(); it.hasNext(); ) { Object no = it.next(); if ( no != null ) { long fileModifTime; if ( no instanceof File ) { fileModifTime = ( (File) no ).lastModified(); } else // either URL or filePath { String sdep = no.toString(); try { URL url = new URL( sdep ); URLConnection uCon = url.openConnection(); uCon.setUseCaches( false ); fileModifTime = uCon.getLastModified(); } catch ( MalformedURLException e ) { fileModifTime = new File( sdep ).lastModified(); } catch ( IOException ex ) { fileModifTime = ( oldest ? Long.MIN_VALUE : Long.MAX_VALUE ); getLog().warn( "Skipping URL '" + no + "' from up-to-date check due to error while opening connection: " + getAllExMsgs( ex, true ) ); } } getLog().debug( ( oldest ? "Depends " : "Produces " ) + no + ": " + new Date( fileModifTime ) ); if ( ( fileModifTime > timeStamp ) ^ !oldest ) { timeStamp = fileModifTime; } } // end if file null. } // end filesloop if ( timeStamp == Long.MIN_VALUE ) { // no older file found return Long.MAX_VALUE; // assume re-execution required. } else if ( timeStamp == Long.MAX_VALUE ) { // no younger file found return Long.MIN_VALUE; // assume re-execution required. } return timeStamp; } /** * @return true to indicate results are up-to-date, that is, when the latest from input files is earlier than the * younger from the output files (meaning no re-execution required). */ protected boolean isUpdToDate( List dependsFiles, List producesFiles ) { // The older timeStamp of all input files; long inputTimeStamp = findLastModified( dependsFiles, true ); // The younger of all destination files. long destTimeStamp = producesFiles == null ? Long.MIN_VALUE : findLastModified( producesFiles, false ); getLog().debug( "Depends timeStamp: " + inputTimeStamp + ", produces timestamp: " + destTimeStamp ); return inputTimeStamp < destTimeStamp; } private void transform( Transformer pTransformer, File input, File output, Resolver pResolver ) throws MojoExecutionException { File dir = output.getParentFile(); dir.mkdirs(); getLog().info( "Transforming file: " + input.getPath() ); FileOutputStream fos = null; try { final boolean transformInPlace = output.equals( input ); File tmpOutput = null; if ( transformInPlace ) { tmpOutput = File.createTempFile( "xml-maven-plugin", "xml" ); tmpOutput.deleteOnExit(); fos = new FileOutputStream( tmpOutput ); } else { fos = new FileOutputStream( output ); } final String parentFile = input.getParent() == null ? null : input.getParentFile().toURI().toURL().toExternalForm(); pTransformer.transform( pResolver.resolve( input.toURI().toURL().toExternalForm(), parentFile ), new StreamResult( fos ) ); fos.close(); fos = null; if ( transformInPlace ) { FileUtils.copyFile( tmpOutput, output ); /* tmpOutput is a temporary file */ tmpOutput.delete(); } } catch ( IOException e ) { throw new MojoExecutionException( "Failed to create output file " + output.getPath() + ": " + e.getMessage(), e ); } catch ( TransformerException e ) { throw new MojoExecutionException( "Failed to transform input file " + input.getPath() + ": " + e.getMessage(), e ); } finally { if ( fos != null ) { try { fos.close(); } catch ( Throwable t ) { /* Ignore me */ } } } } private File getOutputFile( File targetDir, String pName, FileMapper[] pFileMappers ) { String name = pName; if ( pFileMappers != null ) { for ( int i = 0; i < pFileMappers.length; i++ ) { name = pFileMappers[i].getMappedFileName( name ); } } return getFile( targetDir, name ); } private void transform( Resolver pResolver, TransformationSet pTransformationSet ) throws MojoExecutionException, MojoFailureException { String[] fileNames = getFileNames( pTransformationSet.getDir(), pTransformationSet.getIncludes(), getExcludes( pTransformationSet.getExcludes(), pTransformationSet.isSkipDefaultExcludes() ) ); if ( fileNames == null || fileNames.length == 0 ) { getLog().warn( "No files found for transformation by stylesheet " + pTransformationSet.getStylesheet() ); return; } String stylesheetName = pTransformationSet.getStylesheet(); if ( stylesheetName == null ) { getLog().warn( "No stylesheet configured." ); return; } final URL stylesheetUrl = getResource( stylesheetName ); Templates template; InputStream stream = null; try { stream = stylesheetUrl.openStream(); InputSource isource = new InputSource( stream ); isource.setSystemId( stylesheetUrl.toExternalForm() ); template = getTemplate( pResolver, new SAXSource( isource ), pTransformationSet ); stream.close(); stream = null; } catch ( IOException e ) { throw new MojoExecutionException( e.getMessage(), e ); } finally { IOUtil.close( stream ); } int filesTransformed = 0; File inputDir = getDir( pTransformationSet.getDir() ); File outputDir = getOutputDir( pTransformationSet.getOutputDir() ); for ( int i = 0; i < fileNames.length; i++ ) { final Transformer t; File input = getFile( inputDir, fileNames[i] ); File output = getOutputFile( outputDir, fileNames[i], pTransformationSet.getFileMappers() ); // Perform up-to-date-check. boolean needsTransform = forceCreation; if ( !needsTransform ) { List dependsFiles = new ArrayList(); List producesFiles = new ArrayList(); // Depends from pom.xml file for when project configuration changes. dependsFiles.add( getProject().getFile() ); if ( "file".equals( stylesheetUrl.getProtocol() ) ) { dependsFiles.add( new File( stylesheetUrl.getFile() ) ); } List catalogFiles = new ArrayList(); List catalogUrls = new ArrayList(); setCatalogs( catalogFiles, catalogUrls ); dependsFiles.addAll( catalogFiles ); dependsFiles.add( input ); File[] files = asFiles( getBasedir(), pTransformationSet.getOtherDepends() ); for ( int j = 0; j < files.length; j++ ) { dependsFiles.add( files[j] ); } producesFiles.add( output ); needsTransform = !isUpdToDate( dependsFiles, producesFiles ); } if ( !needsTransform ) { getLog().debug( "Skipping XSL transformation. File " + fileNames[i] + " is up-to-date." ); } else { filesTransformed++; // Perform transformation. try { t = newTransformer( template, pTransformationSet ); t.setURIResolver( pResolver ); NameValuePair[] parameters = pTransformationSet.getParameters(); if ( parameters != null ) { for ( int j = 0; j < parameters.length; j++ ) { NameValuePair key = parameters[j]; t.setParameter( key.getName(), key.getValue() ); } } transform( t, input, output, pResolver ); } catch ( TransformerConfigurationException e ) { throw new MojoExecutionException( "Failed to create Transformer: " + e.getMessage(), e ); } } } // end file loop if ( filesTransformed > 0 ) { getLog().info( "Transformed " + filesTransformed + " file(s)." ); } if ( pTransformationSet.isAddedToClasspath() ) { addToClasspath( pTransformationSet.getOutputDir() ); } } private Transformer newTransformer( Templates template, TransformationSet pTransformationSet ) throws TransformerConfigurationException, MojoExecutionException, MojoFailureException { Transformer t = template.newTransformer(); NameValuePair[] properties = pTransformationSet.getOutputProperties(); if ( properties != null ) { for ( int i = 0; i < properties.length; i++ ) { final String name = properties[i].getName(); if ( name == null || "".equals( name ) ) { throw new MojoFailureException( "Missing or empty output property name" ); } final String value = properties[i].getValue(); if ( value == null ) { throw new MojoFailureException( "Missing value for output property " + name ); } try { t.setOutputProperty( name, value ); } catch ( IllegalArgumentException e ) { throw new MojoExecutionException( "Unsupported property name or value: " + name + " => " + value + e.getMessage(), e ); } } } return t; } /** * Called by Maven to run the plugin. */ public void execute() throws MojoExecutionException, MojoFailureException { if ( isSkipping() ) { getLog().debug( "Skipping execution, as demanded by user." ); return; } if ( transformationSets == null || transformationSets.length == 0 ) { throw new MojoFailureException( "No TransformationSets configured." ); } Object oldProxySettings = activateProxy(); try { Resolver resolver = getResolver(); for ( int i = 0; i < transformationSets.length; i++ ) { TransformationSet transformationSet = transformationSets[i]; resolver.setValidating( transformationSet.isValidating() ); transform( resolver, transformationSet ); } } finally { passivateProxy( oldProxySettings ); } } } xml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/CheckFormatMojo.java0000644000175000017500000002325112635321500031704 0ustar eugeneeugenpackage org.codehaus.mojo.xml; /* * 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. */ import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.apache.maven.model.FileSet; 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.codehaus.mojo.xml.format.FormatFileSet; import org.codehaus.mojo.xml.format.IndentCheckSaxHandler; import org.codehaus.mojo.xml.format.XmlFormatViolation; import org.codehaus.mojo.xml.format.XmlFormatViolationHandler; import org.codehaus.plexus.util.DirectoryScanner; import org.xml.sax.InputSource; /** * An XML indentation check over a set of files. * * @author Peter Palaga */ @Mojo( defaultPhase = LifecyclePhase.VALIDATE, name = "check-format", threadSafe = true ) public class CheckFormatMojo extends AbstractXmlMojo { private class ViolationCollector implements XmlFormatViolationHandler { private final Map> violations = new LinkedHashMap>(); @Override public void handle( XmlFormatViolation violation ) { List list = violations.get( violation.getFile().getAbsolutePath() ); if ( list == null ) { list = new ArrayList(); violations.put( violation.getFile().getAbsolutePath(), list ); } list.add( violation ); if ( failOnFormatViolation ) { getLog().error( violation.toString() ); } else { getLog().warn( violation.toString() ); } } public boolean hasViolations() { return !violations.isEmpty(); } public boolean hasViolations( File file ) { List list = violations.get( file.getAbsolutePath() ); return list != null && !list.isEmpty(); } } /** * The encoding of files included in {@link #formatFileSets}. Note that the * {@code encoding can be set also per FormatFileSet}. */ @Parameter( property = "xml.encoding", defaultValue = "${project.build.sourceEncoding}" ) private String encoding; /** * Tells the mojo what to do in case XML formatting violations are found. if {@code true}, all violations will be * reported on the console as ERRORs and the build will fail. if {@code false}, all violations will be reported on * the console as WARNs and the build will proceed further. */ @Parameter( property = "xml.failOnFormatViolation", defaultValue = "true" ) private boolean failOnFormatViolation; /** * File patterns to include. The patterns are relative to the current project's {@code baseDir}. */ @Parameter private List formatFileSets = new ArrayList(); /** * The number of spaces expected for indentation. Note that {@code indentSize} can be configuread also per * {@link FormatFileSet}. */ @Parameter( property = "xml.indentSize", defaultValue = "2" ) private int indentSize; /** A {@link SAXParserFactory} */ private SAXParserFactory saxParserFactory; /** * If set to {@code true}, the result of {@link FormatFileSet#getDefault(String, int)} will be appended to * {@link #formatFileSets} before the processing. */ @Parameter( property = "xml.useDefaultFormatFileSet", defaultValue = "true" ) private boolean useDefaultFormatFileSet; /** * Creates a new {@link CheckFormatMojo} instance. */ public CheckFormatMojo() { super(); this.saxParserFactory = SAXParserFactory.newInstance(); this.saxParserFactory.setValidating( false ); } /** * Checks the formatting of the given {@code file}. The file is read using the given {@code encoding} and the * violations are reported to the given {@code violationHandler}. * * @param file the file to check * @param encoding the encoding to use for reading the {@code file} * @param violationHandler the {@link XmlFormatViolationHandler} to report violations * @throws MojoExecutionException if there is any lover level exception reading or parsing the file. */ private void check( File file, String encoding, XmlFormatViolationHandler violationHandler ) throws MojoExecutionException { Reader in = null; try { in = new InputStreamReader( new FileInputStream( file ), encoding ); SAXParser saxParser = saxParserFactory.newSAXParser(); IndentCheckSaxHandler handler = new IndentCheckSaxHandler( file, indentSize, violationHandler ); saxParser.parse( new InputSource( in ), handler ); } catch ( Exception e ) { throw new MojoExecutionException( "Could not process file " + file.getAbsolutePath(), e ); } finally { if ( in != null ) { try { in.close(); } catch ( IOException e ) { getLog().error( "Could not close Reader for " + file.getAbsolutePath(), e ); } } } } /** * Called by Maven for executing the Mojo. * * @throws MojoExecutionException Running the Mojo failed. * @throws MojoFailureException A configuration error was detected. */ public void execute() throws MojoExecutionException, MojoFailureException { if ( isSkipping() ) { getLog().debug( "Skipping execution, as demanded by user." ); return; } if ( useDefaultFormatFileSet ) { formatFileSets.add( FormatFileSet.getDefault( getBasedir(), encoding, indentSize ) ); } if ( formatFileSets == null || formatFileSets.isEmpty() ) { /* nothing to do */ return; } ViolationCollector violationCollector = new ViolationCollector(); int processedFileCount = 0; for ( FormatFileSet formatFileSet : formatFileSets ) { String effectiveEncoding = formatFileSet.getEncoding(); if ( effectiveEncoding == null ) { effectiveEncoding = this.encoding; } String[] includedFiles = scan( formatFileSet ); for ( String includedPath : includedFiles ) { processedFileCount++; File file = new File( formatFileSet.getDirectory(), includedPath ); check( file, effectiveEncoding, violationCollector ); if ( getLog().isDebugEnabled() && !violationCollector.hasViolations( file ) ) { getLog().debug( "No XML formatting violations found in file " + file.getAbsolutePath() ); } } } getLog().debug( "Checked the formatting of " + processedFileCount + " files" ); if ( failOnFormatViolation && violationCollector.hasViolations() ) { throw new MojoFailureException( "There are XML formatting violations. Check the above log for details." ); } } /** * A {@link DirectoryScanner} boiler plate. * * @param fileSet {@link FileSet} to scan * @return the included paths */ private String[] scan( FileSet fileSet ) { File basedir = new File( fileSet.getDirectory() ); if ( !basedir.exists() || !basedir.isDirectory() ) { return null; } DirectoryScanner scanner = new DirectoryScanner(); @SuppressWarnings( "unchecked" ) List includes = fileSet.getIncludes(); @SuppressWarnings( "unchecked" ) List excludes = fileSet.getExcludes(); if ( includes != null && includes.size() > 0 ) { scanner.setIncludes( includes.toArray( new String[0] ) ); } if ( excludes != null && excludes.size() > 0 ) { scanner.setExcludes( excludes.toArray( new String[0] ) ); } scanner.setBasedir( basedir ); scanner.scan(); return scanner.getIncludedFiles(); } /** * Sets the number of spaces for indentation. * * @param indentSize the number of spaces */ public void setIndentSize( int indentSize ) { this.indentSize = indentSize; } } xml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/AbstractXmlMojo.java0000644000175000017500000002561712635321500031752 0ustar eugeneeugenpackage org.codehaus.mojo.xml; /* * 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. */ import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; import org.apache.maven.settings.Proxy; import org.apache.maven.settings.Settings; import org.codehaus.plexus.resource.ResourceManager; import org.codehaus.plexus.resource.loader.FileResourceLoader; import org.codehaus.plexus.resource.loader.ResourceNotFoundException; import org.codehaus.plexus.util.DirectoryScanner; import org.codehaus.plexus.util.FileUtils; /** * Abstract base class for the plugins Mojo's. */ public abstract class AbstractXmlMojo extends AbstractMojo { /** * The Maven Project. */ @Parameter( defaultValue = "${project}", required = true, readonly = true ) private MavenProject project; /** * The Maven Settings. */ @Parameter( defaultValue = "${settings}", required = true, readonly = true ) private Settings settings; /** * The base directory, relative to which directory names are interpreted. */ @Parameter( defaultValue = "${project.basedir}", required = true, readonly = true ) private File basedir; /** * Whether to skip execution. */ @Parameter( property = "xml.skip", defaultValue = "false" ) private boolean skip; /** * An XML catalog file, or URL, which is being used to resolve entities. */ @Parameter private String[] catalogs; /** * Plexus resource manager used to obtain XSL. */ @Component private ResourceManager locator; private boolean locatorInitialized; /** * Returns the maven project. */ protected MavenProject getProject() { return project; } /** * Returns the projects base directory. */ protected File getBasedir() { return basedir; } /** * Converts the given file into an file with an absolute path. */ protected File asAbsoluteFile( File f ) { if ( f.isAbsolute() ) { return f; } return new File( getBasedir(), f.getPath() ); } /** * Returns the plugins catalog files. */ protected void setCatalogs( List pCatalogFiles, List pCatalogUrls ) { if ( catalogs == null || catalogs.length == 0 ) { return; } for ( int i = 0; i < catalogs.length; i++ ) { try { URL url = new URL( catalogs[i] ); pCatalogUrls.add( url ); } catch ( MalformedURLException e ) { pCatalogFiles.add( asAbsoluteFile( new File( catalogs[i] ) ) ); } } } /** * Creates a new resolver. */ protected Resolver getResolver() throws MojoExecutionException { List catalogFiles = new ArrayList(); List catalogUrls = new ArrayList(); setCatalogs( catalogFiles, catalogUrls ); return new Resolver( getBasedir(), catalogFiles, catalogUrls, getLocator(), getLog().isDebugEnabled() ); } /** * Scans a directory for files and returns a set of path names. */ protected String[] getFileNames( File pDir, String[] pIncludes, String[] pExcludes ) throws MojoFailureException { if ( pDir == null ) { throw new MojoFailureException( "A ValidationSet or TransformationSet" + " requires a nonempty 'dir' child element." ); } final File dir = asAbsoluteFile( pDir ); if ( !dir.isDirectory() ) { getLog().warn( "The directory " + dir.getPath() + ", which is a base directory of a ValidationSet or TransformationSet, does not exist." ); return new String[0]; } final DirectoryScanner ds = new DirectoryScanner(); ds.setBasedir( dir ); if ( pIncludes != null && pIncludes.length > 0 ) { ds.setIncludes( pIncludes ); } if ( pExcludes != null && pExcludes.length > 0 ) { ds.setExcludes( pExcludes ); } ds.scan(); return ds.getIncludedFiles(); } /** * Converts the given set of file names into a set of {@link File} instances. The file names may be relative to the * given base directory. */ protected File[] asFiles( File pDir, String[] pFileNames ) { if ( pFileNames == null ) { return new File[0]; } File dir = asAbsoluteFile( pDir ); File[] result = new File[pFileNames.length]; for ( int i = 0; i < pFileNames.length; i++ ) { result[i] = new File( dir, pFileNames[i] ); } return result; } /** * Scans a directory for files and returns a set of {@link File} instances. */ protected File[] getFiles( File pDir, String[] pIncludes, String[] pExcludes ) throws MojoFailureException { return asFiles( pDir, getFileNames( pDir, pIncludes, pExcludes ) ); } /** * Calculates the exclusions to use when searching files. */ protected String[] getExcludes( String[] origExcludes, boolean skipDefaultExcludes ) { if ( skipDefaultExcludes ) { return origExcludes; } String[] defaultExcludes = FileUtils.getDefaultExcludes(); if ( origExcludes == null || origExcludes.length == 0 ) { return defaultExcludes; } String[] result = new String[origExcludes.length + defaultExcludes.length]; System.arraycopy( origExcludes, 0, result, 0, origExcludes.length ); System.arraycopy( defaultExcludes, 0, result, origExcludes.length, defaultExcludes.length ); return result; } private boolean isEmpty( String value ) { return value == null || value.trim().length() == 0; } private void setProperty( List pProperties, String pKey, String pValue ) { if ( pProperties != null ) { pProperties.add( pKey ); pProperties.add( System.getProperty( pKey ) ); } if ( pValue == null ) { System.getProperties().remove( pKey ); } else { System.setProperty( pKey, pValue ); } } /** * Called to install the plugins proxy settings. */ protected Object activateProxy() { if ( settings == null ) { return null; } final Proxy proxy = settings.getActiveProxy(); if ( proxy == null ) { return null; } final List properties = new ArrayList(); final String protocol = proxy.getProtocol(); final String prefix = isEmpty( protocol ) ? "" : ( protocol + "." ); final String host = proxy.getHost(); final String hostProperty = prefix + "proxyHost"; final String hostValue = isEmpty( host ) ? null : host; setProperty( properties, hostProperty, hostValue ); final int port = proxy.getPort(); final String portProperty = prefix + "proxyPort"; final String portValue = ( port == 0 || port == -1 ) ? null : String.valueOf( port ); setProperty( properties, portProperty, portValue ); final String username = proxy.getUsername(); final String userProperty = prefix + "proxyUser"; final String userValue = isEmpty( username ) ? null : username; setProperty( properties, userProperty, userValue ); final String password = proxy.getPassword(); final String passwordProperty = prefix + "proxyPassword"; final String passwordValue = isEmpty( password ) ? null : password; setProperty( properties, passwordProperty, passwordValue ); final String nonProxyHosts = proxy.getNonProxyHosts(); final String nonProxyHostsProperty = prefix + "nonProxyHosts"; final String nonProxyHostsValue = isEmpty( nonProxyHosts ) ? null : nonProxyHosts.replace( ',', '|' ); setProperty( properties, nonProxyHostsProperty, nonProxyHostsValue ); getLog().debug( "Proxy settings: " + hostProperty + "=" + hostValue + ", " + portProperty + "=" + portValue + ", " + userProperty + "=" + userValue + ", " + passwordProperty + "=" + ( passwordValue == null ? "null" : "" ) + ", " + nonProxyHostsProperty + "=" + nonProxyHostsValue ); return properties; } /** * Called to restore the proxy settings, which have been installed when the plugin was invoked. */ protected void passivateProxy( Object pProperties ) { if ( pProperties == null ) { return; } final List properties = (List) pProperties; for ( Iterator iter = properties.iterator(); iter.hasNext(); ) { final String key = (String) iter.next(); final String value = (String) iter.next(); setProperty( null, key, value ); } } protected URL getResource( String pResource ) throws MojoFailureException { try { return getLocator().getResource( pResource ).getURL(); } catch ( ResourceNotFoundException exception ) { throw new MojoFailureException( "Could not find stylesheet: " + pResource ); } catch ( IOException e ) { throw new MojoFailureException( "Error while locating resource: " + pResource ); } } protected ResourceManager getLocator() { if ( !locatorInitialized ) { locator.addSearchPath( FileResourceLoader.ID, getBasedir().getAbsolutePath() ); locatorInitialized = true; } return locator; } protected boolean isSkipping() { return skip; } } xml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/format/0000755000175000017500000000000012635321500027313 5ustar eugeneeugen././@LongLink0000644000000000000000000000016200000000000011602 Lustar rootrootxml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/format/XmlFormatViolationHandler.javaxml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/format/XmlFormatViolatio0000644000175000017500000000061712635321500032662 0ustar eugeneeugenpackage org.codehaus.mojo.xml.format; /** * An interface for reporting {@link XmlFormatViolation}s. * * @author Peter Palaga */ public interface XmlFormatViolationHandler { /** * Called when an {@link XmlFormatViolation} is found. * * @param violation the reported violation */ void handle( XmlFormatViolation violation ); }././@LongLink0000644000000000000000000000015300000000000011602 Lustar rootrootxml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/format/XmlFormatViolation.javaxml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/format/XmlFormatViolatio0000644000175000017500000000251612635321500032662 0ustar eugeneeugenpackage org.codehaus.mojo.xml.format; import java.io.File; /** * A violation of a prescribed XML formatting. * * @author Peter Palaga */ public class XmlFormatViolation { private final int column; private final File file; private final int lineNumber; private final String message; public XmlFormatViolation( File file, int lineNumber, int column, String message ) { super(); this.file = file; this.lineNumber = lineNumber; this.column = column; this.message = message; } /** * @return the column where the violation was detected. The first column number is 1 */ public int getColumn() { return column; } /** * @return the file in which the violation was detected. */ public File getFile() { return file; } /** * @return the line number where the violation was detected. The first line number is 1 */ public int getLineNumber() { return lineNumber; } /** * @return the message describing the violation */ public String getMessage() { return message; } @Override public String toString() { return file.getAbsolutePath() + ":" + lineNumber + "," + column + ": " + message; } }././@LongLink0000644000000000000000000000014600000000000011604 Lustar rootrootxml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/format/FormatFileSet.javaxml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/format/FormatFileSet.jav0000644000175000017500000000403012635321500032516 0ustar eugeneeugenpackage org.codehaus.mojo.xml.format; import java.io.File; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.apache.maven.model.FileSet; /** * An extension of {@link FileSet} that adds {@link #encoding} and {@link #indentSize} fields. * * @author Peter Palaga */ public class FormatFileSet extends FileSet { private static final long serialVersionUID = 2128636607981252229L; private static final List DEFAULT_INCLUDED_EXTENSIONS = Collections.unmodifiableList( Arrays.asList( "xml", "xsl" ) ); public static final List DEFAULT_EXCLUDES = Collections.unmodifiableList( Arrays.asList( "**/.*" ) ); public static FormatFileSet getDefault( File baseDir, String encoding, int indentSize ) { FormatFileSet result = new FormatFileSet(); result.setDirectory( baseDir.getAbsolutePath() ); result.setEncoding( encoding ); result.setIndentSize( indentSize ); List includes = new ArrayList( DEFAULT_INCLUDED_EXTENSIONS.size() * 2 ); for ( String ext : DEFAULT_INCLUDED_EXTENSIONS ) { includes.add( "*." + ext ); includes.add( "src/**/*." + ext ); } result.setIncludes( includes ); result.setExcludes( DEFAULT_EXCLUDES ); return result; } /** The encoding used to read the XML files. */ private String encoding; /** The number of spaces expected for indentation. */ private int indentSize; /** * @return the number of spaces for indentation */ public int getIndentSize() { return indentSize; } /** * @return the encoding used to read the XML files */ public String getEncoding() { return encoding; } public void setEncoding( String encoding ) { this.encoding = encoding; } public void setIndentSize( int indentSize ) { this.indentSize = indentSize; } } ././@LongLink0000644000000000000000000000015600000000000011605 Lustar rootrootxml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/format/IndentCheckSaxHandler.javaxml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/format/IndentCheckSaxHan0000644000175000017500000002346112635321500032526 0ustar eugeneeugenpackage org.codehaus.mojo.xml.format; import java.io.File; import java.io.IOException; import java.io.StringReader; import java.util.Deque; import javax.xml.parsers.SAXParser; import org.xml.sax.Attributes; import org.xml.sax.InputSource; import org.xml.sax.Locator; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; /** * A {@link DefaultHandler} implementation that detects formatting violations and reports them to the supplied * {@link #violationHandler}. * * @author Peter Palaga */ public class IndentCheckSaxHandler extends DefaultHandler { /** * An entry that can be stored on a stack */ private static class ElementEntry { private final String elementName; private final IndentCheckSaxHandler.Indent expectedIndent; private final IndentCheckSaxHandler.Indent foundIndent; public ElementEntry( String elementName, IndentCheckSaxHandler.Indent foundIndent ) { super(); this.elementName = elementName; this.foundIndent = foundIndent; this.expectedIndent = foundIndent; } public ElementEntry( String elementName, IndentCheckSaxHandler.Indent foundIndent, IndentCheckSaxHandler.Indent expectedIndent ) { super(); this.elementName = elementName; this.foundIndent = foundIndent; this.expectedIndent = expectedIndent; } @Override public String toString() { return "<" + elementName + "> " + foundIndent; } } /** * An indent occurrence within a file characterized by {@link #lineNumber} and {@link #size}. */ private static class Indent { /** * An {@link Indent} usable at the beginning of a typical XML file. */ public static final IndentCheckSaxHandler.Indent START = new Indent( 1, 0 ); /** * The line number where this {@link Indent} occurs. The first line number in a file is {@code 1}. */ private final int lineNumber; /** The number of spaces in this {@link Indent}. */ private final int size; public Indent( int lineNumber, int size ) { super(); this.lineNumber = lineNumber; this.size = size; } @Override public String toString() { return "Indent [size=" + size + ", lineNumber=" + lineNumber + "]"; } } private final StringBuilder charBuffer = new StringBuilder(); private int charLineNumber; /** The file being checked */ private final File file; /** The number of spaces for indentation */ private final int indentSize; private IndentCheckSaxHandler.Indent lastIndent = Indent.START; /** The locator set by {@link SAXParser} */ private Locator locator; /** The element stack */ private Deque stack = new java.util.ArrayDeque(); /** The {@link XmlFormatViolationHandler} for reporting found violations */ private final XmlFormatViolationHandler violationHandler; public IndentCheckSaxHandler( File file, int indentSize, XmlFormatViolationHandler violationHandler ) { super(); this.file = file; this.indentSize = indentSize; this.violationHandler = violationHandler; } /** * Stores the passed characters into {@link #charBuffer}. * * @see org.xml.sax.helpers.DefaultHandler#characters(char[], int, int) */ @Override public void characters( char[] ch, int start, int length ) throws SAXException { charBuffer.append( ch, start, length ); charLineNumber = locator.getLineNumber(); } /** * Checks indentation for an end element. * * @see org.xml.sax.helpers.DefaultHandler#startElement(java.lang.String, java.lang.String, java.lang.String, * org.xml.sax.Attributes) */ @Override public void endElement( String uri, String localName, String qName ) throws SAXException { flushCharacters(); if ( stack.isEmpty() ) { throw new IllegalStateException( "Stack must not be empty when closing the element " + qName + " around line " + locator.getLineNumber() + " and column " + locator.getColumnNumber() ); } IndentCheckSaxHandler.ElementEntry startEntry = stack.pop(); int indentDiff = lastIndent.size - startEntry.expectedIndent.size; int expectedIndent = startEntry.expectedIndent.size; if ( lastIndent.lineNumber != startEntry.foundIndent.lineNumber && indentDiff != 0 ) { /* * diff should be zero unless we are on the same line as start element */ int opValue = expectedIndent - lastIndent.size; String op = opValue > 0 ? "Insert" : "Delete"; String units = opValue == 1 ? "space" : "spaces"; String message = op + " " + Math.abs( opValue ) + " " + units + ". Expected " + expectedIndent + " found " + lastIndent.size + " spaces before end element "; XmlFormatViolation violation = new XmlFormatViolation( file, locator.getLineNumber(), locator.getColumnNumber(), message ); violationHandler.handle( violation ); } } /** * Sets {@link lastIndent} based on {@link #charBuffer} and resets {@link #charBuffer}. */ private void flushCharacters() { int indentLength = 0; int len = charBuffer.length(); /* * Count characters from end of ignorable whitespace to first end of line we hit */ for ( int i = len - 1; i >= 0; i-- ) { char ch = charBuffer.charAt( i ); switch ( ch ) { case '\n': case '\r': lastIndent = new Indent( charLineNumber, indentLength ); charBuffer.setLength( 0 ); return; case ' ': case '\t': indentLength++; break; default: /* * No end of line foundIndent in the trailing whitespace. Leave the foundIndent from previous * ignorable whitespace unchanged */ charBuffer.setLength( 0 ); return; } } } /** * Just delegates to {@link #characters(char[], int, int)}, since this method is not called in all situations where * it could be naively expected. * * @see org.xml.sax.helpers.DefaultHandler#ignorableWhitespace(char[], int, int) */ @Override public void ignorableWhitespace( char[] chars, int start, int length ) throws SAXException { characters( chars, start, length ); } /** * Always returns an empty {@link InputSource} to avoid loading of any DTDs. * * @see org.xml.sax.helpers.DefaultHandler#resolveEntity(java.lang.String, java.lang.String) */ @Override public InputSource resolveEntity( String publicId, String systemId ) throws SAXException, IOException { return new InputSource( new StringReader( "" ) ); } /** @see org.xml.sax.helpers.DefaultHandler#setDocumentLocator(org.xml.sax.Locator) */ @Override public void setDocumentLocator( Locator locator ) { this.locator = locator; } /** * Checks indentation for a start element. * * @see org.xml.sax.helpers.DefaultHandler#startElement(java.lang.String, java.lang.String, java.lang.String, * org.xml.sax.Attributes) */ @Override public void startElement( String uri, String localName, String qName, Attributes attributes ) throws SAXException { flushCharacters(); IndentCheckSaxHandler.ElementEntry currentEntry = new ElementEntry( qName, lastIndent ); if ( !stack.isEmpty() ) { IndentCheckSaxHandler.ElementEntry parentEntry = stack.peek(); /* * note that we use parentEntry.expectedIndent rather than parentEntry.foundIndent this is to make the * messages more useful */ int indentDiff = currentEntry.foundIndent.size - parentEntry.expectedIndent.size; int expectedIndent = parentEntry.expectedIndent.size + indentSize; if ( indentDiff == 0 && currentEntry.foundIndent.lineNumber == parentEntry.foundIndent.lineNumber ) { /* * Zero foundIndent acceptable only if current is on the same line as parent This is OK, therefore do * nothing */ } else if ( indentDiff != indentSize ) { /* generally unexpected foundIndent */ int opValue = expectedIndent - currentEntry.foundIndent.size; String op = opValue > 0 ? "Insert" : "Delete"; String message = op + " " + Math.abs( opValue ) + " spaces. Expected " + expectedIndent + " found " + currentEntry.foundIndent.size + " spaces before start element <" + currentEntry.elementName + ">"; XmlFormatViolation violation = new XmlFormatViolation( file, locator.getLineNumber(), locator.getColumnNumber(), message ); violationHandler.handle( violation ); /* reset the expected indent in the entry we'll push */ currentEntry = new ElementEntry( qName, lastIndent, new Indent( lastIndent.lineNumber, expectedIndent ) ); } } stack.push( currentEntry ); } }xml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/ValidateMojo.java0000644000175000017500000003020612635321500031245 0ustar eugeneeugenpackage org.codehaus.mojo.xml; /* * 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. */ import java.io.File; import java.io.IOException; import javax.xml.XMLConstants; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParserFactory; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.stream.StreamSource; import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import javax.xml.validation.Validator; 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.codehaus.mojo.xml.validation.ValidationSet; import org.xml.sax.ErrorHandler; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import org.xml.sax.XMLReader; /** * The ValidatorMojo's task is the validation of XML files against a given schema. */ @Mojo( name = "validate", defaultPhase = LifecyclePhase.TEST, threadSafe = true ) public class ValidateMojo extends AbstractXmlMojo { /** * Specifies a set of document types, which are being validated. */ @Parameter private ValidationSet[] validationSets; /** * Reads a validation sets schema. * * @param pResolver The resolver to use for loading external entities. * @param pValidationSet The validation set to configure. * @return The validation sets schema, if any, or null. * @throws MojoExecutionException Loading the schema failed. */ private Schema getSchema( Resolver pResolver, ValidationSet pValidationSet ) throws MojoExecutionException { final String publicId = pValidationSet.getPublicId(); final String systemId = pValidationSet.getSystemId(); if ( ( publicId == null || "".equals( publicId ) ) && ( systemId == null || "".equals( systemId ) ) ) { return null; } getLog().debug( "Loading schema with public Id " + publicId + ", system Id " + systemId ); InputSource inputSource = null; if ( pResolver != null ) { try { inputSource = pResolver.resolveEntity( publicId, systemId ); } catch ( SAXException e ) { throw new MojoExecutionException( e.getMessage(), e ); } catch ( IOException e ) { throw new MojoExecutionException( e.getMessage(), e ); } } if ( inputSource == null ) { inputSource = new InputSource(); inputSource.setPublicId( publicId ); inputSource.setSystemId( systemId ); } final SAXSource saxSource = new SAXSource( inputSource ); String schemaLanguage = pValidationSet.getSchemaLanguage(); if ( schemaLanguage == null || "".equals( schemaLanguage ) ) { schemaLanguage = XMLConstants.W3C_XML_SCHEMA_NS_URI; } try { SchemaFactory schemaFactory = SchemaFactory.newInstance( schemaLanguage ); if ( pResolver != null ) { schemaFactory.setResourceResolver( pResolver ); } return schemaFactory.newSchema( saxSource ); } catch ( SAXException e ) { throw new MojoExecutionException( "Failed to load schema with public ID " + publicId + ", system ID " + systemId + ": " + e.getMessage(), e ); } } /** * Called for parsing or validating a single file. * * @param pResolver The resolver to use for loading external entities. * @param pValidationSet The parsers or validators configuration. * @param pSchema The schema to use. * @param pFile The file to parse or validate. * @throws MojoExecutionException Parsing or validating the file failed. */ private void validate( final Resolver pResolver, ValidationSet pValidationSet, Schema pSchema, File pFile ) throws MojoExecutionException { try { if ( pSchema == null ) { getLog().debug( "Parsing " + pFile.getPath() ); parse( pResolver, pValidationSet, pFile ); } else { getLog().debug( "Validating " + pFile.getPath() ); Validator validator = pSchema.newValidator(); if ( pResolver != null ) { validator.setResourceResolver( pResolver ); } validator.validate( new StreamSource( pFile ) ); } } catch ( SAXParseException e ) { final String publicId = e.getPublicId(); final String systemId = e.getSystemId(); final int lineNum = e.getLineNumber(); final int colNum = e.getColumnNumber(); final String location; if ( publicId == null && systemId == null && lineNum == -1 && colNum == -1 ) { location = ""; } else { final StringBuffer loc = new StringBuffer(); String sep = ""; if ( publicId != null ) { loc.append( "Public ID " ); loc.append( publicId ); sep = ", "; } if ( systemId != null ) { loc.append( sep ); loc.append( systemId ); sep = ", "; } if ( lineNum != -1 ) { loc.append( sep ); loc.append( "line " ); loc.append( lineNum ); sep = ", "; } if ( colNum != -1 ) { loc.append( sep ); loc.append( " column " ); loc.append( colNum ); sep = ", "; } location = loc.toString(); } final String msg = "While parsing " + pFile.getPath() + ( "".equals( location ) ? "" : ", at " + location ) + ": " + e.getMessage(); throw new MojoExecutionException( msg, e ); } catch ( Exception e ) { throw new MojoExecutionException( "While parsing " + pFile + ": " + e.getMessage(), e ); } } /** * Creates a new instance of {@link SAXParserFactory}. * * @param pValidationSet The parser factories configuration. * @return A new SAX parser factory. */ private SAXParserFactory newSAXParserFactory( ValidationSet pValidationSet ) { SAXParserFactory spf = SAXParserFactory.newInstance(); spf.setValidating( pValidationSet.isValidating() ); if ( pValidationSet.isValidating() ) { try { spf.setFeature( "http://apache.org/xml/features/validation/schema", true ); } catch ( SAXException e ) { // Ignore this } catch ( ParserConfigurationException e ) { // Ignore this } } else { try { spf.setFeature( "http://apache.org/xml/features/nonvalidating/load-external-dtd", false ); } catch ( SAXException e ) { // Ignore this } catch ( ParserConfigurationException e ) { // Ignore this } } spf.setNamespaceAware( true ); return spf; } /** * Called for validating a single file. * * @param pResolver The resolver to use for loading external entities. * @param pValidationSet The validators configuration. * @param pFile The file to validate. * @throws IOException An I/O error occurred. * @throws SAXException Parsing the file failed. * @throws ParserConfigurationException Creating an XML parser failed. */ private void parse( Resolver pResolver, ValidationSet pValidationSet, File pFile ) throws IOException, SAXException, ParserConfigurationException { XMLReader xr = newSAXParserFactory( pValidationSet ).newSAXParser().getXMLReader(); if ( pResolver != null ) { xr.setEntityResolver( pResolver ); } xr.setErrorHandler( new ErrorHandler() { public void error( SAXParseException pException ) throws SAXException { throw pException; } public void fatalError( SAXParseException pException ) throws SAXException { throw pException; } public void warning( SAXParseException pException ) throws SAXException { throw pException; } } ); xr.parse( pFile.toURI().toURL().toExternalForm() ); } /** * Called for validating a set of XML files against a common schema. * * @param pResolver The resolver to use for loading external entities. * @param pValidationSet The set of XML files to validate. * @throws MojoExecutionException Validating the set of files failed. * @throws MojoFailureException A configuration error was detected. */ private void validate( Resolver pResolver, ValidationSet pValidationSet ) throws MojoExecutionException, MojoFailureException { final Schema schema = getSchema( pResolver, pValidationSet ); final File[] files = getFiles( pValidationSet.getDir(), pValidationSet.getIncludes(), getExcludes( pValidationSet.getExcludes(), pValidationSet.isSkipDefaultExcludes() ) ); if ( files.length == 0 ) { getLog().info( "No matching files found for ValidationSet with public ID " + pValidationSet.getPublicId() + ", system ID " + pValidationSet.getSystemId() + "." ); } for ( int i = 0; i < files.length; i++ ) { validate( pResolver, pValidationSet, schema, files[i] ); } } /** * Called by Maven for executing the Mojo. * * @throws MojoExecutionException Running the Mojo failed. * @throws MojoFailureException A configuration error was detected. */ public void execute() throws MojoExecutionException, MojoFailureException { if ( isSkipping() ) { getLog().debug( "Skipping execution, as demanded by user." ); return; } if ( validationSets == null || validationSets.length == 0 ) { throw new MojoFailureException( "No ValidationSets configured." ); } Object oldProxySettings = activateProxy(); try { Resolver resolver = getResolver(); for ( int i = 0; i < validationSets.length; i++ ) { ValidationSet validationSet = validationSets[i]; resolver.setValidating( validationSet.isValidating() ); validate( resolver, validationSet ); } } finally { passivateProxy( oldProxySettings ); } } } xml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/Resolver.java0000644000175000017500000002506412635321500030476 0ustar eugeneeugenpackage org.codehaus.mojo.xml; /* * 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. */ import java.io.File; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.UndeclaredThrowableException; import java.net.MalformedURLException; import java.net.URL; import java.util.List; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParserFactory; import javax.xml.transform.Source; import javax.xml.transform.TransformerException; import javax.xml.transform.URIResolver; import javax.xml.transform.sax.SAXSource; import org.apache.maven.plugin.MojoExecutionException; import org.apache.xml.resolver.CatalogManager; import org.apache.xml.resolver.tools.CatalogResolver; import org.codehaus.plexus.resource.ResourceManager; import org.codehaus.plexus.resource.loader.ResourceNotFoundException; import org.w3c.dom.ls.LSInput; import org.w3c.dom.ls.LSResourceResolver; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; import org.xml.sax.ext.EntityResolver2; /** * An implementation of {@link org.xml.sax.EntityResolver}, {@link URIResolver}, and {@link LSResourceResolver}, based * on the Apache catalog resolver. */ public class Resolver implements EntityResolver2, URIResolver, LSResourceResolver { private final ResourceManager locator; private final File baseDir; private final CatalogResolver resolver; private boolean validating; /** * Creates a new instance. * * @param pFiles A set of files with catalog definitions to load * @throws MojoExecutionException An error occurred while loading the resolvers catalogs. */ Resolver( File pBaseDir, List pFiles, List pUrls, ResourceManager pLocator, boolean pLogging ) throws MojoExecutionException { baseDir = pBaseDir; locator = pLocator; CatalogManager manager = new CatalogManager(); manager.setIgnoreMissingProperties( true ); if ( pLogging ) { System.err.println( "Setting resolver verbosity to maximum." ); manager.setVerbosity( Integer.MAX_VALUE ); } resolver = new CatalogResolver( manager ); for ( int i = 0; i < pFiles.size(); i++ ) { File file = (File) pFiles.get( i ); try { resolver.getCatalog().parseCatalog( file.getPath() ); } catch ( IOException e ) { throw new MojoExecutionException( "Failed to parse catalog file: " + file.getPath() + ": " + e.getMessage(), e ); } } for ( int i = 0; i < pUrls.size(); i++ ) { URL url = (URL) pUrls.get( i ); try { resolver.getCatalog().parseCatalog( url ); } catch ( IOException e ) { throw new MojoExecutionException( "Failed to parse catalog URL: " + url + ": " + e.getMessage(), e ); } } } /** * Implementation of {@link org.xml.sax.EntityResolver#resolveEntity(String, String)}. */ public InputSource resolveEntity( String pPublicId, String pSystemId ) throws SAXException, IOException { final InputSource source = resolver.resolveEntity( pPublicId, pSystemId ); if ( source != null ) { return source; } URL url = resolve( pSystemId ); if ( url != null ) { return asInputSource( url ); } return null; } private InputSource asInputSource( URL url ) throws IOException { InputSource isource = new InputSource( url.openStream() ); isource.setSystemId( url.toExternalForm() ); return isource; } /** * Implementation of {@link URIResolver#resolve(String, String)}. */ public Source resolve( String pHref, String pBase ) throws TransformerException { final Source source = resolver.resolve( pHref, pBase ); if ( source != null ) { return source; } URL url = resolve( pHref ); if ( url != null ) { try { return asSaxSource( asInputSource( url ) ); } catch ( IOException e ) { throw new TransformerException( e ); } catch ( SAXException e ) { throw new TransformerException( e ); } catch ( ParserConfigurationException e ) { throw new TransformerException( e ); } } return null; } private Source asSaxSource( InputSource isource ) throws SAXException, ParserConfigurationException { SAXParserFactory spf = SAXParserFactory.newInstance(); spf.setValidating( validating ); spf.setNamespaceAware( true ); XMLReader xmlReader = spf.newSAXParser().getXMLReader(); xmlReader.setEntityResolver( this ); return new SAXSource( xmlReader, isource ); } private final LSInput newLSInput( InputSource pSource ) { final LSInputImpl lsInput = new LSInputImpl(); lsInput.setByteStream( pSource.getByteStream() ); lsInput.setCharacterStream( pSource.getCharacterStream() ); lsInput.setPublicId( lsInput.getPublicId() ); lsInput.setSystemId( pSource.getSystemId() ); lsInput.setEncoding( pSource.getEncoding() ); return lsInput; } /** * Implementation of {@link LSResourceResolver#resolveResource(String, String, String, String, String)}. */ public LSInput resolveResource( String pType, String pNamespaceURI, String pPublicId, String pSystemId, String pBaseURI ) { if ( pPublicId != null ) { final InputSource isource = resolver.resolveEntity( pPublicId, pSystemId ); if ( isource != null ) { return newLSInput( isource ); } } InputSource isource = resolver.resolveEntity( pNamespaceURI, pSystemId ); if ( isource != null ) { return newLSInput( isource ); } URL url = resolve( pSystemId ); if ( url != null ) { try { isource = asInputSource( url ); } catch ( IOException e ) { throw new UndeclaredThrowableException( e ); } } return isource == null ? null : newLSInput( isource ); } /** * Sets, whether the Resolver should create validating parsers. */ public void setValidating( boolean pValidating ) { validating = pValidating; } /** * Returns, whether the Resolver should create validating parsers. */ public boolean isValidating() { return validating; } private URL resolveAsResource( String pResource ) { return Thread.currentThread().getContextClassLoader().getResource( pResource ); } private URL resolveAsFile( String pResource ) { File f = new File( baseDir, pResource ); if ( !f.isFile() ) { f = new File( pResource ); if ( !f.isFile() ) { return null; } } try { return f.toURI().toURL(); } catch ( MalformedURLException e ) { return null; } } private URL resolveAsURL( String pResource ) { InputStream stream = null; try { final URL url = new URL( pResource ); stream = url.openStream(); stream.close(); stream = null; return url; } catch ( IOException e ) { return null; } finally { if ( stream != null ) { try { stream.close(); } catch ( Throwable t ) { // Ignore me } } } } /** * Attempts to resolve the given URI. */ public URL resolve( String pResource ) { if ( pResource == null ) { return null; } if ( pResource.startsWith( "resource:" ) ) { String res = pResource.substring( "resource:".length() ); return resolveAsResource( res ); } URL url = resolveAsResource( pResource ); if ( url == null ) { url = resolveAsURL( pResource ); if ( url == null ) { url = resolveAsFile( pResource ); } } try { return locator.getResource( pResource ).getURL(); } catch ( ResourceNotFoundException e ) { return null; } catch ( IOException e ) { return null; } } /** * Implementation of {@link EntityResolver2#getExternalSubset(String, String)} */ public InputSource getExternalSubset( String name, String baseURI ) throws SAXException, IOException { return null; } /** * Implementation of {@link EntityResolver2#resolveEntity(String, String, String, String)} */ public InputSource resolveEntity( String pName, String pPublicId, String pBaseURI, String pSystemId ) throws SAXException, IOException { final InputSource source = resolver.resolveEntity( pPublicId, pSystemId ); if ( source != null ) { return source; } URL url = resolve( pSystemId ); if ( url != null ) { return asInputSource( url ); } return null; } } xml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/validation/0000755000175000017500000000000012635321500030155 5ustar eugeneeugen././@LongLink0000644000000000000000000000015200000000000011601 Lustar rootrootxml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/validation/ValidationSet.javaxml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/validation/ValidationSet0000644000175000017500000001251412635321500032651 0ustar eugeneeugenpackage org.codehaus.mojo.xml.validation; /* * 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. */ import java.io.File; /** * An instance of this class is used to specify a set of files, which are validated against a common schema. */ public class ValidationSet { private String publicId; private String systemId; private String schemaLanguage; private boolean validating; private File dir; private String[] includes; private String[] excludes; private boolean skipDefaultExcludes; /** * Returns a directory, which is scanned for files to validate. */ public File getDir() { return this.dir; } /** * Returns patterns of files, which are being excluded from the validation set. */ public String[] getExcludes() { return excludes; } /** * Returns patterns of files, which are being included into the validation set. */ public String[] getIncludes() { return includes; } /** * Returns the schemas public ID. May be null, if the schema is loaded through its system ID or if the documents are * being validated for wellformedness only. */ public String getPublicId() { return publicId; } /** * Returns the schema language. May be null, if the documents are being validated for wellformedness only, or if the * default schema language (W3C XML Schema) is being used. See * http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/validation/SchemaFactory.html for possible values. */ public String getSchemaLanguage() { return schemaLanguage; } /** * Returns the schemas system ID. May be null, if the schema is loaded through its public ID or if the documents are * being validated for wellformedness only. */ public String getSystemId() { return systemId; } /** * Returns, whether Maven's default excludes are being ignored. Defaults to false (Default excludes are being used). */ public boolean isSkipDefaultExcludes() { return skipDefaultExcludes; } /** * If the documents are being validated for wellformedness only: Returns, whether the parser should be validating. * (In other words: Whether documents must contain a document type or xml schema declaration.) The property is * ignored otherwise. The default value is false. */ public boolean isValidating() { return validating; } /** * Sets a directory, which is scanned for files to validate. */ public void setDir( File pDir ) { dir = pDir; } /** * Sets patterns of files, which are being excluded from the validation set. */ public void setExcludes( String[] pExcludes ) { excludes = pExcludes; } /** * Sets patterns of files, which are being included into the validation set. */ public void setIncludes( String[] pIncludes ) { includes = pIncludes; } /** * Sets the schemas public ID. May be null, if the schema is loaded through its system ID or if the documents are * being validated for wellformedness only. */ public void setPublicId( String pPublicId ) { publicId = pPublicId; } /** * Sets the schema language. May be null, if the documents are being validated for wellformedness only, or if the * default schema language (W3C XML Schema) is being used. See * http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/validation/SchemaFactory.html for possible values. */ public void setSchemaLanguage( String pSchemaLanguage ) { schemaLanguage = pSchemaLanguage; } /** * Sets, whether Maven's default excludes are being ignored. Defaults to false (Default excludes are being used). */ public void setSkipDefaultExcludes( boolean pSkipDefaultExcludes ) { skipDefaultExcludes = pSkipDefaultExcludes; } /** * Sets the schemas system ID. May be null, if the schema is loaded through its public ID or if the documents are * being validated for wellformedness only. */ public void setSystemId( String pSystemId ) { systemId = pSystemId; } /** * If the documents are being validated for wellformedness only: Sets, whether the parser should be validating. (In * other words: Whether documents must contain a document type or xml schema declaration.) The property is ignored * otherwise. The default value is false. */ public void setValidating( boolean pValidating ) { validating = pValidating; } } xml-maven-plugin-xml-maven-plugin-1.0.1/src/main/checkstyle/0000755000175000017500000000000012635321500023112 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/main/checkstyle/maven-header.txt0000644000175000017500000000166212635321500026214 0ustar eugeneeugen^package ^\s*$ ^/\*\s*$ ^ \* Licensed to the Apache Software Foundation \(ASF\) under one\s*$ ^ \* or more contributor license agreements. See the NOTICE file\s*$ ^ \* distributed with this work for additional information\s*$ ^ \* regarding copyright ownership. The ASF licenses this file\s*$ ^ \* to you under the Apache License, Version 2.0 \(the\s*$ ^ \* "License"\)\; you may not use this file except in compliance\s*$ ^ \* with the License. You may obtain a copy of the License at\s*$ ^ \*\s*$ ^ \*\s+http://www\.apache\.org/licenses/LICENSE-2\.0\s*$ ^ \*\s*$ ^ \* Unless required by applicable law or agreed to in writing,\s*$ ^ \* software distributed under the License is distributed on an\s*$ ^ \* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\s*$ ^ \* KIND, either express or implied. See the License for the\s*$ ^ \* specific language governing permissions and limitations\s*$ ^ \* under the License.\s*$ ^ \*/\s*$ ^\s*$ xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/0000755000175000017500000000000012635321500021007 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/resources/0000755000175000017500000000000012635321500023021 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/resources/org/0000755000175000017500000000000012635321500023610 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/resources/org/codehaus/0000755000175000017500000000000012635321500025403 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/resources/org/codehaus/mojo/0000755000175000017500000000000012635321500026347 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/resources/org/codehaus/mojo/xml/0000755000175000017500000000000012635321500027147 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/resources/org/codehaus/mojo/xml/test/0000755000175000017500000000000012635321500030126 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/resources/org/codehaus/mojo/xml/test/it10a.xsl0000644000175000017500000000144612635321500031601 0ustar eugeneeugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/resources/org/codehaus/mojo/xml/test/it9a.xml0000644000175000017500000000117212635321500031517 0ustar eugeneeugen it9a xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it5/0000755000175000017500000000000012635321500021510 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it5/xml/0000755000175000017500000000000012635321500022310 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it5/xml/doc1.xml0000644000175000017500000000127212635321500023662 0ustar eugeneeugen A sample document, which should be validatable without any problems. xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it5/pom.xml0000644000175000017500000000327412635321500023033 0ustar eugeneeugen 4.0.0 org.codehaus.mojo.xml it5 0.1 Maven XML Plugin IT 5 Integration Test 5 for the Maven XML Plugin org.codehaus.mojo xml-maven-plugin 0.2 transform xml it5.xsl aParameter parameter passed in xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it5/it5.xsl0000644000175000017500000000154212635321500022743 0ustar eugeneeugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/java/0000755000175000017500000000000012635321500021730 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/java/org/0000755000175000017500000000000012635321500022517 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/java/org/codehaus/0000755000175000017500000000000012635321500024312 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/java/org/codehaus/mojo/0000755000175000017500000000000012635321500025256 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/java/org/codehaus/mojo/xml/0000755000175000017500000000000012635321500026056 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/java/org/codehaus/mojo/xml/test/0000755000175000017500000000000012635321500027035 5ustar eugeneeugen././@LongLink0000644000000000000000000000015000000000000011577 Lustar rootrootxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/java/org/codehaus/mojo/xml/test/TransformMojoTest.javaxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/java/org/codehaus/mojo/xml/test/TransformMojoTest.j0000644000175000017500000002313312635321500032652 0ustar eugeneeugen/* * Copyright 2006 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.codehaus.mojo.xml.test; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; import java.io.StringReader; import java.io.StringWriter; import java.lang.reflect.InvocationTargetException; import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; import org.codehaus.mojo.xml.TransformMojo; import org.codehaus.mojo.xml.transformer.TransformationSet; import org.codehaus.plexus.components.io.filemappers.FileExtensionMapper; import org.codehaus.plexus.util.FileUtils; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; /** * Test case for the {@link TransformMojo}. */ public class TransformMojoTest extends AbstractXmlMojoTestCase { protected String getGoal() { return "transform"; } /** * Common code for the it4, it6 and it10 test projects. */ public void runTestIt4( String dir, String targetFile ) throws Exception { TransformMojo mojo = (TransformMojo) newMojo( dir ); mojo.execute(); Document doc1 = parse( new File( dir, "xml/doc1.xml" ) ); doc1.normalize(); Document doc2 = parse( new File( dir, "target/generated-resources/xml/xslt/" + targetFile ) ); doc2.normalize(); Element doc1Element = doc1.getDocumentElement(); assertEquals( "doc1", doc1Element.getLocalName() ); assertNull( doc1Element.getNamespaceURI() ); Element doc2Element = doc2.getDocumentElement(); assertEquals( "doc2", doc2Element.getLocalName() ); assertNull( doc2Element.getNamespaceURI() ); Node text1 = doc1Element.getFirstChild(); assertNotNull( text1 ); assertNull( text1.getNextSibling() ); assertEquals( Node.TEXT_NODE, text1.getNodeType() ); Node text2 = doc2Element.getFirstChild(); assertNotNull( text2 ); assertNull( text2.getNextSibling() ); assertEquals( Node.TEXT_NODE, text2.getNodeType() ); assertEquals( text1.getNodeValue(), text2.getNodeValue() ); } /** * Builds the it4 test project. */ public void testIt4() throws Exception { runTestIt4( "src/test/it4", "doc1.xml" ); } /** * Builds the it5 test project. */ public void testIt5() throws Exception { final String dir = "src/test/it5"; runTest( dir ); Document doc1 = parse( new File( dir, "xml/doc1.xml" ) ); doc1.normalize(); Document doc2 = parse( new File( dir, "target/generated-resources/xml/xslt/doc1.xml" ) ); doc2.normalize(); Element doc1Element = doc1.getDocumentElement(); assertEquals( "doc1", doc1Element.getLocalName() ); assertNull( doc1Element.getNamespaceURI() ); Element doc2Element = doc2.getDocumentElement(); assertEquals( "doc2", doc2Element.getLocalName() ); assertNull( doc2Element.getNamespaceURI() ); Node text1 = doc1Element.getFirstChild(); assertNotNull( text1 ); assertNull( text1.getNextSibling() ); assertEquals( Node.TEXT_NODE, text1.getNodeType() ); Node text2 = doc2Element.getFirstChild(); assertNotNull( text2 ); assertNull( text2.getNextSibling() ); assertEquals( Node.TEXT_NODE, text2.getNodeType() ); assertEquals( text2.getNodeValue(), "parameter passed in" ); } /** * Builds the it6 test project. */ public void testIt6() throws Exception { FileExtensionMapper fileExtensionMapper = new FileExtensionMapper(); fileExtensionMapper.setTargetExtension( ".fo" ); runTestIt4( "src/test/it6", "doc1.fo" ); } private String read( File file ) throws IOException { final StringBuffer sb = new StringBuffer(); final Reader reader = new InputStreamReader( new FileInputStream( file ), "UTF-8" ); final char[] buffer = new char[4096]; for ( ;; ) { final int res = reader.read( buffer ); if ( res == -1 ) { break; } if ( res > 0 ) { sb.append( buffer, 0, res ); } } reader.close(); return sb.toString(); } /** * Builds the it7 test project. */ public void testIt7() throws Exception { final File dir = new File( "src/test/it7" ); final File target = new File( dir, "target/generated-resources/xml/xslt/doc1.xml" ); TransformMojo mojo = (TransformMojo) newMojo( dir.getPath() ); FileUtils.fileDelete( target.getPath() ); mojo.execute(); String result = read( target ); assertFalse( result.startsWith( "\n" + "\n" + "\n" + "\n" + "\n"; final StringWriter sw = new StringWriter(); final Transformer t = TransformMojo.newTransformerFactory( org.apache.xalan.processor.TransformerFactoryImpl.class.getName(), getClass().getClassLoader() ).newTransformer( new StreamSource( new StringReader( xsl ) ) ); t.setOutputProperty( OutputKeys.OMIT_XML_DECLARATION, "yes" ); t.transform( new DOMSource( contextNode ), new StreamResult( sw ) ); return sw.toString(); } /** * Builds the it7 test project. */ public void testIt8() throws Exception { if ( !java1_6_Aware() ) { System.out.println( " skip test due to non compliance jvm version need 1.6" ); return; } final String dir = "src/test/it8"; runTest( dir ); Document doc1 = parse( new File( dir, "target/generated-resources/xml/xslt/doc1.xml" ) ); assertEquals( "SAXON 8.7 from Saxonica", eval( doc1, "/root/vendor" ) ); assertEquals( "http://www.saxonica.com/", eval( doc1, "/root/vendor-url" ) ); assertEquals( "2.0", eval( doc1, "/root/version" ) ); } /** * Builds the it10 test project. */ public void testIt10() throws Exception { runTestIt4( "src/test/it10", "doc1.xml" ); } /** * Builds the it11 test project, tests in-place modification. */ public void testIt11() throws Exception { String projectPath = "src/test/it11"; File projectDirectory = new File( getBasedir(), projectPath ); File targetDirectory = new File( projectPath, "target" ); if ( targetDirectory.exists() ) { FileUtils.cleanDirectory( targetDirectory ); } File xmlInputDirectory = new File( projectDirectory, "xml" ); File xmlOutputDirectory = new File( targetDirectory, "generated-resources/xml/xslt" ); /* copy to target since that is in an SCM-ignored directory */ FileUtils.copyDirectory( xmlInputDirectory, xmlOutputDirectory, "*.xml", null ); TransformMojo mojo = (TransformMojo) newMojo( projectPath ); mojo.execute(); String fileToTransform = "doc1.xml"; Document doc1 = parse( new File( xmlInputDirectory, fileToTransform ) ); doc1.normalize(); Document doc2 = parse( new File( xmlOutputDirectory, fileToTransform ) ); doc2.normalize(); Element doc1Element = doc1.getDocumentElement(); assertEquals( "doc1", doc1Element.getLocalName() ); assertNull( doc1Element.getNamespaceURI() ); Element doc2Element = doc2.getDocumentElement(); assertEquals( "doc2", doc2Element.getLocalName() ); assertNull( doc2Element.getNamespaceURI() ); Node text1 = doc1Element.getFirstChild(); assertNotNull( text1 ); assertNull( text1.getNextSibling() ); assertEquals( Node.TEXT_NODE, text1.getNodeType() ); Node text2 = doc2Element.getFirstChild(); assertNotNull( text2 ); assertNull( text2.getNextSibling() ); assertEquals( Node.TEXT_NODE, text2.getNodeType() ); assertEquals( text1.getNodeValue(), text2.getNodeValue() ); } } ././@LongLink0000644000000000000000000000015600000000000011605 Lustar rootrootxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/java/org/codehaus/mojo/xml/test/AbstractXmlMojoTestCase.javaxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/java/org/codehaus/mojo/xml/test/AbstractXmlMojoTest0000644000175000017500000001010612635321500032667 0ustar eugeneeugen/* * Copyright 2006 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.codehaus.mojo.xml.test; import java.io.File; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.util.HashMap; import java.util.Map; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.apache.maven.model.Build; import org.apache.maven.plugin.logging.Log; import org.apache.maven.plugin.testing.AbstractMojoTestCase; import org.apache.maven.plugin.testing.SilentLog; import org.apache.maven.plugin.testing.stubs.MavenProjectStub; import org.codehaus.mojo.xml.AbstractXmlMojo; import org.codehaus.mojo.xml.TransformMojo; import org.codehaus.plexus.resource.DefaultResourceManager; import org.codehaus.plexus.resource.loader.FileResourceLoader; import org.codehaus.plexus.resource.loader.JarResourceLoader; import org.codehaus.plexus.resource.loader.ResourceLoader; import org.codehaus.plexus.resource.loader.ThreadContextClasspathResourceLoader; import org.codehaus.plexus.resource.loader.URLResourceLoader; import org.w3c.dom.Document; import org.xml.sax.SAXException; public abstract class AbstractXmlMojoTestCase extends AbstractMojoTestCase { protected abstract String getGoal(); protected AbstractXmlMojo newMojo( String pDir ) throws Exception { File testPom = new File( new File( getBasedir(), pDir ), "pom.xml" ); AbstractXmlMojo vm = (AbstractXmlMojo) lookupMojo( getGoal(), testPom ); setVariableValueToObject( vm, "basedir", new File( getBasedir(), pDir ) ); final Log log = new SilentLog(); DefaultResourceManager rm = new DefaultResourceManager(); setVariableValueToObject( rm, "logger", log ); setVariableValueToObject( vm, "locator", rm ); final Map resourceLoaders = new HashMap(); resourceLoaders.put( "file", new FileResourceLoader() ); resourceLoaders.put( "jar", new JarResourceLoader() ); resourceLoaders.put( "classloader", new ThreadContextClasspathResourceLoader() ); URLResourceLoader url = new URLResourceLoader(); setVariableValueToObject( url, "logger", log ); resourceLoaders.put( "url", url ); setVariableValueToObject( rm, "resourceLoaders", resourceLoaders ); final Build build = new Build(); build.setDirectory( "target" ); MavenProjectStub project = new MavenProjectStub() { public Build getBuild() { return build; } }; setVariableValueToObject( vm, "project", project ); return vm; } protected void runTest( final String pDir ) throws Exception { newMojo( pDir ).execute(); } protected Document parse( File pFile ) throws SAXException, IOException, ParserConfigurationException { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setValidating( false ); dbf.setNamespaceAware( true ); return dbf.newDocumentBuilder().parse( pFile ); } protected boolean java1_6_Aware() throws IllegalAccessException, InvocationTargetException { try { TransformMojo.newTransformerFactory( "net.sf.saxon.TransformerFactoryImpl", Thread.currentThread().getContextClassLoader() ); return true; } catch ( NoSuchMethodException e ) { return false; } } } ././@LongLink0000644000000000000000000000014700000000000011605 Lustar rootrootxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/java/org/codehaus/mojo/xml/test/ValidateMojoTest.javaxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/java/org/codehaus/mojo/xml/test/ValidateMojoTest.ja0000644000175000017500000000407012635321500032570 0ustar eugeneeugenpackage org.codehaus.mojo.xml.test; /* * Copyright 2006 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. */ import org.apache.maven.plugin.MojoExecutionException; import org.xml.sax.SAXParseException; /** * Test case for the {@link CheckFormatMojo}. */ public class ValidateMojoTest extends AbstractXmlMojoTestCase { protected String getGoal() { return "validate"; } /** * Builds the it1 test project. */ public void testIt1() throws Exception { runTest( "src/test/it1" ); } /** * Builds the it2 test project. */ public void testIt2() throws Exception { try { runTest( "src/test/it2" ); fail( "Expected exception" ); } catch ( MojoExecutionException e ) { Throwable t = e.getCause(); assertNotNull( t ); assertTrue( t instanceof SAXParseException ); SAXParseException ex = (SAXParseException) t; assertEquals( 20, ex.getLineNumber() ); } } /** * Builds the it3 test project. */ public void testIt3() throws Exception { runTest( "src/test/it3" ); } /** * Builds the it9 test project. */ public void testIt9() throws Exception { runTest( "src/test/it9" ); } /** * Builds and runs the it12 test project (MOJO-1648) */ public void testIt12() throws Exception { runTest( "src/test/it12" ); } } xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it12/0000755000175000017500000000000012635321500021566 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it12/xml/0000755000175000017500000000000012635321500022366 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it12/xml/DoRequest.xml0000644000175000017500000000022412635321500025021 0ustar eugeneeugen D xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it12/xsd/0000755000175000017500000000000012635321500022364 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it12/xsd/messages.xsd0000644000175000017500000000077212635321500024721 0ustar eugeneeugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it12/xsd/simpletypes.xsd0000644000175000017500000000064712635321500025471 0ustar eugeneeugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it12/catalogue.xml0000644000175000017500000000136212635321500024256 0ustar eugeneeugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it12/pom.xml0000644000175000017500000000404012635321500023101 0ustar eugeneeugen 4.0.0 org.codehaus.mojo.xml it12 0.1 Maven XML Plugin IT 12 Integration Test 12 for the Maven XML Plugin org.codehaus.mojo xml-maven-plugin 1.0.1-SNAPSHOT validate xml wise4all catalogue.xml xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it11/0000755000175000017500000000000012635321500021565 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it11/it11.xsl0000644000175000017500000000147412635321500023101 0ustar eugeneeugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it11/xml/0000755000175000017500000000000012635321500022365 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it11/xml/doc1.xml0000644000175000017500000000131412635321500023734 0ustar eugeneeugen A sample document, which should be validatable without any problems. xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it11/pom.xml0000644000175000017500000000314212635321500023102 0ustar eugeneeugen 4.0.0 org.codehaus.mojo.xml it10 0.1 Maven XML Plugin IT 10 Integration Test 10 for the Maven XML Plugin org.codehaus.mojo xml-maven-plugin 0.2 transform target/generated-resources/xml/xslt it11.xsl xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it4/0000755000175000017500000000000012635321500021507 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it4/xml/0000755000175000017500000000000012635321500022307 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it4/xml/doc1.xml0000644000175000017500000000127212635321500023661 0ustar eugeneeugen A sample document, which should be validatable without any problems. xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it4/pom.xml0000644000175000017500000000301412635321500023022 0ustar eugeneeugen 4.0.0 org.codehaus.mojo.xml it4 0.1 Maven XML Plugin IT 4 Integration Test 4 for the Maven XML Plugin org.codehaus.mojo xml-maven-plugin 0.2 transform xml it4.xsl xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it4/it4.xsl0000644000175000017500000000147412635321500022745 0ustar eugeneeugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it7/0000755000175000017500000000000012635321500021512 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it7/xml/0000755000175000017500000000000012635321500022312 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it7/xml/doc1.xml0000644000175000017500000000127212635321500023664 0ustar eugeneeugen A sample document, which should be validatable without any problems. xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it7/pom.xml0000644000175000017500000000361412635321500023033 0ustar eugeneeugen 4.0.0 org.codehaus.mojo.xml it7 0.1 Maven XML Plugin IT 7 Integration Test 7 for the Maven XML Plugin org.codehaus.mojo xml-maven-plugin transform xml it7.xsl omit-xml-declaration yes xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it7/it7.xsl0000644000175000017500000000144612635321500022752 0ustar eugeneeugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it3/0000755000175000017500000000000012635321500021506 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it3/xml/0000755000175000017500000000000012635321500022306 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it3/xml/doc1.xml0000644000175000017500000000123712635321500023661 0ustar eugeneeugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it3/schema.xsd0000644000175000017500000000200712635321500023465 0ustar eugeneeugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it3/pom.xml0000644000175000017500000000265412635321500023032 0ustar eugeneeugen 4.0.0 org.codehaus.mojo.xml it3 0.1 Maven XML Plugin IT 3 Integration Test 3 for the Maven XML Plugin org.codehaus.mojo xml-maven-plugin 0.2 xml --COUNTER-- catalog.xml xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it3/catalog.xml0000644000175000017500000000135712635321500023650 0ustar eugeneeugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it6/0000755000175000017500000000000012635321500021511 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it6/xml/0000755000175000017500000000000012635321500022311 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it6/xml/doc1.xml0000644000175000017500000000127212635321500023663 0ustar eugeneeugen A sample document, which should be validatable without any problems. xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it6/pom.xml0000644000175000017500000000343412635321500023032 0ustar eugeneeugen 4.0.0 org.codehaus.mojo.xml it6 0.1 Maven XML Plugin IT 1 Integration Test 1 for the Maven XML Plugin org.codehaus.mojo xml-maven-plugin 1.0-beta-2-SNAPSHOT transform xml it4.xsl .fo xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it6/it4.xsl0000644000175000017500000000144612635321500022746 0ustar eugeneeugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it1/0000755000175000017500000000000012635321500021504 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it1/xml/0000755000175000017500000000000012635321500022304 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it1/xml/doc1.xml0000644000175000017500000000127212635321500023656 0ustar eugeneeugen A sample document, which should be validatable without any problems. xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it1/pom.xml0000644000175000017500000000273412635321500023027 0ustar eugeneeugen 4.0.0 org.codehaus.mojo.xml it1 0.1 Maven XML Plugin IT 1 Integration Test 1 for the Maven XML Plugin org.codehaus.mojo xml-maven-plugin 1.0-beta-2-SNAPSHOT validate xml xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it2/0000755000175000017500000000000012635321500021505 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it2/xml/0000755000175000017500000000000012635321500022305 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it2/xml/doc1.xml0000644000175000017500000000127112635321500023656 0ustar eugeneeugen A sample document, on which validation should report a problem. xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it2/pom.xml0000644000175000017500000000244712635321500023031 0ustar eugeneeugen 4.0.0 org.codehaus.mojo.xml it2 0.1 Maven XML Plugin IT 2 Integration Test 2 for the Maven XML Plugin org.codehaus.mojo xml-maven-plugin 0.2 xml xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it10/0000755000175000017500000000000012635321500021564 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it10/xml/0000755000175000017500000000000012635321500022364 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it10/xml/doc1.xml0000644000175000017500000000127212635321500023736 0ustar eugeneeugen A sample document, which should be validatable without any problems. xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it10/pom.xml0000644000175000017500000000260612635321500023105 0ustar eugeneeugen 4.0.0 org.codehaus.mojo.xml it10 0.1 Maven XML Plugin IT 10 Integration Test 10 for the Maven XML Plugin org.codehaus.mojo xml-maven-plugin 0.2 xml org/codehaus/mojo/xml/test/it10a.xsl xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it8/0000755000175000017500000000000012635321500021513 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it8/it8.xsl0000644000175000017500000000202512635321500022746 0ustar eugeneeugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it8/xml/0000755000175000017500000000000012635321500022313 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it8/xml/doc1.xml0000644000175000017500000000127012635321500023663 0ustar eugeneeugen A sample document, which should be validatable without any problems. xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it8/pom.xml0000644000175000017500000000401112635321500023024 0ustar eugeneeugen 4.0.0 org.codehaus.mojo.xml it8 0.1 Maven XML Plugin IT 8 Integration Test 8 for the Maven XML Plugin org.codehaus.mojo xml-maven-plugin 1.0-beta-2-SNAPSHOT transform net.sf.saxon.TransformerFactoryImpl xml it8.xsl net.sf.saxon saxon 8.7 xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it9/0000755000175000017500000000000012635321500021514 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it9/xml/0000755000175000017500000000000012635321500022314 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it9/xml/doc1.xml0000644000175000017500000000155312635321500023670 0ustar eugeneeugen ]> A sample document, which should be validatable without any problems. &it9a1; &it9a2; xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it9/pom.xml0000644000175000017500000000274712635321500023043 0ustar eugeneeugen 4.0.0 org.codehaus.mojo.xml it9 0.1 Maven XML Plugin IT 9 Integration Test 9 for the Maven XML Plugin org.codehaus.mojo xml-maven-plugin 0.2 xml xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/0000755000175000017500000000000012635321500020444 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/mojo-1438-transform/0000755000175000017500000000000012635321500024016 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/mojo-1438-transform/src/0000755000175000017500000000000012635321500024605 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/mojo-1438-transform/src/main/0000755000175000017500000000000012635321500025531 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/mojo-1438-transform/src/main/xml/0000755000175000017500000000000012635321500026331 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/mojo-1438-transform/src/main/xml/doc1.xml0000644000175000017500000000140312635321500027677 0ustar eugeneeugen
A sample document.
xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/mojo-1438-transform/src/main/xml/catalog.xml0000644000175000017500000000135112635321500030465 0ustar eugeneeugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/mojo-1438-transform/src/main/xsl/0000755000175000017500000000000012635321500026337 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/mojo-1438-transform/src/main/xsl/it10.xsl0000644000175000017500000000202512635321500027643 0ustar eugeneeugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/mojo-1438-transform/src/main/dtd/0000755000175000017500000000000012635321500026304 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/mojo-1438-transform/src/main/dtd/sample.dtd0000644000175000017500000000006412635321500030262 0ustar eugeneeugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/mojo-1438-transform/pom.xml0000644000175000017500000000352112635321500025334 0ustar eugeneeugen 4.0.0 org.codehaus.mojo.xml it10 0.1 Maven XML Plugin IT 10 Integration Test 10 for the Maven XML Plugin org.codehaus.mojo xml-maven-plugin @pom.version@ transform src/main/xml src/main/xsl/it10.xsl src/main/xml/catalog.xml xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/mojo-1438-transform/invoker.properties0000644000175000017500000000004412635321500027607 0ustar eugeneeugeninvoker.goals = clean xml:transform xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it5/0000755000175000017500000000000012635321500021145 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it5/src/0000755000175000017500000000000012635321500021734 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it5/src/main/0000755000175000017500000000000012635321500022660 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it5/src/main/xml/0000755000175000017500000000000012635321500023460 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it5/src/main/xml/doc1.xml0000644000175000017500000000127212635321500025032 0ustar eugeneeugen A sample document, which should be validatable without any problems. xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it5/src/main/xsl/0000755000175000017500000000000012635321500023466 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it5/src/main/xsl/it5.xsl0000644000175000017500000000155012635321500024720 0ustar eugeneeugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it5/pom.xml0000644000175000017500000000337212635321500022467 0ustar eugeneeugen 4.0.0 org.codehaus.mojo.xml it5 0.1 Maven XML Plugin IT 5 Integration Test 5 for the Maven XML Plugin org.codehaus.mojo xml-maven-plugin @pom.version@ transform src/main/xml src/main/xsl/it5.xsl aParameter parameter passed in xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it5/invoker.properties0000644000175000017500000000004412635321500024736 0ustar eugeneeugeninvoker.goals = clean xml:transform xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/check-format-pass/0000755000175000017500000000000012635321500023753 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/check-format-pass/src/0000755000175000017500000000000012635321500024542 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/check-format-pass/src/main/0000755000175000017500000000000012635321500025466 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/check-format-pass/src/main/xml/0000755000175000017500000000000012635321500026266 5ustar eugeneeugen././@LongLink0000644000000000000000000000016300000000000011603 Lustar rootrootxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/check-format-pass/src/main/xml/2-spaces-correct-no-schema-short.xmlxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/check-format-pass/src/main/xml/2-spaces-correct-no-sc0000644000175000017500000000016412635321500032303 0ustar eugeneeugen text in text-1 ././@LongLink0000644000000000000000000000015500000000000011604 Lustar rootrootxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/check-format-pass/src/main/xml/2-spaces-correct-no-schema.xmlxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/check-format-pass/src/main/xml/2-spaces-correct-no-sc0000644000175000017500000000275112635321500032307 0ustar eugeneeugen text in text-1 text in text-2 text in text-2 text in text-2 text in text-2 long text on level-2text in text-2 long text on level-2 text in text-2 text in text-3 text in text-3 text in text-3 text in text-3 text in text-3 text in text-3 text in text-3 text in text-3 text on level-4 text on level-4 text in text-5 text in text-5 text in text-5 text in text-5 text in text-5 text in text-5 text in text-5 text in text-5 text in text-6 text in text-6 text in text-6 text in text-6 text in text-6 text in text-6 text in text-6 text in text-6 text in text-7 text in text-8 text in text-9 text in text-9 xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/check-format-pass/verify.groovy0000644000175000017500000000106412635321500026527 0ustar eugeneeugenimport org.codehaus.plexus.util.FileUtils File logFile = new File(basedir, "build.log") assert logFile.isFile() String logContent = FileUtils.fileRead(logFile, "UTF-8"); assert logContent =~ /\[DEBUG\] No XML formatting violations found in file [^\n]+2-spaces-correct-no-schema\.xml/ assert logContent =~ /\[DEBUG\] No XML formatting violations found in file [^\n]+2-spaces-correct-no-schema-short\.xml/ assert logContent =~ /\[DEBUG\] No XML formatting violations found in file [^\n]+pom\.xml/ assert logContent =~ /\[DEBUG\] Checked the formatting of 3 files/ xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/check-format-pass/pom.xml0000644000175000017500000000275712635321500025303 0ustar eugeneeugen 4.0.0 org.codehaus.mojo.xml check-format-pass 0.1 Maven XML Plugin check-format Mojo test Maven XML Plugin check-format Mojo test UTF-8 org.codehaus.mojo xml-maven-plugin @pom.version@ validate 2 xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/check-format-pass/invoker.properties0000644000175000017500000000006612635321500027550 0ustar eugeneeugeninvoker.goals = xml:check-format invoker.debug = true xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it4/0000755000175000017500000000000012635321500021144 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it4/src/0000755000175000017500000000000012635321500021733 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it4/src/main/0000755000175000017500000000000012635321500022657 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it4/src/main/xml/0000755000175000017500000000000012635321500023457 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it4/src/main/xml/doc1.xml0000644000175000017500000000127212635321500025031 0ustar eugeneeugen A sample document, which should be validatable without any problems. xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it4/src/main/xsl/0000755000175000017500000000000012635321500023465 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it4/src/main/xsl/it4.xsl0000644000175000017500000000144612635321500024722 0ustar eugeneeugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it4/pom.xml0000644000175000017500000000305412635321500022463 0ustar eugeneeugen 4.0.0 org.codehaus.mojo.xml it4 0.1 Maven XML Plugin IT 4 Integration Test 4 for the Maven XML Plugin org.codehaus.mojo xml-maven-plugin @pom.version@ transform src/main/xml src/main/xsl/it4.xsl xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it4/invoker.properties0000644000175000017500000000004312635321500024734 0ustar eugeneeugeninvoker.goals = clean xml:transformxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it7/0000755000175000017500000000000012635321500021147 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it7/src/0000755000175000017500000000000012635321500021736 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it7/src/main/0000755000175000017500000000000012635321500022662 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it7/src/main/xml/0000755000175000017500000000000012635321500023462 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it7/src/main/xml/doc1.xml0000644000175000017500000000127212635321500025034 0ustar eugeneeugen A sample document, which should be validatable without any problems. xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it7/src/main/xsl/0000755000175000017500000000000012635321500023470 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it7/src/main/xsl/it7.xsl0000644000175000017500000000144612635321500024730 0ustar eugeneeugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it7/pom.xml0000644000175000017500000000371312635321500022470 0ustar eugeneeugen 4.0.0 org.codehaus.mojo.xml it7 0.1 Maven XML Plugin IT 7 Integration Test 7 for the Maven XML Plugin org.codehaus.mojo xml-maven-plugin @pom.version@ transform src/main/xml src/main/xsl/it7.xsl omit-xml-declaration yes xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it7/invoker.properties0000644000175000017500000000004412635321500024740 0ustar eugeneeugeninvoker.goals = clean xml:transform xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it3/0000755000175000017500000000000012635321500021143 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it3/src/0000755000175000017500000000000012635321500021732 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it3/src/main/0000755000175000017500000000000012635321500022656 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it3/src/main/xml/0000755000175000017500000000000012635321500023456 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it3/src/main/xml/doc1.xml0000644000175000017500000000123712635321500025031 0ustar eugeneeugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it3/src/main/xml/catalog.xml0000644000175000017500000000136612635321500025620 0ustar eugeneeugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it3/src/main/xsd/0000755000175000017500000000000012635321500023454 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it3/src/main/xsd/schema.xsd0000644000175000017500000000200712635321500025433 0ustar eugeneeugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it3/pom.xml0000644000175000017500000000305312635321500022461 0ustar eugeneeugen 4.0.0 org.codehaus.mojo.xml it3 0.1 Maven XML Plugin IT 3 Integration Test 3 for the Maven XML Plugin org.codehaus.mojo xml-maven-plugin @pom.version@ src/main/xml doc1.xml --COUNTER-- src/main/xml/catalog.xml xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it3/invoker.properties0000644000175000017500000000003512635321500024734 0ustar eugeneeugeninvoker.goals = xml:validate xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/settings.xml0000644000175000017500000000317412635321500023033 0ustar eugeneeugen it-repo true local.central @localRepositoryUrl@ true true local.central @localRepositoryUrl@ true true xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/mojo-1438-validate/0000755000175000017500000000000012635321500023574 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/mojo-1438-validate/src/0000755000175000017500000000000012635321500024363 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/mojo-1438-validate/src/main/0000755000175000017500000000000012635321500025307 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/mojo-1438-validate/src/main/xml/0000755000175000017500000000000012635321500026107 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/mojo-1438-validate/src/main/xml/doc1.xml0000644000175000017500000000142412635321500027460 0ustar eugeneeugen
A sample document.
xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/mojo-1438-validate/src/main/xml/catalog.xml0000644000175000017500000000170212635321500030243 0ustar eugeneeugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/mojo-1438-validate/src/main/dtd/0000755000175000017500000000000012635321500026062 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/mojo-1438-validate/src/main/dtd/sample.dtd0000644000175000017500000000006412635321500030040 0ustar eugeneeugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/mojo-1438-validate/src/main/xsd/0000755000175000017500000000000012635321500026105 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/mojo-1438-validate/src/main/xsd/schema.xsd0000644000175000017500000000173312635321500030071 0ustar eugeneeugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/mojo-1438-validate/pom.xml0000644000175000017500000000346212635321500025116 0ustar eugeneeugen 4.0.0 org.codehaus.mojo.xml it11 0.1 Maven XML Plugin IT 11 Integration Test 11 for the Maven XML Plugin org.codehaus.mojo xml-maven-plugin @pom.version@ validate src/main/xml --COUNTER-- src/main/xml/catalog.xml xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/mojo-1438-validate/invoker.properties0000644000175000017500000000006712635321500027372 0ustar eugeneeugeninvoker.goals = clean test invoker.java.version = 1.6+ xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it6/0000755000175000017500000000000012635321500021146 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it6/src/0000755000175000017500000000000012635321500021735 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it6/src/main/0000755000175000017500000000000012635321500022661 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it6/src/main/xml/0000755000175000017500000000000012635321500023461 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it6/src/main/xml/doc1.xml0000644000175000017500000000127212635321500025033 0ustar eugeneeugen A sample document, which should be validatable without any problems. xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it6/src/main/xsl/0000755000175000017500000000000012635321500023467 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it6/src/main/xsl/it4.xsl0000644000175000017500000000144612635321500024724 0ustar eugeneeugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it6/pom.xml0000644000175000017500000000345412635321500022471 0ustar eugeneeugen 4.0.0 org.codehaus.mojo.xml it6 0.1 Maven XML Plugin IT 1 Integration Test 1 for the Maven XML Plugin org.codehaus.mojo xml-maven-plugin @pom.version@ transform src/main/xml src/main/xsl/it4.xsl .fo xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it6/invoker.properties0000644000175000017500000000004412635321500024737 0ustar eugeneeugeninvoker.goals = clean xml:transform xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/check-format-fail/0000755000175000017500000000000012635321500023720 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/check-format-fail/src/0000755000175000017500000000000012635321500024507 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/check-format-fail/src/main/0000755000175000017500000000000012635321500025433 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/check-format-fail/src/main/xml/0000755000175000017500000000000012635321500026233 5ustar eugeneeugen././@LongLink0000644000000000000000000000016200000000000011602 Lustar rootrootxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/check-format-fail/src/main/xml/2-spaces-broken-no-schema-short.xmlxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/check-format-fail/src/main/xml/2-spaces-broken-no-sch0000644000175000017500000000016512635321500032240 0ustar eugeneeugen text in text-1 xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/check-format-fail/verify.groovy0000644000175000017500000000074612635321500026502 0ustar eugeneeugenimport org.codehaus.plexus.util.FileUtils File logFile = new File(basedir, "build.log") assert logFile.isFile() String logContent = FileUtils.fileRead(logFile, "UTF-8"); assert logContent =~ /\[ERROR\] [^ \n]*2-spaces-broken-no-schema-short\.xml:5,14: Delete 1 spaces. Expected 4 found 5 spaces before start element / assert logContent =~ /\[DEBUG\] No XML formatting violations found in file [^\n]+pom\.xml/ assert logContent =~ /\[DEBUG\] Checked the formatting of 2 files/ xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/check-format-fail/pom.xml0000644000175000017500000000275712635321500025250 0ustar eugeneeugen 4.0.0 org.codehaus.mojo.xml check-format-fail 0.1 Maven XML Plugin check-format Mojo test Maven XML Plugin check-format Mojo test UTF-8 org.codehaus.mojo xml-maven-plugin @pom.version@ validate 2 xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/check-format-fail/invoker.properties0000644000175000017500000000012412635321500027510 0ustar eugeneeugeninvoker.goals = xml:check-format invoker.buildResult = failure invoker.debug = true xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it1/0000755000175000017500000000000012635321500021141 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it1/src/0000755000175000017500000000000012635321500021730 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it1/src/main/0000755000175000017500000000000012635321500022654 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it1/src/main/xml/0000755000175000017500000000000012635321500023454 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it1/src/main/xml/doc1.xml0000644000175000017500000000127212635321500025026 0ustar eugeneeugen A sample document, which should be validatable without any problems. xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it1/pom.xml0000644000175000017500000000273712635321500022467 0ustar eugeneeugen 4.0.0 org.codehaus.mojo.xml it1 0.1 Maven XML Plugin IT 1 Integration Test 1 for the Maven XML Plugin org.codehaus.mojo xml-maven-plugin @pom.version@ validate src/main/xml xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it1/invoker.properties0000644000175000017500000000006412635321500024734 0ustar eugeneeugeninvoker.goals = xml:validate invoker.debug = truue xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it2/0000755000175000017500000000000012635321500021142 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it2/src/0000755000175000017500000000000012635321500021731 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it2/src/main/0000755000175000017500000000000012635321500022655 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it2/src/main/xml/0000755000175000017500000000000012635321500023455 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it2/src/main/xml/doc1.xml0000644000175000017500000000127112635321500025026 0ustar eugeneeugen A sample document, on which validation should report a problem. xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it2/pom.xml0000644000175000017500000000247212635321500022464 0ustar eugeneeugen 4.0.0 org.codehaus.mojo.xml it2 0.1 Maven XML Plugin IT 2 Integration Test 2 for the Maven XML Plugin org.codehaus.mojo xml-maven-plugin @pom.version@ src/main/xml xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it2/invoker.properties0000644000175000017500000000007412635321500024736 0ustar eugeneeugeninvoker.goals = xml:validate invoker.buildResult = failure xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it8/0000755000175000017500000000000012635321500021150 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it8/src/0000755000175000017500000000000012635321500021737 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it8/src/main/0000755000175000017500000000000012635321500022663 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it8/src/main/xml/0000755000175000017500000000000012635321500023463 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it8/src/main/xml/doc1.xml0000644000175000017500000000127012635321500025033 0ustar eugeneeugen A sample document, which should be validatable without any problems. xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it8/src/main/xsl/0000755000175000017500000000000012635321500023471 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it8/src/main/xsl/it8.xsl0000644000175000017500000000202512635321500024724 0ustar eugeneeugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it8/pom.xml0000644000175000017500000000403112635321500022463 0ustar eugeneeugen 4.0.0 org.codehaus.mojo.xml it8 0.1 Maven XML Plugin IT 8 Integration Test 8 for the Maven XML Plugin org.codehaus.mojo xml-maven-plugin @pom.version@ transform net.sf.saxon.TransformerFactoryImpl src/main/xml src/main/xsl/it8.xsl net.sf.saxon saxon 8.7 xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it8/invoker.properties0000644000175000017500000000010012635321500024732 0ustar eugeneeugeninvoker.goals = clean xml:transform invoker.java.version = 1.6+ xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it9/0000755000175000017500000000000012635321500021151 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it9/src/0000755000175000017500000000000012635321500021740 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it9/src/main/0000755000175000017500000000000012635321500022664 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it9/src/main/xml/0000755000175000017500000000000012635321500023464 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it9/src/main/xml/doc1.xml0000644000175000017500000000155312635321500025040 0ustar eugeneeugen ]> A sample document, which should be validatable without any problems. &it9a1; &it9a2; xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it9/src/main/resources/0000755000175000017500000000000012635321500024676 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it9/src/main/resources/org/0000755000175000017500000000000012635321500025465 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it9/src/main/resources/org/codehaus/0000755000175000017500000000000012635321500027260 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it9/src/main/resources/org/codehaus/mojo/0000755000175000017500000000000012635321500030224 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it9/src/main/resources/org/codehaus/mojo/xml/0000755000175000017500000000000012635321500031024 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it9/src/main/resources/org/codehaus/mojo/xml/test/0000755000175000017500000000000012635321500032003 5ustar eugeneeugen././@LongLink0000644000000000000000000000015200000000000011601 Lustar rootrootxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it9/src/main/resources/org/codehaus/mojo/xml/test/it9a.xmlxml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it9/src/main/resources/org/codehaus/mojo/xml/test/it90000644000175000017500000000117212635321500032434 0ustar eugeneeugen it9a xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it9/pom.xml0000644000175000017500000000277212635321500022476 0ustar eugeneeugen 4.0.0 org.codehaus.mojo.xml it9 0.1 Maven XML Plugin IT 9 Integration Test 9 for the Maven XML Plugin org.codehaus.mojo xml-maven-plugin @pom.version@ src/main/xml xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it9/invoker.properties0000644000175000017500000000002512635321500024741 0ustar eugeneeugeninvoker.goals = test xml-maven-plugin-xml-maven-plugin-1.0.1/src/site/0000755000175000017500000000000012635321500020774 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/site/apt/0000755000175000017500000000000012635321500021560 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/site/apt/transformation.apt0000644000175000017500000002263112635321500025340 0ustar eugeneeugen~~ ~~ ~~ Copyright 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. ~~ ~~ ---------------------- Transforming XML files ---------------------- Transforming XML files To transform XML files by applying XSLT stylesheets, use the "xml:transform" goal is used. It is configured through a section like the following in your POM: +---------------------------------------------------------------------------------- ... org.codehaus.mojo xml-maven-plugin transform xml it4.xsl ... +---------------------------------------------------------------------------------- The example would transform all files in the directory "xml" by applying the stylesheet "it4.xml". The output would be written to the directory "${project.build.directory}/generated-resources/xml/xslt" (usually "target/generated-resources/xml/xslt"). Goal properties The "xml:transform" goal offers the following configurable properties: *--------------------+-----------------------------------------------------------------+ | Property Name | Description | *--------------------+-----------------------------------------------------------------+ | basedir | The base directory, which is used for interpreting relative | | | paths. Defaults to the project directory, in which the POM | | | resides. | *--------------------+-----------------------------------------------------------------+ | catalogs | A set of catalog files, which configure the entity resolver. | | | For example, it allows to map public ID's or external URL's to | | | local files. Multiple catalog files are supported. In other | | | words, to configure a single catalog file, you would need a | | | section like this: | | | | | | \ | | | \mycatalog.xml\ | | | \ | | | | | | The interpretation of catalog files is done by the Apache XML | | | resolver. See | | | {{{http://xml.apache.org/commons/components/resolver/resolver-article.html}this}} | | | article for details on catalog files and their formats. | *--------------------+-----------------------------------------------------------------+ | transformationSets | A transformation set configures a set of XML files, which are | | | transformed by applying a common XSLT stylesheet. If you want | | | apply multiple stylesheets, use multiple transformation sets. | | | See the above example, which specifies a single transformation | | | The various child elements of a \ section | | | listed in the following section. | *--------------------+-----------------------------------------------------------------+ Transformation Set Configuration A transformation set is configured through several child elements: *---------------------+-----------------------------------------------------------------+ | Element Name | Description | *---------------------+-----------------------------------------------------------------+ | attributes | Specifies attributes, which are being set on the transformer | | | factory by invoking the setAttribute(String, Object) method. | *---------------------+-----------------------------------------------------------------+ | addedToClasspath | Specifies, whether the output directory is being added to the | | | to the classpath. Defaults to true. | *---------------------+-----------------------------------------------------------------+ | dir | Sets the name of a directory, which is scanned for the files, | | | which are being validated. | *---------------------+-----------------------------------------------------------------+ | excludes | Specifies a pattern of files, which are being excluded. By | | | default, no files are excluded. The pattern is relative to | | | the directory given by "dir". This element may be repeated | | | as much as needed. | *---------------------+-----------------------------------------------------------------+ | features | Specifies features, which are being set on the transformer | | | factory by invoking the setFeature(String,boolean) method. | *---------------------+-----------------------------------------------------------------+ | forceCreation | If 'true', no up-to-date check is performed and | | | the transformation is always performed. | | | Defaults to "${xml.forceCreation}" or 'false'. | *---------------------+-----------------------------------------------------------------+ | includes | Specifies a pattern of files, which are being included. By | | | default, all files are included. The pattern is relative to | | | the directory given by "dir". This element may be repeated | | | as much as needed. | *---------------------+-----------------------------------------------------------------+ | otherDepends | A list of of extra input files or URLs to consider during | | | the up-to-date check, useful for when resolving remote files. | | | By default it always considers: | | | 1. input files, | | | 2. XSLT file, | | | 3. catalog files, and | | | 4. the pom.xml file of the project executing this plugin. | *---------------------+-----------------------------------------------------------------+ | outputDir | Specifies the name of the output directory, where the generated | | | files are being placed. Defaults to | | | "${project.build.directory}/generated-resources/xml/xslt". | | | Usually, this is equivalent to | | | "target/generated-resources/xml/xslt". | *---------------------+-----------------------------------------------------------------+ | outputProperties | A list of name/value pairs, which are used to invoke the method | | | <<>> on the transformer. For details, | | | see {{{./examples/transform-outputProperties.html}this example}}. | *---------------------+-----------------------------------------------------------------+ | skipDefaultExcludes | Specifies whether the maven's default exludes should NOT | | | be added to the excludes list. | *---------------------+-----------------------------------------------------------------+ | stylesheet | Specifies the stylesheet, which is being used for transforming | | | the fileset. A stylesheet must be specified, there is no | | | default. | *---------------------+-----------------------------------------------------------------+ xml-maven-plugin-xml-maven-plugin-1.0.1/src/site/apt/usage.apt0000644000175000017500000000452512635321500023400 0ustar eugeneeugen~~ ~~ ~~ Copyright 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. ~~ ~~ ----- Usage ----- Usage The plugin offers goals for validating and transforming XML files. Basically, the plugin is used as follows: +---------------------------------------------------------------------------------- ... org.codehaus.mojo xml-maven-plugin ... ... ... +---------------------------------------------------------------------------------- In the above example, the goal would be either of <<>>, or <<>>. {{{./transformation.html}Transformation}} and {{{./validation.html}Validation}} are described on separate pages. Using snapshot versions Snapshot versions (development builds) are available from the {{{http://snapshots.repository.codehaus.org}Codehaus Snapshot Repository}}. This repository must be configured in your POM, if you'd like to use a snapshot version. Configration of the snapshot repository is described in the page on the {{{http://mojo.codehaus.org/using-sandbox-plugins.html}Mojo Sandbox}}. Using a proxy server It is not unusual, that an XML parser attempts to load documents from external servers. In a corporate environment, this will likely work only, if a proxy server is used. The plugin accepts the standard Maven proxy configuration. See the {{{http://maven.apache.org/guides/mini/guide-proxies.html}Mini guide on proxy configuration}} for details. xml-maven-plugin-xml-maven-plugin-1.0.1/src/site/apt/validation.apt0000644000175000017500000001740512635321500024427 0ustar eugeneeugen~~ ~~ ~~ Copyright 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. ~~ ~~ -------------------- Validating XML files -------------------- Validating XML files To validate XML files, the "xml:validate" goal is used. It is configured through a section like the following in your POM: +---------------------------------------------------------------------------------- ... org.codehaus.mojo xml-maven-plugin validate xml xsd xmlschema.xml ... +---------------------------------------------------------------------------------- The example would check all files in the directory "xml" for well formedness. Additionally, it would validate all files in the directory "xsd" against the schema "xmlschema.xml". Goal properties The "xml:validate" goal offers the following configurable properties: *----------------+-----------------------------------------------------------------+ | Property Name | Description | *----------------+-----------------------------------------------------------------+ | basedir | The base directory, which is used for interpreting relative | | | paths. Defaults to the project directory, in which the POM | | | resides. | *----------------+-----------------------------------------------------------------+ | catalogs | A set of catalog files, which configure the entity resolver. | | | For example, it allows to map public ID's or external URL's to | | | local files. Multiple catalog files are supported. In other | | | words, to configure a single catalog file, you would need a | | | section like this: | | | | | | \ | | | \mycatalog.xml\ | | | \ | | | | | | The interpretation of catalog files is done by the Apache XML | | | resolver. See | | | {{{http://xml.apache.org/commons/components/resolver/resolver-article.html}this}} | | | article for details on catalog files and their formats. | *----------------+-----------------------------------------------------------------+ | validationSets | A validation set configures a set of XML files, which are | | | validated against a common XML schema. If you want to validate | | | against multiple schemata, use one validation set per schema. | | | See the above example, which specifies two validation sets. | | | The various child elements of a \ section are | | | listed in the following section. | *----------------+-----------------------------------------------------------------+ Validation Set Configuration A validation set is configured through several child elements: *---------------------+-----------------------------------------------------------------+ | Element Name | Description | *---------------------+-----------------------------------------------------------------+ | publicId | The schemas public ID. May be null, if the schema is loaded | | | through its system ID or if the documents are being validated | | | for wellformedness only. | *---------------------+-----------------------------------------------------------------+ | systemId | The schemas system ID. May be null, if the schema is loaded | | | through its public ID or if the documents are being validated | | | for wellformedness only. | *---------------------+-----------------------------------------------------------------+ | schemaLanguage | The schema language. Defaults to XML Schema. See | | | {{{http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/validation/SchemaFactory.html}this}} | | | description for other possible values. | *---------------------+-----------------------------------------------------------------+ | validating | If the documents are being validated for wellformedness only: | | | Sets, whether the parser should be validating. (In other words: | | | Whether documents must contain a document type or xml schema | | | declaration.) The property is ignored otherwise. The default | | | value is false. | *---------------------+-----------------------------------------------------------------+ | dir | Sets the name of a directory, which is scanned for the files, | | | which are being validated. | *---------------------+-----------------------------------------------------------------+ | includes | Specifies a pattern of files, which are being included. By | | | default, all files are included. The pattern is relative to | | | the directory given by "dir". This element may be repeated | | | as much as needed. | *---------------------+-----------------------------------------------------------------+ | excludes | Specifies a pattern of files, which are being excluded. By | | | default, no files are excluded. The pattern is relative to | | | the directory given by "dir". This element may be repeated | | | as much as needed. | *---------------------+-----------------------------------------------------------------+ | skipDefaultExcludes | Specifies whether the maven's default exludes should NOT | | | be added to the excludes list. | *---------------------+-----------------------------------------------------------------+ xml-maven-plugin-xml-maven-plugin-1.0.1/src/site/apt/index.apt0000644000175000017500000000417712635321500023406 0ustar eugeneeugen~~ ~~ ~~ Copyright 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. ~~ ~~ ---------------- XML Maven Plugin ---------------- The XML Maven Plugin This Plugin is a collection of several XML related tasks. * Goals Overview The plugin offers the following goals: * {{{./validate-mojo.html}xml:validate}} validates XML files against a schema. If the files aren't matching a certain schema, one may simply check, whether they are well formed. * {{{./transform-mojo.html}xml:transform}} transforms XML files by applying XSLT stylesheets. * Usage Instructions on how to use the XML Maven Plugin can be found on the {{{./usage.html}usage page}}. * Examples To provide you with better understanding of some usages of the XML Maven Plugin, you can take a look into the following examples: * Checking, whether XML files are {{{./examples/validate-well-formedness.html}well formed}} * Checking, whether XML files are {{{./examples/validate-schema.html}matching an XML schema}} * {{{./examples/transform-basic.html}Transforming}} XML files by applying an XSLT stylesheet * {{{./examples/transform-change-extension.html}Changing the extension}} of a transformations result files. * Using an {{{./examples/transform-saxon.html}XSLT 2.0 compliant processor}}. * Setting {{{./examples/transform-outputProperties.html}output properties}} on a transformer. * Setting {{{./examples/transform-parameters.html}stylesheet parameters}}. * Suppressing access to external resources by using a {{{./examples/catalog.html} catalog file}}. xml-maven-plugin-xml-maven-plugin-1.0.1/src/site/apt/examples/0000755000175000017500000000000012635321500023376 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/site/apt/examples/transform-parameters.apt0000644000175000017500000000353412635321500030265 0ustar eugeneeugen~~ ~~ ~~ Copyright 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. ~~ ~~ ----------------------------- Setting stylesheet parameters ----------------------------- Setting stylesheet parameters The following configuration snippet would set the stylesheet parameter <<>> to <<>>: +---------------------------------------------------------------------------------- ... org.codehaus.mojo xml-maven-plugin transform src/main/xml src/main/stylesheet.xsl MyParam true ... +---------------------------------------------------------------------------------- xml-maven-plugin-xml-maven-plugin-1.0.1/src/site/apt/examples/transform-outputProperties.apt0000644000175000017500000000366512635321500031544 0ustar eugeneeugen~~ ~~ ~~ Copyright 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. ~~ ~~ ------------------------------------------ Setting a transformers output properties ------------------------------------------ Setting a transformers output properties The following configuration snippet would set the output property <<>> to <<>>: +---------------------------------------------------------------------------------- ... org.codehaus.mojo xml-maven-plugin transform src/main/xml src/main/stylesheet.xsl omit-xml-declaration yes ... +---------------------------------------------------------------------------------- xml-maven-plugin-xml-maven-plugin-1.0.1/src/site/apt/examples/transform-change-regexp.apt0000644000175000017500000001034312635321500030633 0ustar eugeneeugen~~ ~~ ~~ Copyright 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. ~~ ~~ ----------------------------------------------- Use regular expressions to transform file names ----------------------------------------------- Use regular expressions to transform file names A particularly powerfule file mapper deserves more detailed description: It's the regular expression file mapper. This file mapper uses regular expressions to identify certain pieces in the input file name. This piece, or these pieces are replaced with a replacement pattern. Let's first design a configuration snippet, which would transform all files in the directory <<>> by applying the stylesheet <<>>. The created files would have the extension <<<.fo>>>, rather than <<<.xml>>>. (We could very well achieve the same by using the <<>>, as demonstrated in {{{./transform-change-extension.html}this example}}.) +---------------------------------------------------------------------------------- ... org.codehaus.mojo xml-maven-plugin transform src/main/xml src/main/stylesheet.xsl \.gif$ .jpg ... +---------------------------------------------------------------------------------- Let's have a look at some other examples. We omit most of the details, except for the pattern and the replacement, which are the important parts: +---------------------------------------------------------------------------------- ^(.*)\.gif$ $1.jpg +---------------------------------------------------------------------------------- This example is identical with the previous. However, it demonstrates the use of . The contents of <<<(.*)>>> are captured and inserted by using the group term <<<$1>>>. You might have multiple groups and use the terms <<<$2>>>, <<<$3>>>, and so on. +---------------------------------------------------------------------------------- a b +---------------------------------------------------------------------------------- This example replaces the <> a with a b. Nothing special here, except that you might like to replace <> a's instead. Here's how to do it: +---------------------------------------------------------------------------------- a b true +---------------------------------------------------------------------------------- xml-maven-plugin-xml-maven-plugin-1.0.1/src/site/apt/examples/validate-schema.apt0000644000175000017500000000345012635321500027135 0ustar eugeneeugen~~ ~~ ~~ Copyright 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. ~~ ~~ ------------------------------------------------------ Checking, whether XML files are matching an XML Schema ------------------------------------------------------ Checking, whether XML files are matching an XML Schema The following configuration snippet would check, whether all files in the directory <<>> are matching the schema <<>>. +---------------------------------------------------------------------------------- ... org.codehaus.mojo xml-maven-plugin validate src/main/xsd src/main/xmlschema.xml ... +---------------------------------------------------------------------------------- xml-maven-plugin-xml-maven-plugin-1.0.1/src/site/apt/examples/catalog.apt0000644000175000017500000001360012635321500025516 0ustar eugeneeugen~~ ~~ ~~ Copyright 2011 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. ~~ ~~ ------------- Catalog files ------------- Catalog files It is not unusual that XML parsers or stylesheet processors try to access external resources. For example if you specify an external schema, the XML parser might try to load the external schema in order to validate your XML file: +-------------------------------------------------------------------------- ... +-------------------------------------------------------------------------- In this example the XML parser would likely attempt to load an XML schema from <<>>. Another example might be the use of a DTD: +--------------------------------------------------------------------------
A sample document.
+-------------------------------------------------------------------------- In this case, the XML parser would likely attempt to connect to <<>>. This is all very well, if you are connected to the Internet, with suitably configured proxy servers. But if that is not the case, then you will likely encounter trouble. The solution is using local copies of these external resources and a catalog file. This is best explained by an example catalog file: +-------------------------------------------------------------------------- +-------------------------------------------------------------------------- The example shows to things: * If the XML parser is searching for a file with a <> of <<<--COUNTER-->>>, then the catalog advises to use the local file <<<./doc-schema.xsd>>> instead. * If the XML parser or stylesheet processor is searching for a file with the <> <<>>, then the catalog requests to use the local file <<<./schema-for-xslt20.xsd>>> instead. It doesn't matter whether you use the public id or the system id. The important thing to know is what the respective public id and the system id are. In our first example, we had a public id of <<>> (the namespace URI) and a system id of <<>> (the URL from which to actually load the schema). In the second example, the public id was <<<--COUNTER-->> and the system id <<>>. In other words, we might as well rewrite our catalog file like this: +-------------------------------------------------------------------------- +-------------------------------------------------------------------------- We might as well use only public id's or system id's. How to use a catalog file To use a catalog file, you must specify it in your POM. +-------------------------------------------------------------------------- org.codehaus.mojo xml-maven-plugin 1.0 src/main/xml doc1.xml src/main/xml/catalog.xml +-------------------------------------------------------------------------- In this example, the catalog file would be stored in <<>>. To use a catalog file for transformation, just use the same <<>> element in your <<>> section. Relative paths in the catalog file An important point to make: How are relative paths in the catalog file interpreted? Suggest that the catalog file is stored in <<>> and the catalog file contains the following entry: +-------------------------------------------------------------------------- +-------------------------------------------------------------------------- The answer is that the URI is interpreted relative to the catalog files. In other words, the <<>> is stored in <<>> and not in <<<${basedir}/sample.dtd>>>. xml-maven-plugin-xml-maven-plugin-1.0.1/src/site/apt/examples/validate-well-formedness.apt0000644000175000017500000000323312635321500031002 0ustar eugeneeugen~~ ~~ ~~ Copyright 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. ~~ ~~ ------------------------------------------- Checking, whether XML files are well formed ------------------------------------------- Checking, whether XML files are well formed The following configuration snippet would check, whether all files in the directory <<>> are well formed: +---------------------------------------------------------------------------------- ... org.codehaus.mojo xml-maven-plugin validate src/main/xml ... +---------------------------------------------------------------------------------- xml-maven-plugin-xml-maven-plugin-1.0.1/src/site/apt/examples/transform-change-extension.apt0000644000175000017500000000443512635321500031362 0ustar eugeneeugen~~ ~~ ~~ Copyright 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. ~~ ~~ ------------------------------------------- Change the extension of the generated files ------------------------------------------- Change the extension of the generated files The following configuration snippet would transform all files in the directory <<>> by applying the stylesheet <<>>. The created files would have the extension <<<.fo>>>, rather than <<<.xml>>>. +---------------------------------------------------------------------------------- ... org.codehaus.mojo xml-maven-plugin transform src/main/xml src/main/stylesheet.xsl .fo ... +---------------------------------------------------------------------------------- Btw, the same could be achieved the much more powerful and generic RegExpFileMapper, which you find explained in more detail in {{{./transform-change-regexp.html}another example}}. xml-maven-plugin-xml-maven-plugin-1.0.1/src/site/apt/examples/transform-basic.apt0000644000175000017500000000347112635321500027203 0ustar eugeneeugen~~ ~~ ~~ Copyright 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. ~~ ~~ ----------------------------------------------------- Transforming XML files by applying an XSLT stylesheet ----------------------------------------------------- Transforming XML files by applying an XSLT stylesheet The following configuration snippet would transform all files in the directory <<>> by applying the stylesheet <<>>. +---------------------------------------------------------------------------------- ... org.codehaus.mojo xml-maven-plugin transform src/main/xml src/main/stylesheet.xsl ... +---------------------------------------------------------------------------------- xml-maven-plugin-xml-maven-plugin-1.0.1/src/site/apt/examples/transform-saxon.apt0000644000175000017500000000533512635321500027253 0ustar eugeneeugen~~ ~~ ~~ Copyright 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. ~~ ~~ ----------------------------------- Using an alternative XSLT processor ----------------------------------- Using an alternative XSLT processor An alternative XSLT processor is important, if you want to use XSLT 2.0 stylesheets or if you would like to work around a bug in your JRE's stylesheet processor. As of this writing, {{{http://saxon.sourceforge.net/}Saxon}} is the only XSLT 2.0 compliant processor, so we take this as an example. Changing the XSLT processor is as simple as specifying it as a dependency: +---------------------------------------------------------------------------------- ... org.codehaus.mojo xml-maven-plugin transform src/main/xml src/main/stylesheet.xsl net.sf.saxon saxon 8.7 ... +---------------------------------------------------------------------------------- If you would like to know, which XSLT processor and/or version you are actually using, add code like the following to your stylesheet: +---------------------------------------------------------------------------------- XSLT Version = XSLT Vendor = XSLT Vendor URL = +---------------------------------------------------------------------------------- xml-maven-plugin-xml-maven-plugin-1.0.1/src/site/site.xml0000644000175000017500000000455212635321500022470 0ustar eugeneeugen www.mojohaus.org 5211 thin-badge mojohaus/${project.artifactId} right gray xml-maven-plugin-xml-maven-plugin-1.0.1/src/site/fml/0000755000175000017500000000000012635321500021552 5ustar eugeneeugenxml-maven-plugin-xml-maven-plugin-1.0.1/src/site/fml/faq.fml0000644000175000017500000001346212635321500023027 0ustar eugeneeugen General What goals does the XML Maven Plugin offer?

The plugin offers the xml:validate goal for validating XML files and the xml:transform goal for transforming XML files.

How do I use snapshot versions of the plugin?

The use of snapshot versions is described in the Usage document.

How do I tell the plugin to use my proxy server?

Use the standard Maven proxy settings. See the Mini guide on proxy configuration for details.

I have a stylesheet (a schema, another resource), which should be loaded through the class loader.

The plugin attempts to resolve resources through the class loader automatically. Alternatively, you can enforce using the class loader, if you specify your resource with an URI like "resource:org/foo/stylesheet.xsl".

The plugin doesn't work in offline mode. It always tries to resolve external resources and fails, if the network is not available.

You've got to download the resources in question once and store them as part of the project. A catalog file will replace the external resource with your local copy. See this example for details.

Transformation How do I use an XSLT stylesheet for transforming files?

See this example.

How do I transform the names of the generated files?

Use a File Mapper. See this example.

How do I perform other kinds of name transformations?

Check the list of available file mappers at File Mapper. Perhaps, there is one which suits your needs.

If not, you need to implement your own. If you feel that it is sufficiently generic, then you might consider to submit it as a contribution to the Plexus IO component.

See this example for how to configure the transformer to map names.

How can I use XSLT 2.0 in my stylesheets?

You need to use an XSLT 2.0 complicant stylesheet processor like Saxon. See this example.

How do I use another XSLT processor, for example Saxon?

You need to specify your favorite XSLT processor as a dependency. See this example.

How do I set a transformers output properties?

Use the element outputProperties in the transformation set. See this example for details.

How do I set stylesheet parameters?

Use the element parameters in the transformation set. See this example for details.

Validation How do I check files for well formedness?

See this example.

How do I make sure, that files are matching an XML schema?

See this example.

xml-maven-plugin-xml-maven-plugin-1.0.1/.gitignore0000644000175000017500000000037412635321500021235 0ustar eugeneeugen# Maven target/ pom.xml.tag pom.xml.releaseBackup pom.xml.versionsBackup pom.xml.next release.properties # Eclipse .project .classpath .settings/ bin/ # IDEA .idea *.ipr *.iml *.iws # NetBeans nb-configuration.xml # KDE .directory # OSX .DS_Store xml-maven-plugin-xml-maven-plugin-1.0.1/LICENSE.txt0000644000175000017500000002613612635321500021074 0ustar eugeneeugen 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. xml-maven-plugin-xml-maven-plugin-1.0.1/pom.xml0000644000175000017500000002057612635321500020570 0ustar eugeneeugen 4.0.0 org.codehaus.mojo mojo-parent 38 xml-maven-plugin maven-plugin XML Maven Plugin 1.0.1 http://www.mojohaus.org/xml-maven-plugin/ ${mavenVersion} A plugin for various XML related tasks like validation, transformation, and the like. 2006 The Apache Software Foundation http://www.apache.org/ jochen Jochen Wiedmann jochen.wiedmann@gmail.com olamy Olivier Lamy olamy@apache.org Ramón Torres Bátiz rbatiz@gmail.com Andreas Eternach a.eternach@directbox.com Mark Hobson markhobson@gmail.com Anagnostopoulos Kostis ankostis@gmail.com Paul Lucassen pglucassen@gmail.com Jeff Martin jeff@jeffmartin.com Mykola Nikishov mn@mn.com.ua Luke W. Patterson lukewpatterson@gmail.com Nick Stolwijk nstolwijk@iprofs.nl Andrew Thornton art27@cantab.net Aleksei Valikov valikov@gmx.net The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt repo scm:git:https://github.com/mojohaus/xml-maven-plugin.git scm:git:ssh://git@github.com/mojohaus/xml-maven-plugin.git https://github.com/mojohaus/xml-maven-plugin xml-maven-plugin-1.0.1 GitHub Issues https://github.com/mojohaus/xml-maven-plugin/issues org.apache.maven maven-plugin-api ${mavenVersion} org.apache.maven maven-core ${mavenVersion} org.codehaus.plexus plexus-utils 3.0.22 org.codehaus.plexus plexus-resources 1.0.1 xerces xercesImpl 2.9.1 xml-apis xml-apis 1.3.04 xml-resolver xml-resolver 1.2 org.codehaus.plexus plexus-io 2.6.1 org.apache.maven.plugin-testing maven-plugin-testing-harness 2.1 test org.apache.maven maven-compat ${mavenVersion} test net.sf.saxon saxon 8.7 test xalan xalan 2.7.1 test org.apache.maven.plugin-tools maven-plugin-annotations provided org.apache.maven.plugins maven-checkstyle-plugin 2.15 org.apache.maven.plugins maven-invoker-plugin true src/it ${project.build.directory}/it */pom.xml setup verify ${project.build.directory}/local-repo src/it/settings.xml integration-test install run org.apache.maven.plugins maven-plugin-plugin xml default-descriptor descriptor helpmojo process-classes org.apache.maven.plugins maven-checkstyle-plugin 2.15 org.apache.maven.plugins maven-changes-plugin 2.11 changes-report org.apache.rat apache-rat-plugin 0.11 src/main/checkstyle/maven-header.txt src/test/it*/target/**/* 3.0 1.6 target/staging/${project.artifactId}