Running with Maven - xspec/xspec GitHub Wiki
Apache Maven is a build automation tool to manage a project's build, reporting and documentation.
Maven plugin for running XSpec tests as part of a build is available at the XSpec organization repository (a fork of Adam's now inactive one). Another implementation is available at Daisy's.
An external project, Jxsl, provides a Maven archetype for XSpec. The goal is to provide everything needed to integrate with Continuous Integration tools for Java (like Hudson, Cruise Control, etc.) See Benoit Mercier's presentation at Balisage 2011 for more info.
Another external project, Maven Plugin for XSpec, is a Maven plugin wrapper to execute the native XSpec framework by an internal ANT process.
Starting with v2.0, Maven artifact io.xspec:xspec
provides enduser-files
classifier. It is a zip file containing a subset of this repository, chosen for end-users. Files useless for end-users to run XSpec are not included.
For example, with this pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1</version>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-xspec</id>
<goals>
<goal>unpack</goal>
</goals>
</execution>
</executions>
<configuration>
<artifactItems>
<artifactItem>
<groupId>io.xspec</groupId>
<artifactId>xspec</artifactId>
<version>2.2.4</version>
<classifier>enduser-files</classifier>
<type>zip</type><!-- "tar.gz" is also available -->
</artifactItem>
</artifactItems>
</configuration>
</plugin>
</plugins>
</build>
</project>
you can fetch the XSpec file set
$ mvn dependency:unpack
...
[INFO] --- maven-dependency-plugin:2.8:unpack (default-cli) @ my-app ---
[INFO] Configured Artifact: io.xspec:xspec:enduser-files:2.2.4:zip
Downloading from ...
Downloaded from ...
[INFO] Unpacking ...
and once fetched, you can run XSpec from there:
$ target/dependency/xspec-2.2.4/bin/xspec.sh -h
SAXON_CP and SAXON_HOME both not set!
Usage: xspec [-t|-q|-s|-c|-j|-catalog file|-e|-h] file
file the XSpec document
-t test an XSLT stylesheet (the default)
-q test an XQuery module (mutually exclusive with -t and -s)
-s test a Schematron schema (mutually exclusive with -t and -q)
-c output test coverage report (XSLT only)
-j output JUnit report
-catalog file use XML Catalog file to locate resources
-e treat failed tests as error
-h display this help message
$ ant -buildfile target/dependency/xspec-2.2.4/build.xml -projecthelp
Buildfile: .../target/dependency/xspec-2.2.4/build.xml
Usage:
* Command-line
https://github.com/xspec/xspec/wiki/Running-with-Ant
* Oxygen XSLT transformation scenario
https://github.com/xspec/xspec/wiki/Running-with-Oxygen
Main targets:
xspec Generates the result of XSpec tests
Default target: xspec
Or, just using command line without pom.xml
:
$ mvn dependency:unpack -Dartifact=io.xspec:xspec:2.2.4:tar.gz:enduser-files -Dproject.basedir=/tmp/xspec
...
[INFO] Configured Artifact: io.xspec:xspec:enduser-files:2.2.4:tar.gz
Downloading from ...
Downloaded from ...
[INFO] Unpacking ...
...
$ /tmp/xspec/target/dependency/xspec-2.2.4/bin/xspec.sh -h
SAXON_CP and SAXON_HOME both not set!
Usage: xspec [-t|-q|-s|-c|-j|-catalog file|-e|-h] file
file the XSpec document
-t test an XSLT stylesheet (the default)
-q test an XQuery module (mutually exclusive with -t and -s)
-s test a Schematron schema (mutually exclusive with -t and -q)
-c output test coverage report (XSLT only)
-j output JUnit report
-catalog file use XML Catalog file to locate resources
-e treat failed tests as error
-h display this help message
$ ant -buildfile /tmp/xspec/target/dependency/xspec-2.2.4/build.xml -projecthelp
Buildfile: /tmp/xspec/target/dependency/xspec-2.2.4/build.xml
Usage:
* Command-line
https://github.com/xspec/xspec/wiki/Running-with-Ant
* Oxygen XSLT transformation scenario
https://github.com/xspec/xspec/wiki/Running-with-Oxygen
Main targets:
xspec Generates the result of XSpec tests
Default target: xspec