xml-maven-plugin-xml-maven-plugin-1.0.1/ 0000755 0001750 0001750 00000000000 12635321500 017241 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/README.md 0000644 0001750 0001750 00000000720 12635321500 020517 0 ustar eugene eugen # MojoHaus XML Maven Plugin
This is the [xml-maven-plugin](http://www.mojohaus.org/xml-maven-plugin/).
[](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.yml 0000644 0001750 0001750 00000000401 12635321500 021345 0 ustar eugene eugen language: 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 verify xml-maven-plugin-xml-maven-plugin-1.0.1/NOTICE.txt 0000644 0001750 0001750 00000000245 12635321500 020764 0 ustar eugene eugen Maven 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/ 0000755 0001750 0001750 00000000000 12635321500 020030 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/changes/ 0000755 0001750 0001750 00000000000 12635321500 021440 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/changes/changes.xml 0000644 0001750 0001750 00000015130 12635321500 023572 0 ustar eugene eugen
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/ 0000755 0001750 0001750 00000000000 12635321500 020754 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/ 0000755 0001750 0001750 00000000000 12635321500 021675 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/ 0000755 0001750 0001750 00000000000 12635321500 022464 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/ 0000755 0001750 0001750 00000000000 12635321500 024257 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/ 0000755 0001750 0001750 00000000000 12635321500 025223 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/ 0000755 0001750 0001750 00000000000 12635321500 026023 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/transformer/ 0000755 0001750 0001750 00000000000 12635321500 030365 5 ustar eugene eugen ././@LongLink 0000644 0000000 0000000 00000000153 00000000000 011602 L ustar root root xml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/transformer/NameValuePair.java xml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/transformer/NameValuePai0000644 0001750 0001750 00000002712 12635321500 032621 0 ustar eugene eugen package 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;
}
}
././@LongLink 0000644 0000000 0000000 00000000157 00000000000 011606 L ustar root root xml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/transformer/TransformationSet.java xml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/transformer/Transformati0000644 0001750 0001750 00000016134 12635321500 032766 0 ustar eugene eugen package 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.java 0000644 0001750 0001750 00000005073 12635321500 031053 0 ustar eugene eugen package 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.java 0000644 0001750 0001750 00000054164 12635321500 031500 0 ustar eugene eugen package 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.java 0000644 0001750 0001750 00000023251 12635321500 031704 0 ustar eugene eugen package 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.java 0000644 0001750 0001750 00000025617 12635321500 031752 0 ustar eugene eugen package 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/ 0000755 0001750 0001750 00000000000 12635321500 027313 5 ustar eugene eugen ././@LongLink 0000644 0000000 0000000 00000000162 00000000000 011602 L ustar root root xml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/format/XmlFormatViolationHandler.java xml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/format/XmlFormatViolatio0000644 0001750 0001750 00000000617 12635321500 032662 0 ustar eugene eugen package 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 );
} ././@LongLink 0000644 0000000 0000000 00000000153 00000000000 011602 L ustar root root xml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/format/XmlFormatViolation.java xml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/format/XmlFormatViolatio0000644 0001750 0001750 00000002516 12635321500 032662 0 ustar eugene eugen package 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;
}
} ././@LongLink 0000644 0000000 0000000 00000000146 00000000000 011604 L ustar root root xml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/format/FormatFileSet.java xml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/format/FormatFileSet.jav0000644 0001750 0001750 00000004030 12635321500 032516 0 ustar eugene eugen package 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;
}
}
././@LongLink 0000644 0000000 0000000 00000000156 00000000000 011605 L ustar root root xml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/format/IndentCheckSaxHandler.java xml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/format/IndentCheckSaxHan0000644 0001750 0001750 00000023461 12635321500 032526 0 ustar eugene eugen package 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 " + qName + ">";
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.java 0000644 0001750 0001750 00000030206 12635321500 031245 0 ustar eugene eugen package 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.java 0000644 0001750 0001750 00000025064 12635321500 030476 0 ustar eugene eugen package 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/ 0000755 0001750 0001750 00000000000 12635321500 030155 5 ustar eugene eugen ././@LongLink 0000644 0000000 0000000 00000000152 00000000000 011601 L ustar root root xml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/validation/ValidationSet.java xml-maven-plugin-xml-maven-plugin-1.0.1/src/main/java/org/codehaus/mojo/xml/validation/ValidationSet0000644 0001750 0001750 00000012514 12635321500 032651 0 ustar eugene eugen package 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/ 0000755 0001750 0001750 00000000000 12635321500 023112 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/main/checkstyle/maven-header.txt 0000644 0001750 0001750 00000001662 12635321500 026214 0 ustar eugene eugen ^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/ 0000755 0001750 0001750 00000000000 12635321500 021007 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/resources/ 0000755 0001750 0001750 00000000000 12635321500 023021 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/resources/org/ 0000755 0001750 0001750 00000000000 12635321500 023610 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/resources/org/codehaus/ 0000755 0001750 0001750 00000000000 12635321500 025403 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/resources/org/codehaus/mojo/ 0000755 0001750 0001750 00000000000 12635321500 026347 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/resources/org/codehaus/mojo/xml/ 0000755 0001750 0001750 00000000000 12635321500 027147 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/resources/org/codehaus/mojo/xml/test/ 0000755 0001750 0001750 00000000000 12635321500 030126 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/resources/org/codehaus/mojo/xml/test/it10a.xsl 0000644 0001750 0001750 00000001446 12635321500 031601 0 ustar eugene eugen
xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/resources/org/codehaus/mojo/xml/test/it9a.xml 0000644 0001750 0001750 00000001172 12635321500 031517 0 ustar eugene eugen
it9a
xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it5/ 0000755 0001750 0001750 00000000000 12635321500 021510 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it5/xml/ 0000755 0001750 0001750 00000000000 12635321500 022310 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it5/xml/doc1.xml 0000644 0001750 0001750 00000001272 12635321500 023662 0 ustar eugene eugen
A sample document, which should be validatable without any problems.
xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it5/pom.xml 0000644 0001750 0001750 00000003274 12635321500 023033 0 ustar eugene eugen
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.xsl 0000644 0001750 0001750 00000001542 12635321500 022743 0 ustar eugene eugen
xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/java/ 0000755 0001750 0001750 00000000000 12635321500 021730 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/java/org/ 0000755 0001750 0001750 00000000000 12635321500 022517 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/java/org/codehaus/ 0000755 0001750 0001750 00000000000 12635321500 024312 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/java/org/codehaus/mojo/ 0000755 0001750 0001750 00000000000 12635321500 025256 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/java/org/codehaus/mojo/xml/ 0000755 0001750 0001750 00000000000 12635321500 026056 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/java/org/codehaus/mojo/xml/test/ 0000755 0001750 0001750 00000000000 12635321500 027035 5 ustar eugene eugen ././@LongLink 0000644 0000000 0000000 00000000150 00000000000 011577 L ustar root root xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/java/org/codehaus/mojo/xml/test/TransformMojoTest.java xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/java/org/codehaus/mojo/xml/test/TransformMojoTest.j0000644 0001750 0001750 00000023133 12635321500 032652 0 ustar eugene eugen /*
* 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() );
}
}
././@LongLink 0000644 0000000 0000000 00000000156 00000000000 011605 L ustar root root xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/java/org/codehaus/mojo/xml/test/AbstractXmlMojoTestCase.java xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/java/org/codehaus/mojo/xml/test/AbstractXmlMojoTest0000644 0001750 0001750 00000010106 12635321500 032667 0 ustar eugene eugen /*
* 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;
}
}
}
././@LongLink 0000644 0000000 0000000 00000000147 00000000000 011605 L ustar root root xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/java/org/codehaus/mojo/xml/test/ValidateMojoTest.java xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/java/org/codehaus/mojo/xml/test/ValidateMojoTest.ja0000644 0001750 0001750 00000004070 12635321500 032570 0 ustar eugene eugen package 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/ 0000755 0001750 0001750 00000000000 12635321500 021566 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it12/xml/ 0000755 0001750 0001750 00000000000 12635321500 022366 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it12/xml/DoRequest.xml 0000644 0001750 0001750 00000000224 12635321500 025021 0 ustar eugene eugen
D
xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it12/xsd/ 0000755 0001750 0001750 00000000000 12635321500 022364 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it12/xsd/messages.xsd 0000644 0001750 0001750 00000000772 12635321500 024721 0 ustar eugene eugen
xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it12/xsd/simpletypes.xsd 0000644 0001750 0001750 00000000647 12635321500 025471 0 ustar eugene eugen
xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it12/catalogue.xml 0000644 0001750 0001750 00000001362 12635321500 024256 0 ustar eugene eugen
xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it12/pom.xml 0000644 0001750 0001750 00000004040 12635321500 023101 0 ustar eugene eugen
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/ 0000755 0001750 0001750 00000000000 12635321500 021565 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it11/it11.xsl 0000644 0001750 0001750 00000001474 12635321500 023101 0 ustar eugene eugen
xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it11/xml/ 0000755 0001750 0001750 00000000000 12635321500 022365 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it11/xml/doc1.xml 0000644 0001750 0001750 00000001314 12635321500 023734 0 ustar eugene eugen
A sample document, which should be validatable without any problems.
xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it11/pom.xml 0000644 0001750 0001750 00000003142 12635321500 023102 0 ustar eugene eugen
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/ 0000755 0001750 0001750 00000000000 12635321500 021507 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it4/xml/ 0000755 0001750 0001750 00000000000 12635321500 022307 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it4/xml/doc1.xml 0000644 0001750 0001750 00000001272 12635321500 023661 0 ustar eugene eugen
A sample document, which should be validatable without any problems.
xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it4/pom.xml 0000644 0001750 0001750 00000003014 12635321500 023022 0 ustar eugene eugen
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.xsl 0000644 0001750 0001750 00000001474 12635321500 022745 0 ustar eugene eugen
xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it7/ 0000755 0001750 0001750 00000000000 12635321500 021512 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it7/xml/ 0000755 0001750 0001750 00000000000 12635321500 022312 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it7/xml/doc1.xml 0000644 0001750 0001750 00000001272 12635321500 023664 0 ustar eugene eugen
A sample document, which should be validatable without any problems.
xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it7/pom.xml 0000644 0001750 0001750 00000003614 12635321500 023033 0 ustar eugene eugen
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.xsl 0000644 0001750 0001750 00000001446 12635321500 022752 0 ustar eugene eugen
xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it3/ 0000755 0001750 0001750 00000000000 12635321500 021506 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it3/xml/ 0000755 0001750 0001750 00000000000 12635321500 022306 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it3/xml/doc1.xml 0000644 0001750 0001750 00000001237 12635321500 023661 0 ustar eugene eugen
xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it3/schema.xsd 0000644 0001750 0001750 00000002007 12635321500 023465 0 ustar eugene eugen
xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it3/pom.xml 0000644 0001750 0001750 00000002654 12635321500 023032 0 ustar eugene eugen
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.xml 0000644 0001750 0001750 00000001357 12635321500 023650 0 ustar eugene eugen
xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it6/ 0000755 0001750 0001750 00000000000 12635321500 021511 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it6/xml/ 0000755 0001750 0001750 00000000000 12635321500 022311 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it6/xml/doc1.xml 0000644 0001750 0001750 00000001272 12635321500 023663 0 ustar eugene eugen
A sample document, which should be validatable without any problems.
xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it6/pom.xml 0000644 0001750 0001750 00000003434 12635321500 023032 0 ustar eugene eugen
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.xsl 0000644 0001750 0001750 00000001446 12635321500 022746 0 ustar eugene eugen
xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it1/ 0000755 0001750 0001750 00000000000 12635321500 021504 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it1/xml/ 0000755 0001750 0001750 00000000000 12635321500 022304 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it1/xml/doc1.xml 0000644 0001750 0001750 00000001272 12635321500 023656 0 ustar eugene eugen
A sample document, which should be validatable without any problems.
xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it1/pom.xml 0000644 0001750 0001750 00000002734 12635321500 023027 0 ustar eugene eugen
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/ 0000755 0001750 0001750 00000000000 12635321500 021505 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it2/xml/ 0000755 0001750 0001750 00000000000 12635321500 022305 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it2/xml/doc1.xml 0000644 0001750 0001750 00000001271 12635321500 023656 0 ustar eugene eugen
A sample document, on which validation should report a problem.
xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it2/pom.xml 0000644 0001750 0001750 00000002447 12635321500 023031 0 ustar eugene eugen
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/ 0000755 0001750 0001750 00000000000 12635321500 021564 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it10/xml/ 0000755 0001750 0001750 00000000000 12635321500 022364 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it10/xml/doc1.xml 0000644 0001750 0001750 00000001272 12635321500 023736 0 ustar eugene eugen
A sample document, which should be validatable without any problems.
xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it10/pom.xml 0000644 0001750 0001750 00000002606 12635321500 023105 0 ustar eugene eugen
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/ 0000755 0001750 0001750 00000000000 12635321500 021513 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it8/it8.xsl 0000644 0001750 0001750 00000002025 12635321500 022746 0 ustar eugene eugen
xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it8/xml/ 0000755 0001750 0001750 00000000000 12635321500 022313 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it8/xml/doc1.xml 0000644 0001750 0001750 00000001270 12635321500 023663 0 ustar eugene eugen
A sample document, which should be validatable without any problems.
xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it8/pom.xml 0000644 0001750 0001750 00000004011 12635321500 023024 0 ustar eugene eugen
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/ 0000755 0001750 0001750 00000000000 12635321500 021514 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it9/xml/ 0000755 0001750 0001750 00000000000 12635321500 022314 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/test/it9/xml/doc1.xml 0000644 0001750 0001750 00000001553 12635321500 023670 0 ustar eugene eugen
]>
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.xml 0000644 0001750 0001750 00000002747 12635321500 023043 0 ustar eugene eugen
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/ 0000755 0001750 0001750 00000000000 12635321500 020444 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/mojo-1438-transform/ 0000755 0001750 0001750 00000000000 12635321500 024016 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/mojo-1438-transform/src/ 0000755 0001750 0001750 00000000000 12635321500 024605 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/mojo-1438-transform/src/main/ 0000755 0001750 0001750 00000000000 12635321500 025531 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/mojo-1438-transform/src/main/xml/ 0000755 0001750 0001750 00000000000 12635321500 026331 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/mojo-1438-transform/src/main/xml/doc1.xml 0000644 0001750 0001750 00000001403 12635321500 027677 0 ustar eugene eugen
xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/mojo-1438-transform/src/main/xml/catalog.xml 0000644 0001750 0001750 00000001351 12635321500 030465 0 ustar eugene eugen
xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/mojo-1438-transform/src/main/xsl/ 0000755 0001750 0001750 00000000000 12635321500 026337 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/mojo-1438-transform/src/main/xsl/it10.xsl 0000644 0001750 0001750 00000002025 12635321500 027643 0 ustar eugene eugen
xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/mojo-1438-transform/src/main/dtd/ 0000755 0001750 0001750 00000000000 12635321500 026304 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/mojo-1438-transform/src/main/dtd/sample.dtd 0000644 0001750 0001750 00000000064 12635321500 030262 0 ustar eugene eugen
xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/mojo-1438-transform/pom.xml 0000644 0001750 0001750 00000003521 12635321500 025334 0 ustar eugene eugen
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.properties 0000644 0001750 0001750 00000000044 12635321500 027607 0 ustar eugene eugen invoker.goals = clean xml:transform
xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it5/ 0000755 0001750 0001750 00000000000 12635321500 021145 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it5/src/ 0000755 0001750 0001750 00000000000 12635321500 021734 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it5/src/main/ 0000755 0001750 0001750 00000000000 12635321500 022660 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it5/src/main/xml/ 0000755 0001750 0001750 00000000000 12635321500 023460 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it5/src/main/xml/doc1.xml 0000644 0001750 0001750 00000001272 12635321500 025032 0 ustar eugene eugen
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/ 0000755 0001750 0001750 00000000000 12635321500 023466 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it5/src/main/xsl/it5.xsl 0000644 0001750 0001750 00000001550 12635321500 024720 0 ustar eugene eugen
xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/it5/pom.xml 0000644 0001750 0001750 00000003372 12635321500 022467 0 ustar eugene eugen
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.properties 0000644 0001750 0001750 00000000044 12635321500 024736 0 ustar eugene eugen invoker.goals = clean xml:transform
xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/check-format-pass/ 0000755 0001750 0001750 00000000000 12635321500 023753 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/check-format-pass/src/ 0000755 0001750 0001750 00000000000 12635321500 024542 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/check-format-pass/src/main/ 0000755 0001750 0001750 00000000000 12635321500 025466 5 ustar eugene eugen xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/check-format-pass/src/main/xml/ 0000755 0001750 0001750 00000000000 12635321500 026266 5 ustar eugene eugen ././@LongLink 0000644 0000000 0000000 00000000163 00000000000 011603 L ustar root root xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/check-format-pass/src/main/xml/2-spaces-correct-no-schema-short.xml xml-maven-plugin-xml-maven-plugin-1.0.1/src/it/check-format-pass/src/main/xml/2-spaces-correct-no-sc0000644 0001750 0001750 00000000164 12635321500 032303 0 ustar eugene eugen
text in text-1